public Dimension getPreferredSize() { Device device = DeviceFactory.getDevice(); if (device == null) { return new Dimension(0, 0); } return new Dimension(device.getDeviceDisplay().getFullWidth(), device.getDeviceDisplay().getFullHeight()); }
public void mouseMoved(MouseEvent e) { if (showMouseCoordinates) { StringBuffer buf = new StringBuffer(); Point p = deviceCoordinate(DeviceFactory.getDevice().getDeviceDisplay(), e.getPoint()); buf.append(p.x).append(",").append(p.y); Common.setStatusBar(buf.toString()); } }
public int filterRGB (int x, int y, int rgb) { int a = (rgb & 0xFF000000); int r = (rgb & 0x00FF0000) >>> 16; int g = (rgb & 0x0000FF00) >>> 8; int b = (rgb & 0x000000FF); int Y = (int)(Yr * r + Yg * g + Yb * b); if (Y > 127) { return a | ((J2SEDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getRGB(); } else { return a | ((J2SEDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getRGB(); } }
public Dimension getPreferredSize() { Device device = DeviceFactory.getDevice(); if (device == null) { return new Dimension(0, 0); } DeviceDisplayImpl deviceDisplay = (DeviceDisplayImpl) DeviceFactory.getDevice().getDeviceDisplay(); if (deviceDisplay.isResizable()) { return new Dimension(deviceDisplay.getFullWidth(), deviceDisplay.getFullHeight()); } else { javax.microedition.lcdui.Image img = device.getNormalImage(); return new Dimension(img.getWidth(), img.getHeight()); } }
protected void updateDevice() { devicePanel.init(); if (((DeviceDisplayImpl) DeviceFactory.getDevice().getDeviceDisplay()).isResizable()) { setResizable(true); resizeButton.setVisible(true); } else { setResizable(false); resizeButton.setVisible(false); } pack(); devicePanel.requestFocus(); }
int width = e.getX() - pressedPoint.x; int height = e.getY() - pressedPoint.y; Point p = deviceCoordinate(DeviceFactory.getDevice().getDeviceDisplay(), pressedPoint); buf.append(p.x).append(",").append(p.y).append(" ").append(width).append("x").append(height); Common.setStatusBar(buf.toString()); boolean fullScreenMode = device.getDeviceDisplay().isFullScreenMode(); if (device.hasPointerMotionEvents()) { if (!fullScreenMode) { Point p = deviceCoordinate(device.getDeviceDisplay(), e.getPoint()); inputMethod.pointerDragged(p.x, p.y);
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())); }
public J2SEDisplayGraphics(java.awt.Graphics2D a_g, MutableImage a_image) // Andres Navarro { this.g = a_g; this.image = a_image; this.clip = a_g.getClipBounds(); Device device = DeviceFactory.getDevice(); J2SEFontManager fontManager = (J2SEFontManager) device.getFontManager(); J2SEFont tmpFont = (J2SEFont) fontManager.getFont(currentFont); this.g.setFont(tmpFont.getFont()); if (fontManager.getAntialiasing()) { this.g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } else { this.g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); } J2SEDeviceDisplay display = (J2SEDeviceDisplay) device.getDeviceDisplay(); if (display.isColor()) { if (display.backgroundColor.getRed() != 255 || display.backgroundColor.getGreen() != 255 || display.backgroundColor.getBlue() != 255 || display.foregroundColor.getRed() != 0 || display.foregroundColor.getGreen() != 0 || display.foregroundColor.getBlue() != 0) { this.filter = new RGBImageFilter(); } } else { if (display.numColors() == 2) { this.filter = new BWImageFilter(); } else { this.filter = new GrayImageFilter(); } } }
public RGBImageFilter() { canFilterIndexColorModel = true; backgroundColor = ((J2SEDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor(); foregroundColor = ((J2SEDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor(); Rr = foregroundColor.getRed() - backgroundColor.getRed(); Rg = foregroundColor.getGreen() - backgroundColor.getGreen(); Rb = foregroundColor.getBlue() - backgroundColor.getBlue(); }
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(); }
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(); } } }
public GrayImageFilter (double Yr, double Yg, double Yb) { this.Yr = Yr; this.Yg = Yg; this.Yb = Yb; canFilterIndexColorModel = true; Color backgroundColor = ((J2SEDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor(); Color foregroundColor = ((J2SEDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor(); Rr = (backgroundColor.getRed() - foregroundColor.getRed()) / 256d; Rg = (backgroundColor.getGreen() - foregroundColor.getGreen()) / 256d; Rb = (backgroundColor.getBlue() - foregroundColor.getBlue()) / 256d; }
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; }
public int filterRGB (int x, int y, int rgb) { int a = (rgb & 0xFF000000); int r = (rgb & 0x00FF0000) >>> 16; int g = (rgb & 0x0000FF00) >>> 8; int b = (rgb & 0x000000FF); int Y = (int)(Yr * r + Yg * g + Yb * b) % 256; if (Y > 255) { Y = 255; } Color foregroundColor = ((J2SEDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor(); r = (int) (Rr * Y) + foregroundColor.getRed(); g = (int) (Rg * Y) + foregroundColor.getGreen(); b = (int) (Rb * Y) + foregroundColor.getBlue(); return a | (r << 16) | (g << 8) | b; }
public void repaintRequest(int x, int y, int width, int height) { MIDletAccess ma = MIDletBridge.getMIDletAccess(); if (ma == null) { return; } DisplayAccess da = ma.getDisplayAccess(); if (da == null) { return; } Displayable current = da.getCurrent(); if (current == null) { return; } Device device = DeviceFactory.getDevice(); if (device != null) { if (displayImage == null) { displayImage = new J2SEMutableImage( device.getDeviceDisplay().getFullWidth(), device.getDeviceDisplay().getFullHeight()); } Graphics gc = displayImage.getImage().getGraphics(); J2SEDeviceDisplay deviceDisplay = (J2SEDeviceDisplay) device.getDeviceDisplay(); if (!deviceDisplay.isFullScreenMode()) { deviceDisplay.paintControls(gc); } deviceDisplay.paintDisplayable(gc, x, y, width, height); fireDisplayRepaint(displayImage); } }
public void init() { dc.init(); remove(dc); Rectangle r = ((J2SEDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getDisplayRectangle(); add(dc, new XYConstraints(r.x, r.y, -1, -1)); revalidate(); }
device.getDeviceDisplay().getFullWidth(), device.getDeviceDisplay().getFullHeight()); SwtDeviceDisplay deviceDisplay = (SwtDeviceDisplay) device.getDeviceDisplay(); deviceDisplay.paintDisplayable(gc, x, y, width, height); if (!deviceDisplay.isFullScreenMode()) {
this.deviceEntry = entry; DeviceDisplayImpl deviceDisplay = (DeviceDisplayImpl) device.getDeviceDisplay(); if (deviceDisplay.isResizable()) { Rectangle size = Config.getDeviceEntryDisplaySize(entry);
DeviceDisplay deviceDisplay = DeviceFactory.getDevice().getDeviceDisplay(); DisplayAccess da = MIDletBridge.getMIDletAccess().getDisplayAccess(); if (da != null) {
public void actionPerformed(ActionEvent ev) { if (resizeDeviceDisplayDialog == null) { resizeDeviceDisplayDialog = new ResizeDeviceDisplayDialog(); } DeviceDisplayImpl deviceDisplay = (DeviceDisplayImpl) DeviceFactory.getDevice().getDeviceDisplay(); resizeDeviceDisplayDialog.setDeviceDisplaySize(deviceDisplay.getFullWidth(), deviceDisplay .getFullHeight()); if (SwingDialogWindow.show(Main.this, "Enter new size...", resizeDeviceDisplayDialog, true)) { deviceDisplay.setDisplayRectangle(new Rectangle(0, 0, resizeDeviceDisplayDialog .getDeviceDisplayWidth(), resizeDeviceDisplayDialog.getDeviceDisplayHeight())); ((SwingDisplayComponent) devicePanel.getDisplayComponent()).init(); MIDletAccess ma = MIDletBridge.getMIDletAccess(); if (ma == null) { return; } DisplayAccess da = ma.getDisplayAccess(); if (da != null) { da.sizeChanged(); deviceDisplay.repaint(0, 0, deviceDisplay.getFullWidth(), deviceDisplay.getFullHeight()); } pack(); } } });