Examples of PixelGrabber


Examples of com.jgraph.gaeawt.java.awt.image.PixelGrabber

    }

    if (get_fresh)
    {
      get_fresh = false;
      PixelGrabber pg = new PixelGrabber(image, 0, 0, width, height,
          source, 0, width);

      try
      {
        pg.grabPixels();
      }
      catch (InterruptedException e)
      {
        Log.log(e.toString());
      }
View Full Code Here

Examples of java.awt.image.PixelGrabber

         * Get the pixels from the BufferedImage. If anything goes
         * wrong, returns a int[0].
         */
        protected int[] getPixels(Image img, int x, int y, int w, int h) {
            int[] pixels = new int[w * h];
            PixelGrabber pg = new PixelGrabber(img, x, y, w, h, pixels, 0, w);
            try {
                pg.grabPixels();
            } catch (InterruptedException e) {
                Debug.error("ImageTranslator: interrupted waiting for pixels!");
                return new int[0];
            }

            if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
                System.err.println("ImageTranslator: image fetch aborted or errored");
                return new int[0];
            }

            return pixels;
View Full Code Here

Examples of java.awt.image.PixelGrabber

                             DataOutputStream dos) throws IOException,
            InterruptedException {

        int[] pixels = new int[image_width * image_height];

        PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, image_width, image_height, pixels, 0, image_width);
        pixelgrabber.grabPixels();

        LinkRaster.write(lt,
                ln,
                image_width,
                image_height,
View Full Code Here

Examples of java.awt.image.PixelGrabber

                             int image_height, LinkProperties properties,
                             DataOutputStream dos) throws IOException,
            InterruptedException {
        int[] pixels = new int[image_width * image_height];

        PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, image_width, image_height, pixels, 0, image_width);
        pixelgrabber.grabPixels();

        LinkRaster.write(x1,
                y1,
                image_width,
                image_height,
View Full Code Here

Examples of java.awt.image.PixelGrabber

                             Image image, int image_width, int image_height,
                             LinkProperties properties, DataOutputStream dos)
            throws IOException, InterruptedException {
        int[] pixels = new int[image_width * image_height];

        PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, image_width, image_height, pixels, 0, image_width);
        pixelgrabber.grabPixels();

        LinkRaster.write(lt,
                ln,
                offset_x1,
                offset_y1,
View Full Code Here

Examples of java.awt.image.PixelGrabber

    public static BufferedImage getBufferedImageFromPixelGrabber(Image image,
                                                                 int x, int y,
                                                                 int w, int h,
                                                                 int imageType) {

        PixelGrabber pg = new PixelGrabber(image, x, y, w, h, true);
        int[] pixels = ImageHelper.grabPixels(pg);

        if (pixels == null) {
            return null;
        }

        w = pg.getWidth();
        h = pg.getHeight();
        pg = null;

        BufferedImage bi = new BufferedImage(w, h, imageType);
        if (Debug.debugging("imagehelper")) {
            Debug.output("BufferedImageHelper.getBufferedImage(): Got buffered image...");
View Full Code Here

Examples of java.awt.image.PixelGrabber

     */
    public static int[][] getPixels(Image image) throws IOException {
        int w = image.getWidth(null);
        int h = image.getHeight(null);       
        int pix[] = new int[w * h];
        PixelGrabber grabber = new PixelGrabber(image, 0, 0, w, h, pix, 0, w);
       
        try {
            if (grabber.grabPixels() != true) {
                throw new IOException("Grabber returned false: " +
                                      grabber.status());
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

View Full Code Here

Examples of java.awt.image.PixelGrabber

  */
  public static int[][] getPixels(Image image) throws IOException {
    int w = image.getWidth(null);
    int h = image.getHeight(null);       
    int pix[] = new int[w * h];
    PixelGrabber grabber = new PixelGrabber(image, 0, 0, w, h, pix, 0, w);
   
    try {
      if (grabber.grabPixels() != true) {
        throw new IOException("Grabber returned false: " +
        grabber.status());
      }
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
   
View Full Code Here

Examples of java.awt.image.PixelGrabber

    }

    protected void setPreferredBackground() {
        int[] pixels = new int[1];

        PixelGrabber pg = null;

        switch (imageAlign) {
            case (SwingConstants.TOP):
                pg = new PixelGrabber(image, 0, image.getHeight(null) - 1, 1, 1, pixels, 0, 1);

                break;
            case (SwingConstants.BOTTOM):
                pg = new PixelGrabber(image, 0, 0, 1, 1, pixels, 0, 1);

                break;
            default:
                pg = new PixelGrabber(image, 0, image.getHeight(null) - 1, 1, 1, pixels, 0, 1);
        }

        try {
            if ((pg != null) && pg.grabPixels()) {
                setBackground(new Color(pixels[0]));
            }
        } catch (InterruptedException e) {
        }
    }
View Full Code Here

Examples of java.awt.image.PixelGrabber

        byte[] compressedLines; // the resultant compressed lines
        int nCompressed;        // how big is the compressed area?

        //int depth;              // color depth ( handle only 8 or 32 )

        PixelGrabber pg;

        bytesPerPixel = (encodeAlpha) ? 4 : 3;

        Deflater scrunch = new Deflater(compressionLevel);
        ByteArrayOutputStream outBytes = new ByteArrayOutputStream(1024);

        DeflaterOutputStream compBytes = new DeflaterOutputStream(outBytes, scrunch);
        try {
            while (rowsLeft > 0) {
                nRows = Math.min(32767 / (width * (bytesPerPixel + 1)), rowsLeft);
                nRows = Math.max( nRows, 1 );

                int[] pixels = new int[width * nRows];

                pg = new PixelGrabber(image, 0, startRow,
                    width, nRows, pixels, 0, width);
                try {
                    pg.grabPixels();
                }
                catch (Exception e) {
                    System.err.println("interrupted waiting for pixels!");
                    return false;
                }
                if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
                    System.err.println("image fetch aborted or errored");
                    return false;
                }

                /*
 
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.