Examples of PixelGrabber


Examples of java.awt.image.PixelGrabber

    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

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 = rowsLeft;

        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

Examples of java.awt.image.PixelGrabber

        // Print the textarea to an image
        Image image = new BufferedImage(textArea.getSize().width, textArea.getSize().height, BufferedImage.TYPE_INT_RGB);
        textArea.printAll(image.getGraphics());

        // Grab appropriate pixels to get the color
        PixelGrabber pixelGrabber = new PixelGrabber(image, 5, 5, 1, 1, pixels, 0, 1);
        try {
            pixelGrabber.grabPixels();
            if (pixels[0] == -1) {
                return Color.WHITE; // System background not customized
            }
        } catch (InterruptedException e) {
            return getNonGTKProfilerResultsBackground();
View Full Code Here

Examples of java.awt.image.PixelGrabber

     * @exception IOException
     *                If the image is unencodable due to failure of
     *                pixel-grabbing.
     */
    public DirectGif89Frame(final 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

Examples of java.awt.image.PixelGrabber

     * @exception IOException
     *                If the image is unencodable due to failure of
     *                pixel-grabbing.
     */
    public DirectGif89Frame(final 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

Examples of java.awt.image.PixelGrabber

        private int h, w, pixels[];
        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();
        }
View Full Code Here

Examples of java.awt.image.PixelGrabber

        private int h, w, pixels[];
        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();
        }
View Full Code Here

Examples of java.awt.image.PixelGrabber

  public boolean []downSample(int targetWidth,int targetHeight) {   
    final int w = this.entryImage.getWidth(this);
    final int h = this.entryImage.getHeight(this);
    boolean[] result = new boolean[targetWidth*targetHeight];

    final PixelGrabber grabber = new PixelGrabber(this.entryImage, 0, 0, w,
        h, true);
    try {

      grabber.grabPixels();
      this.pixelMap = (int[]) grabber.getPixels();
      findBounds(w, h);

      // now downsample

      this.ratioX = (double) (this.downSampleRight - this.downSampleLeft)
View Full Code Here

Examples of java.awt.image.PixelGrabber

    processImage(image);

    final double[] result = new double[height * width * 3];

    final PixelGrabber grabber = new PixelGrabber(image, 0, 0,
        getImageWidth(), getImageHeight(), true);

    try {
      grabber.grabPixels();
    } catch (final InterruptedException e) {
      throw new EncogError(e);
    }

    setPixelMap((int[]) grabber.getPixels());

    // now downsample

    int index = 0;
    for (int y = 0; y < height; y++) {
View Full Code Here

Examples of java.awt.image.PixelGrabber

    processImage(image);

    final double[] result = new double[height * width * 3];

    final PixelGrabber grabber = new PixelGrabber(image, 0, 0,
        this.imageWidth, this.imageWidth, true);

    try {
      grabber.grabPixels();
    } catch (final InterruptedException e) {
      throw new EncogError(e);
    }

    this.pixelMap = (int[]) grabber.getPixels();

    // now downsample

    this.ratioX = (double) (this.downSampleRight - this.downSampleLeft)
        / (double) width;
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.