Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.ImageData


    resources.put(chip.getImagePath(size), icon);
    return icon;
  }
 
  private static Image getImageFromCollection(Image collectionImg, Point collectionDimensions, Point imageLocation) {
    ImageData data = collectionImg.getImageData();
    int srcX = data.width / collectionDimensions.x * (imageLocation.x - 1);
    int srcY = data.height / collectionDimensions.y * (imageLocation.y - 1);
    int srcWidth = data.width / collectionDimensions.x;
    int srcHeight = data.height / collectionDimensions.y;
    Image img = new Image(Display.getDefault(), srcWidth, srcHeight);
View Full Code Here


        this.size = new Point(baseImage.getBounds().width, baseImage.getBounds().height);
    }

    protected void drawCompositeImage(int width, int height) {
        drawImage(baseImage.getImageData(), 0, 0);
        ImageData overlayData = overlayImage.getImageData();
        // Use the missing descriptor if it is not there.
        if (overlayData == null) {
            overlayData = ImageDescriptor.getMissingImageDescriptor().getImageData();
        }
        drawImage(overlayData, 0, size.y - overlayData.height);
View Full Code Here

        {
            if ( newImageRawData != null )
            {
                try
                {
                    ImageData imageData = new ImageData( new ByteArrayInputStream( newImageRawData ) );
                    if ( imageData.type != requiredImageType )
                    {
                        ImageLoader imageLoader = new ImageLoader();
                        imageLoader.data = new ImageData[]
                            { imageData };
View Full Code Here

            if ( currentImageRawData != null && currentImageRawData.length > 0 )
            {
                try
                {
                    ImageData imageData = new ImageData( new ByteArrayInputStream( currentImageRawData ) );
                    currentImage = new Image( getShell().getDisplay(), resizeImage( imageData ) );
                    currentImageLabel.setText( "" ); //$NON-NLS-1$
                    currentImageLabel.setImage( currentImage );
                    currentImageTypeText.setText( getImageType( imageData.type ) );
                    currentImageSizeText.setText( getSizeString( currentImageRawData.length ) );
View Full Code Here

        if ( newImageRawData != null && newImageRawData.length > 0 )
        {
            try
            {
                ImageData imageData = new ImageData( new ByteArrayInputStream( newImageRawData ) );
                newImage = new Image( getShell().getDisplay(), resizeImage( imageData ) );
                newImageLabel.setImage( newImage );
                newImageTypeText.setText( getImageType( imageData.type ) );
                if ( imageData.type != requiredImageType )
                {
View Full Code Here

        String text;
        try
        {
            ByteArrayInputStream bais = new ByteArrayInputStream( imageRawData );
            ImageData imageData = new ImageData( bais );
            String typePrefix = getImageType( imageData.type );
            if ( !"".equals( typePrefix ) ) //$NON-NLS-1$
                typePrefix += "-"; //$NON-NLS-1$

            text = NLS
View Full Code Here

      rgb = (RGB) element;
    }
    String rgb_id = "rgb" + rgb.hashCode();
    Image image = TypePlugin.getDefault().getImageRegistry().get(rgb_id);
    if (image == null) {
      ImageData id = createColorImage(rgb);
      image = ImageDescriptor.createFromImageData(id).createImage();
      TypePlugin.getDefault().getImageRegistry().put(rgb_id, image);
    }
    return image;
  }
View Full Code Here

    int xoffset = indent;
    int yoffset = (height - size) / 2;

    RGB black = new RGB(0, 0, 0);
    PaletteData dataPalette = new PaletteData(new RGB[] { black, BORDER_RGB, 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

                    .getActivitySupport().getImageDescriptor(category);
            if (descriptor != null) {
                try {
                    if (decorate) {
                        if (isLocked(category)) {
                            ImageData originalImageData = descriptor
                                    .getImageData();
                            OverlayIcon overlay = new OverlayIcon(
                                    descriptor, lockDescriptor, new Point(
                                            originalImageData.width,
                                            originalImageData.height));
View Full Code Here

      int transparencyDepth) {
    if (data == null)
      return null;
    if (transparencyDepth == 1)
      return data.getTransparencyMask();
    ImageData mask = null;
    if (data.maskData != null && data.depth == 32) {
      ImageData m = data.getTransparencyMask();
      mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE,
          data.width, new byte[data.width * data.height]);
      for (int y = 0; y < data.height; y++) {
        for (int x = 0; x < data.width; x++) {
          int alpha = data.getPixel(x, y) & 0xFF;
          if (alpha == 0) {
            if (m.getPixel(x, y) != 0)
              alpha = 255;
          }
          mask.setPixel(x, y, alpha);
        }
      }
    } else if (data.maskData != null || data.transparentPixel != -1) {
      ImageData m = data.getTransparencyMask();
      mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE,
          data.width, new byte[data.width * data.height]);
      for (int y = 0; y < mask.height; y++) {
        for (int x = 0; x < mask.width; x++) {
          mask.setPixel(x, y, m.getPixel(x, y) != 0 ? (byte) 255 : 0);
        }
      }
    } else if (data.alpha != -1) {
      mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE,
          data.width, new byte[data.width * data.height]);
      for (int i = 0; i < mask.data.length; i++) {
        mask.data[i] = (byte) data.alpha;
      }
    } else if (data.alphaData != null) {
      mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE,
          data.width, data.alphaData);
    } else {
      mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE,
          data.width, new byte[data.width * data.height]);
      for (int i = 0; i < mask.data.length; i++) {
        mask.data[i] = (byte) 255;
      }
    }
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.