public SwtDeviceComponent(Composite parent) { super(parent, SWT.NO_BACKGROUND); instance = this; mousePressed = false; dc = new SwtDisplayComponent(this); this.initialPressedSoftButton = null; addKeyListener(keyListener); addMouseListener(mouseListener); addMouseMoveListener(mouseMoveListener); addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { SwtDeviceComponent.this.paintControl(e); } }); }
public Image createSystemImage(URL url) throws IOException { return new SwtImmutableImage(SwtDeviceComponent.createImage(url.openStream())); }
public static Image createImage(int width, int height) { return new Image(instance.getDisplay(), width, height); }
public void paintControl(PaintEvent pe) Point size= getSize(); fBuffer= new Image(getDisplay(), size.x, size.y); org.microemu.device.impl.Shape shape = prevOverButton.getShape(); if (shape != null) { drawImageInShape( gc, ((SwtImmutableImage) device.getNormalImage()).getImage(), org.microemu.device.impl.Shape shape = overButton.getShape(); if (shape != null) { drawImageInShape( gc, ((SwtImmutableImage) device.getOverImage()).getImage(), org.microemu.device.impl.Shape shape = pressedButton.getShape(); if (shape != null) { drawImageInShape( gc, ((SwtImmutableImage) device.getPressedImage()).getImage(),
devicePanel = new SwtDeviceComponent(shell); devicePanel.setLayoutData(new GridData(GridData.FILL_BOTH));
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 DisplayComponent getDisplayComponent() { return devicePanel.getDisplayComponent(); }
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 static Image createImage(Image image) { return new Image(instance.getDisplay(), image, SWT.IMAGE_COPY); }
public SwtImmutableImage(SwtMutableImage image) { img = SwtDeviceComponent.createImage(image.getImage()); }
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 static Color getColor(RGB rgb) { Color result = (Color) colors.get(rgb); if (result == null) { CreateColorRunnable createColorRunnable = instance.new CreateColorRunnable(rgb); instance.getDisplay().syncExec(createColorRunnable); result = createColorRunnable.getColor(); colors.put(rgb, result); } return result; }
throw new IllegalArgumentException(); org.eclipse.swt.graphics.Image img = SwtDeviceComponent.createImage(width, height); ImageData imageData = img.getImageData(); return new SwtImmutableImage(SwtDeviceComponent.createImage(imageData));
public static Font getFont(String name, int size, int style, boolean antialiasing) { GetFontRunnable getFontRunnable = instance.new GetFontRunnable(name, size, style, antialiasing); instance.getDisplay().syncExec(getFontRunnable); return getFontRunnable.getFont(); }
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 static Image createImage(ImageData data) { CreateImageRunnable createImageRunnable = instance.new CreateImageRunnable(data); instance.getDisplay().syncExec(createImageRunnable); return createImageRunnable.getImage(); }
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 static FontMetrics getFontMetrics(Font font) { GetFontMetricsRunnable getFontMetricsRunnable = instance.new GetFontMetricsRunnable(font); instance.getDisplay().syncExec(getFontMetricsRunnable); return getFontMetricsRunnable.getFontMetrics(); }
public static int stringWidth(Font font, String str) { StringWidthRunnable stringWidthRunnable = instance.new StringWidthRunnable(font, str); instance.getDisplay().syncExec(stringWidthRunnable); return stringWidthRunnable.stringWidth(); }
public static Image createImage(InputStream is) { ImageData data = new ImageData(is); CreateImageRunnable createImageRunnable = instance.new CreateImageRunnable(data); instance.getDisplay().syncExec(createImageRunnable); return createImageRunnable.getImage(); }