public Image createImage(String name) throws IOException { return getImage(name); }
private Image getImage(InputStream is) throws IOException { ImageFilter filter = null; if (isColor()) { filter = new RGBImageFilter(); } else { if (numColors() == 2) { filter = new BWImageFilter(); } else { filter = new GrayImageFilter(); } } return new SwtImmutableImage(SwtDeviceComponent.createImage(is, filter)); }
public BWImageFilter (double Yr, double Yg, double Yb) { this.Yr = Yr; this.Yg = Yg; this.Yb = Yb; backgroundColor = SwtDeviceComponent.getColor(new RGB( ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getRed(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getGreen(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getBlue())); foregroundColor = SwtDeviceComponent.getColor(new RGB( ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getRed(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getGreen(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getBlue())); }
try { SwtDeviceDisplay deviceDisplay = (SwtDeviceDisplay) device.getDeviceDisplay(); deviceDisplay.paintDisplayable(gc, x, y, width, height); if (!deviceDisplay.isFullScreenMode()) { deviceDisplay.paintControls(gc);
org.microemu.device.impl.Rectangle rect = ((SwtDeviceDisplay) device.getDeviceDisplay()).getDisplayRectangle(); SwtInputMethod inputMethod = (SwtInputMethod) device.getInputMethod(); inputMethod.pointerPressed(e.x - rect.x, e.y - rect.y); } else { org.microemu.device.impl.Rectangle pb = ((SwtDeviceDisplay) device.getDeviceDisplay()).getDisplayPaintable(); inputMethod.pointerPressed(e.x - rect.x - pb.x, e.y - rect.y - pb.y);
image = null; return createRGBImage(rgbTransformedData, width, height, true);
public SwtDisplayGraphics(SwtGraphics a_g, MutableImage a_image) { this.g = a_g; this.image = a_image; Device device = DeviceFactory.getDevice(); this.g.setBackground(g.getColor(new RGB( ((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getRed(), ((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getGreen(), ((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getBlue()))); SwtFont tmpFont = (SwtFont) ((SwtFontManager) device.getFontManager()).getFont(currentFont); this.g.setFont(tmpFont.getFont()); if (device.getDeviceDisplay().isColor()) { this.filter = new RGBImageFilter(); } else { if (device.getDeviceDisplay().numColors() == 2) { this.filter = new BWImageFilter(); } else { this.filter = new GrayImageFilter(); } } }
private DeviceDisplay deviceDisplay = new SwtDeviceDisplay(this);
ma.getDisplayAccess().paint(new SwtDisplayGraphics(g, getDisplayImage())); g.setFont(oldf); if (!(current instanceof Canvas)
((SwtDeviceDisplay) device.getDeviceDisplay()).getDisplayRectangle(); gc.translate(displayRectangle.x, displayRectangle.y); dc.paint(gc);
public RGBImageFilter() { backgroundColor = SwtDeviceComponent.getColor(new RGB( ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getRed(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getGreen(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getBlue())); foregroundColor = SwtDeviceComponent.getColor(new RGB( ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getRed(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getGreen(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getBlue())); Rr = foregroundColor.getRed() - backgroundColor.getRed(); Rg = foregroundColor.getGreen() - backgroundColor.getGreen(); Rb = foregroundColor.getBlue() - backgroundColor.getBlue(); }
org.microemu.device.impl.Rectangle rect = ((SwtDeviceDisplay) device.getDeviceDisplay()).getDisplayRectangle(); SwtInputMethod inputMethod = (SwtInputMethod) device.getInputMethod(); boolean fullScreenMode = device.getDeviceDisplay().isFullScreenMode(); inputMethod.pointerDragged(e.x - rect.x, e.y - rect.y); } else { org.microemu.device.impl.Rectangle pb = ((SwtDeviceDisplay) device.getDeviceDisplay()).getDisplayPaintable(); inputMethod.pointerDragged(e.x - rect.x - pb.x, e.y - rect.y - pb.y);
public GrayImageFilter (double Yr, double Yg, double Yb) { this.Yr = Yr; this.Yg = Yg; this.Yb = Yb; Color backgroundColor = SwtDeviceComponent.getColor(new RGB( ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getRed(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getGreen(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getBlue())); foregroundColor = SwtDeviceComponent.getColor(new RGB( ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getRed(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getGreen(), ((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getBlue())); Rr = (backgroundColor.getRed() - foregroundColor.getRed()) / 256d; Rg = (backgroundColor.getGreen() - foregroundColor.getGreen()) / 256d; Rb = (backgroundColor.getBlue() - foregroundColor.getBlue()) / 256d; }
org.microemu.device.impl.Rectangle rect = ((SwtDeviceDisplay) device.getDeviceDisplay()).getDisplayRectangle(); SwtInputMethod inputMethod = (SwtInputMethod) device.getInputMethod(); boolean fullScreenMode = device.getDeviceDisplay().isFullScreenMode(); inputMethod.pointerReleased(e.x - rect.x, e.y - rect.y); } else { org.microemu.device.impl.Rectangle pb = ((SwtDeviceDisplay) device.getDeviceDisplay()).getDisplayPaintable(); inputMethod.pointerReleased(e.x - rect.x - pb.x, e.y - rect.y - pb.y);
public Image createImage(InputStream is) throws IOException { if (is == null) { throw new IOException(); } return getImage(is); }
if (pressed) { g.setForeground(g.getColor(new RGB(deviceDisplay .getForegroundColor().getRed(), deviceDisplay .getForegroundColor().getGreen(), deviceDisplay .getForegroundColor().getBlue()))); } else { g.setBackground(g.getColor(new RGB(deviceDisplay .getBackgroundColor().getRed(), deviceDisplay .getBackgroundColor().getGreen(), deviceDisplay .getBackgroundColor().getBlue()))); .getBackgroundColor().getRed(), deviceDisplay .getBackgroundColor().getGreen(), deviceDisplay .getBackgroundColor().getBlue()))); } else { g.setForeground(g.getColor(new RGB(deviceDisplay .getForegroundColor().getRed(), deviceDisplay .getForegroundColor().getGreen(), deviceDisplay .getForegroundColor().getBlue())));
public Image createImage(byte[] imageData, int imageOffset, int imageLength) { ByteArrayInputStream is = new ByteArrayInputStream(imageData, imageOffset, imageLength); try { return getImage(is); } catch (IOException ex) { throw new IllegalArgumentException(ex.toString()); } }
private Image getImage(String str) throws IOException { // TODO not always true, there could be some loading images before // invoke startApp, right now getCurrentMIDlet returns prevoius MIDlet Object midlet = MIDletBridge.getCurrentMIDlet(); if (midlet == null) { midlet = getClass(); } InputStream is = midlet.getClass().getResourceAsStream(str); if (is == null) { throw new IOException(str + " could not be found."); } try { return getImage(is); } finally { IOUtils.closeQuietly(is); } }