private void drawImageInShape(Graphics g, Image image, org.microemu.device.impl.Shape shape) { Shape clipSave = g.getClip(); if (shape instanceof org.microemu.device.impl.Polygon) { Polygon poly = new Polygon(((org.microemu.device.impl.Polygon) shape).xpoints, ((org.microemu.device.impl.Polygon) shape).ypoints, ((org.microemu.device.impl.Polygon) shape).npoints); g.setClip(poly); } org.microemu.device.impl.Rectangle r = shape.getBounds(); g.drawImage(image, r.x, r.y, r.x + r.width, r.y + r.height, r.x, r.y, r.x + r.width, r.y + r.height, null); g.setClip(clipSave); }
private void drawImageInShape(SwtGraphics g, Image image, org.microemu.device.impl.Shape shape) { org.eclipse.swt.graphics.Rectangle clipSave = g.getClipping(); if (shape instanceof org.microemu.device.impl.Polygon) { // TODO not implemented yet // g.setCliping(region); } org.microemu.device.impl.Rectangle r = shape.getBounds(); g.drawImage(image, r.x, r.y, r.width, r.height, r.x, r.y, r.width, r.height); g.setClipping(clipSave); }
org.microemu.device.impl.Shape shape = prevOverButton.getShape(); if (shape != null) { repaint(shape.getBounds());
repaint(shape.getBounds());
public void keyReleased(KeyEvent ev) { if (MIDletBridge.getCurrentMIDlet() == null) { return; } Device device = DeviceFactory.getDevice(); for (Iterator it = device.getButtons().iterator(); it.hasNext(); ) { SwtButton button = (SwtButton) it.next(); if (ev.keyCode == button.getKeyboardKey()) { ev.keyCode = button.getKeyCode(); break; } } ((SwtInputMethod) device.getInputMethod()).keyReleased(ev); prevOverButton = pressedButton; pressedButton = null; if (prevOverButton != null) { org.microemu.device.impl.Shape shape = prevOverButton.getShape(); if (shape != null) { Rectangle r = shape.getBounds(); redraw(r.x, r.y, r.width, r.height, true); } } else { redraw(); } } };
public void keyPressed(KeyEvent ev) { if (MIDletBridge.getCurrentMIDlet() == null) { return; } Device device = DeviceFactory.getDevice(); for (Iterator it = device.getButtons().iterator(); it.hasNext(); ) { SwtButton button = (SwtButton) it.next(); if (ev.keyCode == button.getKeyboardKey()) { ev.keyCode = button.getKeyCode(); break; } } ((SwtInputMethod) device.getInputMethod()).keyPressed(ev); pressedButton = ((SwtInputMethod) device.getInputMethod()).getButton(ev); if (pressedButton != null) { org.microemu.device.impl.Shape shape = pressedButton.getShape(); if (shape != null) { Rectangle r = shape.getBounds(); redraw(r.x, r.y, r.width, r.height, true); } } else { redraw(); } }
public void mouseReleased(MouseEvent e) { mouseButtonDown = false; MouseRepeatedTimerTask.stop(); if (pressedButton == null) { return; } if (MIDletBridge.getCurrentMIDlet() == null) { return; } Device device = DeviceFactory.getDevice(); J2SEInputMethod inputMethod = (J2SEInputMethod) device.getInputMethod(); J2SEButton prevOverButton = J2SEDeviceButtonsHelper.getSkinButton(e); if (prevOverButton != null) { inputMethod.buttonReleased(prevOverButton, '\0'); } pressedButton = null; // optimize for some video cards. if (prevOverButton != null) { repaint(prevOverButton.getShape().getBounds()); } else { repaint(); } }
repaint(pressedButton.getShape().getBounds());
Rectangle r = pressedButton.getShape().getBounds(); redraw(r.x, r.y, r.width, r.height, true);
rect = prevOverButton.getShape().getBounds(); if (rect != null) { gc.drawImage(((SwtImmutableImage) DeviceFactory.getDevice().getNormalImage()).getImage(), rect = overButton.getShape().getBounds(); if (rect != null) { gc.drawImage(((SwtImmutableImage) DeviceFactory.getDevice().getOverImage()).getImage(), rect = pressedButton.getShape().getBounds(); if (rect != null) { gc.drawImage(((SwtImmutableImage) DeviceFactory.getDevice().getPressedImage()).getImage(),
Rectangle r = prevOverButton.getShape().getBounds(); redraw(r.x, r.y, r.width, r.height, true); } else {