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(((J2SEMutableImage) img).getImage(), newx, newy, null); } else { g.drawImage(((J2SEImmutableImage) img).getImage(), newx, newy, null); } }
/** * Creates a new InitialScreenCanvas object. */ public InitialScreenCanvas() { try { this.barbecueImage = Image.createImage("/barbecue.png"); } catch (IOException e) { } }
if (x_src + width > src.getWidth() || y_src + height > src.getHeight() || width < 0 || height < 0 || x_src < 0 || y_src < 0) { throw new IllegalArgumentException("Area out of Image"); if (src.isMutable() && src.getGraphics() == this) throw new IllegalArgumentException("Image is source and target"); if (src.isMutable()) { img = ((J2SEMutableImage) src).getImage(); } else {
public Image createImage(javax.microedition.lcdui.Image source) { if (source.isMutable()) { return new J2SEImmutableImage((J2SEMutableImage) source); } else { return source; } }
public Image createImage(javax.microedition.lcdui.Image source) { if (source.isMutable()) { return new SwtImmutableImage((SwtMutableImage) source); } else { return source; } }
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()); } }
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); } }
public Image createImage(Image image, int x, int y, int width, int height, int transform) { if (image == null) throw new NullPointerException(); if (x + width > image.getWidth() || y + height > image.getHeight() || width <= 0 || height <= 0 || x < 0 || y < 0) throw new IllegalArgumentException("Area out of Image");