Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.ImageData


    private void drawBottomLeft() {
        final Point size = getSize();
        int x = 0;
        if ((fFlags & ERROR) != 0) {
            final ImageData data = getImageData(ErlideImage.OVR_ERROR.getDescriptor());
            drawImage(data, x, size.y - data.height);
            x += data.width;
        }
        if ((fFlags & WARNING) != 0) {
            final ImageData data = getImageData(ErlideImage.OVR_WARNING.getDescriptor());
            drawImage(data, x, size.y - data.height);
            x += data.width;
        }

    }
View Full Code Here


     * @return the {@link Image} encoded by the specified input stream
     */
    protected static Image getImage(final InputStream stream) throws IOException {
        try {
            final Display display = Display.getCurrent();
            final ImageData data = new ImageData(stream);
            if (data.transparentPixel > 0) {
                return new Image(display, data, data.getTransparencyMask());
            }
            return new Image(display, data);
        } finally {
            stream.close();
        }
View Full Code Here

        } else if (myId.equals("toolbar.fit")) {
            imageCanvas.fitCanvas();
            return;
        } else if (myId.equals("toolbar.rotate")) {
            /* rotate image anti-clockwise */
            final ImageData src = imageCanvas.getImageData();
            if (src == null) {
                return;
            }
            final PaletteData srcPal = src.palette;
            PaletteData destPal;
            ImageData dest;
            /* construct a new ImageData */
            if (srcPal.isDirect) {
                destPal = new PaletteData(srcPal.redMask, srcPal.greenMask,
                        srcPal.blueMask);
            } else {
                destPal = new PaletteData(srcPal.getRGBs());
            }
            dest = new ImageData(src.height, src.width, src.depth, destPal);
            /* rotate by rearranging the pixels */
            for (int i = 0; i < src.width; i++) {
                for (int j = 0; j < src.height; j++) {
                    final int pixel = src.getPixel(i, j);
                    dest.setPixel(j, src.width - 1 - i, pixel);
                }
            }
            imageCanvas.setImageData(dest);
            return;
        } else if (myId.equals("toolbar.original")) {
View Full Code Here

        int yoffset = (height - size) / 2;

        RGB black = new RGB(0, 0, 0);
        PaletteData dataPalette = new PaletteData(new RGB[] { black, black,
                color });
        ImageData data = new ImageData(width, height, 4, dataPalette);
        data.transparentPixel = 0;

        int end = size - 1;
        for (int y = 0; y < size; y++) {
            for (int x = 0; x < size; x++) {
                if (x == 0 || y == 0 || x == end || y == end) {
          data.setPixel(x + xoffset, y + yoffset, 1);
        } else {
          data.setPixel(x + xoffset, y + yoffset, 2);
        }
            }
        }

        return data;
View Full Code Here

        // XXX: Workaround for 1FMQ0P3: SWT:ALL - TableItem.setImage doesn't work if using the identical image."
        if (image != null) {
      image.dispose();
    }

        ImageData id = createColorImage(colorLabel.getParent().getParent(), rgb);
        ImageData mask = id.getTransparencyMask();
        image = new Image(colorLabel.getDisplay(), id, mask);
        colorLabel.setImage(image);

        rgbLabel
                .setText("(" + rgb.red + "," + rgb.green + "," + rgb.blue + ")");//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
View Full Code Here

      }
      int length = overlays.length;
      int x = 0;
      for (int i = 0; i < 3; i++) {
        if ((i < length) && (overlays[i] != null)) {
          ImageData id = overlays[i].getImageData();
          drawImage(id, x, getSize().y - id.height);
          x += id.width;
        }
      }
    }
View Full Code Here

      }
      int length = overlays.length;
      int x = getSize().x;
      for (int i = 2; i >= 0; i--) {
        if ((i < length) && (overlays[i] != null)) {
          ImageData id = overlays[i].getImageData();
          x -= id.width;
          drawImage(id, x, getSize().y - id.height);
        }
      }
    }
View Full Code Here

    /**
     * @see CompositeImageDescriptor#drawCompositeImage(int, int)
     */
    protected void drawCompositeImage(int width, int height) {
      ImageData bg;
      if ((fBase == null) || ((bg = fBase.getImageData()) == null)) {
        bg = DEFAULT_IMAGE_DATA;
      }
      drawImage(bg, 0, 0);

View Full Code Here

      }
      int length = overlays.length;
      int x = 0;
      for (int i = 0; i < 3; i++) {
        if ((i < length) && (overlays[i] != null)) {
          ImageData id = overlays[i].getImageData();
          drawImage(id, x, 0);
          x += id.width;
        }
      }
    }
View Full Code Here

      }
      int length = overlays.length;
      int x = getSize().x;
      for (int i = 2; i >= 0; i--) {
        if ((i < length) && (overlays[i] != null)) {
          ImageData id = overlays[i].getImageData();
          x -= id.width;
          drawImage(id, x, 0);
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.ImageData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.