Package java.awt.image

Examples of java.awt.image.PixelGrabber.grabPixels()


   * @return <code>true</code> of <code>false</code>, according to the result
   */
  public static boolean hasAlpha(Image image) {
    try {
      PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false);
      pg.grabPixels();
      return pg.getColorModel().hasAlpha();
    } catch (InterruptedException e) {
      return false;
    }
  }
View Full Code Here


        public ImageInfo(Image img) throws InterruptedException {
            w = img.getWidth(null);
            h = img.getHeight(null);
            pixels = new int[w*h];
            PixelGrabber pg = new PixelGrabber(img, 0, 0, w, h, pixels, 0, w);
            pg.grabPixels();
        }
       
        public boolean equals(Object that) {
            if(that == null) {
                return false;
View Full Code Here

    }

    public static ColorModel getColorModel(Image image) {
      try {
        PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false);
        pg.grabPixels();
        return pg.getColorModel();
      } catch (InterruptedException e) {
        throw new RuntimeException("Unexpected interruption", e);
      }
    }
View Full Code Here

    int[] data = new int[1];

    PixelGrabber pGrab = new PixelGrabber(image, x, y, x + 1, y + 1, data,
        0, scan);
    try {
      pGrab.grabPixels();
    } catch (Exception e) {
    }

    return new Color(data[0]);
  }
View Full Code Here

        int[] pixels = new int[1];
        PixelGrabber pg =
          new PixelGrabber(png, x, y, 1, 1, pixels, 0, w);
        try {
            pg.grabPixels();
        } catch (InterruptedException e) { }

        int a = 0xff & (pixels[0] >> 24);
        int r = 0xff & (pixels[0] >> 16);
        int g = 0xff & (pixels[0] >> 8);
View Full Code Here

        // use a pixel grabber to retrieve the image's color model;
        // grabbing a single pixel is usually sufficient
        PixelGrabber pg = new PixelGrabber(img, 0, 0, 1, 1, false);
        try {
            pg.grabPixels();
        } catch (InterruptedException e) {
            // ignore
        }

        // recast the AWT image into a BufferedImage (using alpha RGB)
View Full Code Here

        // use a pixel grabber to retrieve the image's color model;
        // grabbing a single pixel is usually sufficient
        PixelGrabber pg = new PixelGrabber(img, 0, 0, 1, 1, false);
        try {
            pg.grabPixels();
        } catch (InterruptedException e) {
            // ignore
        }

        // recast the AWT image into a BufferedImage (using alpha RGB)
View Full Code Here

        pg.setDimensions(this.width, this.height);
        pg.setColorModel(this.cm);
        pg.setHints(this.hints);
        pg.setProperties(this.properties);
        try {
            pg.grabPixels();
        } catch (InterruptedException intex) {
            throw new Exception("Image grabbing interrupted : "
                                + intex.getMessage());
        }
        return tmpMap;
View Full Code Here

        // Need to remove this and come up with a way to get the dimensions
        // without reading the whole file/using AWT.
        // http://bugs.adobe.com/jira/browse/CMP-542
        Image image = Toolkit.getDefaultToolkit().createImage(bytes);
        PixelGrabber pixelGrabber = new PixelGrabber(image, 0, 0, -1, -1, true);
        pixelGrabber.grabPixels();

        ImageInfo imageInfo = new ImageInfo(pixelGrabber);
        return imageInfo;
    }
View Full Code Here

    {
        PixelGrabber pixelGrabber = new PixelGrabber(image, 0, 0, -1, -1, true);
   
        try
        {
            pixelGrabber.grabPixels();
        }
        catch (InterruptedException interruptedException)
        {
            if (Trace.error)
            {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.