Package java.awt.image

Examples of java.awt.image.PixelGrabber


        String path = "gnu/testlet/javax/imageio/ImageIO/outputBitmap.bmp";

        ImageIO.write(image, "bmp", new File(path));

        BufferedImage outImage = ImageIO.read(new File(path));
        PixelGrabber pg1 = new PixelGrabber(outImage,
                                            0, 0, width, height, outPixels, 0,
                                            width);
        PixelGrabber pg2 = new PixelGrabber(image, 0, 0, width, height, pixels,
                                            0, width);
        pg1.grabPixels();
        pg2.grabPixels();

        h.check(comparePixels(pixels, outPixels, size));
      }
    catch (Exception e)
      {
View Full Code Here


  {
    boolean exCaught = false;
   
    try
    {
      new PixelGrabber((ImageProducer) null, 0, 0, 0, 0, new int[5], 0, 0);
    }
    catch (NullPointerException npe)
    {
      exCaught = true;
    }
View Full Code Here

      {
        final int nRows = Math.max(Math.min(32767 / (this.width * (this.bytesPerPixel + 1)), rowsLeft), 1);

        final int[] pixels = new int[this.width * nRows];

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

View Full Code Here

class DirectGif89Frame extends Gif89Frame {
  private int[] argbPixels;

  DirectGif89Frame(Image img) throws IOException {
    PixelGrabber pg = new PixelGrabber(img, 0, 0, -1, -1, true);
    String errmsg = null;
    try {
      if (!pg.grabPixels()) {
        errmsg = "can't grab pixels from image";
      }
    }
    catch (InterruptedException e) {
      errmsg = "interrupted grabbing pixels from image";
    }
    if (errmsg != null) {
      throw new IOException(errmsg + " (" + getClass().getName() + ")");
    }
    theWidth = pg.getWidth();
    theHeight = pg.getHeight();
    argbPixels = (int[]) pg.getPixels();
    ciPixels = new byte[argbPixels.length];
  }
View Full Code Here

            iMech = image;

            int[] pMech = new int[IMG_SIZE];
            int[] pCamo = new int[IMG_SIZE];
            PixelGrabber pgMech = new PixelGrabber(iMech, 0, 0, IMG_WIDTH,
                    IMG_HEIGHT, pMech, 0, IMG_WIDTH);

            try {
                pgMech.grabPixels();
            } catch (Exception e) {
                System.err
                        .println("EntityImage.applyColor(): Failed to grab pixels for mech image." + e.getMessage()); //$NON-NLS-1$
                return image;
            }
            if ((pgMech.getStatus() & ImageObserver.ABORT) != 0) {
                System.err
                        .println("EntityImage.applyColor(): Failed to grab pixels for mech image. ImageObserver aborted."); //$NON-NLS-1$
                return image;
            }

            if (useCamo) {
                PixelGrabber pgCamo = new PixelGrabber(camo, 0, 0, IMG_WIDTH,
                        IMG_HEIGHT, pCamo, 0, IMG_WIDTH);
                try {
                    pgCamo.grabPixels();
                } catch (InterruptedException e) {
                    System.err
                            .println("EntityImage.applyColor(): Failed to grab pixels for camo image." + e.getMessage()); //$NON-NLS-1$
                    return image;
                }
                if ((pgCamo.getStatus() & ImageObserver.ABORT) != 0) {
                    System.err
                            .println("EntityImage.applyColor(): Failed to grab pixels for mech image. ImageObserver aborted."); //$NON-NLS-1$
                    return image;
                }
            }
View Full Code Here

            iMech = image;

            int[] pMech = new int[IMG_SIZE];
            int[] pCamo = new int[IMG_SIZE];
            PixelGrabber pgMech = new PixelGrabber(iMech, 0, 0, IMG_WIDTH,
                    IMG_HEIGHT, pMech, 0, IMG_WIDTH);

            try {
                pgMech.grabPixels();
            } catch (InterruptedException e) {
                System.err
                        .println("EntityImage.applyColor(): Failed to grab pixels for mech image." + e.getMessage()); //$NON-NLS-1$
                return image;
            }
            if ((pgMech.getStatus() & ImageObserver.ABORT) != 0) {
                System.err
                        .println("EntityImage.applyColor(): Failed to grab pixels for mech image. ImageObserver aborted."); //$NON-NLS-1$
                return image;
            }

            if (useCamo) {
                PixelGrabber pgCamo = new PixelGrabber(camo, 0, 0, IMG_WIDTH,
                        IMG_HEIGHT, pCamo, 0, IMG_WIDTH);
                try {
                    pgCamo.grabPixels();
                } catch (InterruptedException e) {
                    System.err
                            .println("EntityImage.applyColor(): Failed to grab pixels for camo image." + e.getMessage()); //$NON-NLS-1$
                    return image;
                }
                if ((pgCamo.getStatus() & ImageObserver.ABORT) != 0) {
                    System.err
                            .println("EntityImage.applyColor(): Failed to grab pixels for mech image. ImageObserver aborted."); //$NON-NLS-1$
                    return image;
                }
            }
View Full Code Here

            Image iMech;

            iMech = nightFog;

            int[] pMech = new int[EntityImage.IMG_SIZE];
            PixelGrabber pgMech = new PixelGrabber(iMech, 0, 0,
                    EntityImage.IMG_WIDTH, EntityImage.IMG_HEIGHT, pMech, 0,
                    EntityImage.IMG_WIDTH);

            try {
                pgMech.grabPixels();
            } catch (InterruptedException e) {
                System.err
                        .println("EntityImage.applyColor(): Failed to grab pixels for mech image." + e.getMessage()); //$NON-NLS-1$
                return image;
            }
            if ((pgMech.getStatus() & ImageObserver.ABORT) != 0) {
                System.err
                        .println("EntityImage.applyColor(): Failed to grab pixels for mech image. ImageObserver aborted."); //$NON-NLS-1$
                return image;
            }
View Full Code Here

            Image iMech;

            iMech = nightFog;

            int[] pMech = new int[EntityImage.IMG_SIZE];
            PixelGrabber pgMech = new PixelGrabber(iMech, 0, 0,
                    EntityImage.IMG_WIDTH, EntityImage.IMG_HEIGHT, pMech, 0,
                    EntityImage.IMG_WIDTH);

            try {
                pgMech.grabPixels();
            } catch (InterruptedException e) {
                System.err
                        .println("EntityImage.applyColor(): Failed to grab pixels for mech image." + e.getMessage()); //$NON-NLS-1$
                return image;
            }
            if ((pgMech.getStatus() & ImageObserver.ABORT) != 0) {
                System.err
                        .println("EntityImage.applyColor(): Failed to grab pixels for mech image. ImageObserver aborted."); //$NON-NLS-1$
                return image;
            }
View Full Code Here

      g.drawImage(image, 0, 0, width, height, 0, 0, width0, height0, null);
    } else {
      g.clearRect(0, 0, width, height);
      g.drawImage(image, 0, 0, width, height, 0, 0, width0, height0, null);
    }
    PixelGrabber pixelGrabber = new PixelGrabber(g3d.platform.imageOffscreen,
        0, 0, width, height, true);
    try {
      pixelGrabber.grabPixels();
    } catch (InterruptedException e) {
      // impossible?
      return;
    }
    int[] buffer = (int[]) pixelGrabber.getPixels();
/*   
    int n = 0;
    for (int i = 0; i < buffer.length; i++) {
      if ((buffer[i] & 0xFF000000) != 0xFF000000) {
        // System.out.println("testing " + i + " " + buffer[i]);
View Full Code Here

    g.drawString(text, 0, ascent);
  }

  private void rasterize(Platform3D platform, boolean antialias) {
   
    PixelGrabber pixelGrabber = new PixelGrabber(platform.imageOffscreen, 0, 0,
                                                 mapWidth, height, true);
    try {
      pixelGrabber.grabPixels();
    } catch (InterruptedException e) {
      // impossible?
      return;
    }
    int pixels[] = (int[])pixelGrabber.getPixels();

    int bitmapSize = (size + 31) >> 5;
    bitmap = new int[bitmapSize];

    int offset, shifter;
View Full Code Here

TOP

Related Classes of java.awt.image.PixelGrabber

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.