public void run() { SwtGraphics gc = new SwtGraphics(instance.getParent().getDisplay()); gc.setFont(font); stringWidth = gc.stringWidth(str); gc.dispose(); } }
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { g.drawArc(x, y, width, height, startAngle, arcAngle); }
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); }
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { Color tmp = g.getBackground(); g.setBackground(g.getForeground()); g.fillArc(x, y, width, height, startAngle, arcAngle); g.setBackground(tmp); }
public void fillRect(int x, int y, int width, int height) { Color tmp = g.getBackground(); g.setBackground(g.getForeground()); g.fillRectangle(x, y, width, height); g.setBackground(tmp); }
org.eclipse.swt.graphics.Rectangle clip = g.getClipping(); g.setClipping(paintable.x, paintable.y, paintable.width, paintable.height); if (type == TYPE_COMMAND) { int xoffset = 0; SwtDeviceDisplay deviceDisplay = (SwtDeviceDisplay) device.getDeviceDisplay(); 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()))); g.fillRectangle(paintable.x, paintable.y, paintable.width, paintable.height); synchronized (this) { SwtFontManager fontManager = (SwtFontManager) device.getFontManager(); SwtFont buttonFont = (SwtFont) fontManager.getFont(font); g.setFont(buttonFont.getFont()); - g.stringWidth(command.getLabel()); g.setBackground(g.getColor(new RGB(deviceDisplay
newy -= g.getFontMetrics().getAscent(); } else if ((anchor & javax.microedition.lcdui.Graphics.BOTTOM) != 0) { newy -= g.getFontMetrics().getHeight(); newx -= g.stringWidth(str) / 2; } else if ((anchor & javax.microedition.lcdui.Graphics.RIGHT) != 0) { newx -= g.stringWidth(str); boolean graphicsAntialiasing = g.getAntialias(); if (textAntialiasing != graphicsAntialiasing) { g.setAntialias(textAntialiasing); g.drawString(str, newx, newy, true); g.setAntialias(graphicsAntialiasing); g.drawLine(newx, newy + 1, newx + g.stringWidth(str), newy + 1);
public void run() { SwtGraphics gc = new SwtGraphics(instance.getParent().getDisplay()); gc.setAntialias(antialiasing); gc.setFont(new Font(instance.getParent().getDisplay(), name, size, style)); font = gc.getFont(); gc.dispose(); } }
g.setBackground(g.getColor(new RGB( backgroundColor.getRed(), backgroundColor.getGreen(), backgroundColor.getBlue()))); g.fillRectangle(0, 0, displayRectangle.width, displayPaintable.y); g.fillRectangle(0, displayPaintable.y, displayPaintable.x, displayPaintable.height); g.fillRectangle(displayPaintable.x + displayPaintable.width, displayPaintable.y, displayRectangle.width - displayPaintable.x - displayPaintable.width, displayPaintable.height); g.fillRectangle(0, displayPaintable.y + displayPaintable.height, displayRectangle.width, displayRectangle.height - displayPaintable.y - displayPaintable.height); g.setForeground(g.getColor(new RGB( foregroundColor.getRed(), foregroundColor.getGreen(), g.drawImage(((SwtImmutableImage) mode123Image.getImage()).getImage(), mode123Image.getRectangle().x, mode123Image.getRectangle().y); } else if (inputMode == InputMethod.INPUT_ABC_UPPER) { g.drawImage(((SwtImmutableImage) modeAbcUpperImage.getImage()).getImage(), modeAbcUpperImage.getRectangle().x, modeAbcUpperImage.getRectangle().y); } else if (inputMode == InputMethod.INPUT_ABC_LOWER) { g.drawImage(((SwtImmutableImage) modeAbcLowerImage.getImage()).getImage(), modeAbcLowerImage.getRectangle().x, modeAbcLowerImage.getRectangle().y);
public void run() { SwtGraphics gc = new SwtGraphics(instance.getParent().getDisplay()); gc.setFont(font); fontMetrics = gc.getFontMetrics(); gc.dispose(); } }
SwtGraphics gc = new SwtGraphics(new GC(fBuffer)); try { Device device = DeviceFactory.getDevice(); gc.drawImage(((SwtImmutableImage) device.getNormalImage()).getImage() , 0, 0); gc.translate(displayRectangle.x, displayRectangle.y); dc.paint(gc); gc.translate(-displayRectangle.x, -displayRectangle.y); rect = prevOverButton.getShape().getBounds(); if (rect != null) { gc.drawImage(((SwtImmutableImage) DeviceFactory.getDevice().getNormalImage()).getImage(), rect.x, rect.y, rect.width, rect.height, rect.x, rect.y, rect.width, rect.height); rect = overButton.getShape().getBounds(); if (rect != null) { gc.drawImage(((SwtImmutableImage) DeviceFactory.getDevice().getOverImage()).getImage(), rect.x, rect.y, rect.width, rect.height, rect.x, rect.y, rect.width, rect.height); rect = pressedButton.getShape().getBounds(); if (rect != null) { gc.drawImage(((SwtImmutableImage) DeviceFactory.getDevice().getPressedImage()).getImage(), rect.x, rect.y, rect.width, rect.height, rect.x, rect.y, rect.width, rect.height);
public SwtMutableImage(int width, int height) { this.img = SwtDeviceComponent.createImage(width, height); this.gc = new GC(this.img); SwtDisplayGraphics displayGraphics = new SwtDisplayGraphics(new SwtGraphics(gc), this); displayGraphics.setColor(0x00ffffff); displayGraphics.fillRect(0, 0, width, height); }
public void paint(SwtGraphics gc) { synchronized (this) { if (displayImage != null) { gc.drawImage(displayImage.img, 0, 0); } } }
public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3) { int[] points = new int[6]; points[0] = x1; points[1] = y1; points[2] = x2; points[3] = y2; points[4] = x3; points[5] = y3; g.fillPolygon(points); }
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { g.drawRoundRectangle(x, y, width, height, arcWidth, arcHeight); }
public void drawLine(int x1, int y1, int x2, int y2) { g.drawLine(x1, y1, x2, y2); }
public javax.microedition.lcdui.Graphics getGraphics() { SwtDisplayGraphics displayGraphics = new SwtDisplayGraphics(new SwtGraphics(gc), this); displayGraphics.setColor(0x00000000); displayGraphics.setClip(0, 0, getWidth(), getHeight()); displayGraphics.translate(-displayGraphics.getTranslateX(), -displayGraphics.getTranslateY()); return displayGraphics; }
public void drawImage(Image img, int x, int y, int anchor) { int newx = x; int newy = y; if (anchor == 0) { anchor = javax.microedition.lcdui.Graphics.TOP | javax.microedition.lcdui.Graphics.LEFT; } if ((anchor & javax.microedition.lcdui.Graphics.RIGHT) != 0) { newx -= img.getWidth(); } else if ((anchor & javax.microedition.lcdui.Graphics.HCENTER) != 0) { newx -= img.getWidth() / 2; } if ((anchor & javax.microedition.lcdui.Graphics.BOTTOM) != 0) { newy -= img.getHeight(); } else if ((anchor & javax.microedition.lcdui.Graphics.VCENTER) != 0) { newy -= img.getHeight() / 2; } if (img.isMutable()) { g.drawImage(((SwtMutableImage) img).getImage(), newx, newy); } else { g.drawImage(((SwtImmutableImage) img).getImage(), newx, newy); } }