Package java.awt.image

Examples of java.awt.image.PixelGrabber


public class LMSFitnessFunction {
    private final int[] targetPixels;

    LMSFitnessFunction(BufferedImage target) {
        targetPixels = new int[target.getWidth() * target.getHeight()];
        PixelGrabber pg = new PixelGrabber(target, 0, 0, target.getWidth(),
                target.getHeight(), targetPixels, 0, target.getWidth());
        try {
            pg.grabPixels();
        } catch (InterruptedException ex) {
            Logger.getLogger(LMSFitnessFunction.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
View Full Code Here


    protected double evaluate(BufferedImage target) {
     
        BufferedImage generated = new BufferedImage(target.getWidth(), target.getHeight(),
                BufferedImage.TYPE_INT_ARGB);
        final int[] generatedPixels = new int[generated.getWidth() * generated.getHeight()];
        PixelGrabber pg = new PixelGrabber(generated, 0, 0, generated.getWidth(),
                generated.getHeight(), generatedPixels, 0, generated.getWidth());
        try {
            pg.grabPixels();
        } catch (InterruptedException ex) {
            Logger.getLogger(LMSFitnessFunction.class.getName()).log(Level.SEVERE, null, ex);
        }

        long sum = 0;
View Full Code Here

        int h = getIconHeight();
        int[] pixels = image != null ? new int[w * h] : null;

        if (image != null) {
            try {
                PixelGrabber pg = new PixelGrabber(image, 0, 0, w, h, pixels, 0, w);
                pg.grabPixels();
                if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
                    throw new IOException("failed to load image contents");
                }
            } catch (InterruptedException e) {
                throw new IOException("image load interrupted");
            }
View Full Code Here

                                    RasterAccessor.TAG_BYTE_UNCOPIED);
        }

        // Grab the entire image
        this.pixels = new int[width * height];
        PixelGrabber grabber = new PixelGrabber(image, 0, 0, width, height,
                                                pixels, 0, width);
        try {
            if (!grabber.grabPixels()) {
                if ((grabber.getStatus() & ImageObserver.ABORT) != 0) {
                    throw new RuntimeException(JaiI18N.getString("AWTImageOpImage2"));
    } else {
                    throw new RuntimeException(grabber.getStatus() + JaiI18N.getString("AWTImageOpImage3"));
                }
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
            throw new RuntimeException(JaiI18N.getString("AWTImageOpImage4"));
View Full Code Here

            splineBarImage.getGraphics().drawImage(imFullEqualizer, 0, 0, w, 1, 0, 294 + h + 1, 0 + w, 294 + h + 1 + 1, null);
            spline = new SplinePanel();
            spline.setBackgroundImage(splineImage);
            spline.setBarImage(splineBarImage);
            int[] pixels = new int[1 * h];
            PixelGrabber pg = new PixelGrabber(imFullEqualizer, 115, 294, 1, h, pixels, 0, 1);
            try
            {
                pg.grabPixels();
            }
            catch (InterruptedException e)
            {
                log.debug(e);
            }
View Full Code Here

                entie = (SpacePosition - reste);
                xPos = reste * fontW;
                yPos = ((entie / FontPerLine) * fontH) + ((entie / FontPerLine) * Yspacing);
            }
            /*-- We grab the letter in the font image and put it in a pixel array --*/
            pg = new PixelGrabber(theFonts, xPos, yPos, fontW, fontH, pixels, offsetT * fontW, theText.length() * fontW);
            try
            {
                pg.grabPixels();
            }
            catch (InterruptedException e)
View Full Code Here

    int width = im.getWidth(il);
    int height = im.getHeight(il);
    int[] pixels = new int[width*height]; // going to hold all
    // the image's pixels
   
    PixelGrabber grabber = new PixelGrabber(im.getSource(), 0, 0,
                                            width, height,
                                            pixels, 0, width);
    try // get the pixels
    {
      grabber.grabPixels();
    }
    catch (InterruptedException e)
    {
      throw new IllegalArgumentException("While grabbing pixels:");
    }
    if ((grabber.getStatus() & ImageObserver.ABORT) != 0)
    {
      throw new IllegalArgumentException("Error while fetching image."+
                                         " grabbed "+pixels.length+
                                         " pixel values of the "+width+
                                         " x "+height+" image.");
View Full Code Here

    }
    int width = image.getWidth(il);
    int height = image.getHeight(il);
    int[] pixels = new int[width*height]; // all the image's pixels

    PixelGrabber grabber = new PixelGrabber(image.getSource(), 0, 0,
                                            width, height,
                                            pixels, 0, width);
    try // get the pixels
    {
      grabber.grabPixels();
    }
    catch (InterruptedException e)
    {
      throw new InterruptedIOException("While grabbing pixels:");
    }
    if ((grabber.getStatus() & ImageObserver.ABORT) != 0)
    {
      throw new IllegalArgumentException("Error while fetching image."+
                                         " grabbed "+pixels.length+
                                         " pixel values of the "+width+
                                         " x "+height+" image.");
View Full Code Here

    int width = image.getWidth(loader);
    int height = image.getHeight(loader);
    int[] pixels = new int[width*height]; // all the image's pixels

    // Use a PixelGrabber to get the pixel values
    PixelGrabber grabber = new PixelGrabber(image.getSource(),
                                            0, 0,
                                            width, height,
                                            pixels,
                                            0, width);
    try
    {
      grabber.grabPixels();
    }
    catch (InterruptedException e)
    {
      throw new IllegalArgumentException("While grabbing pixels:");
    }

    if ((grabber.getStatus() & ImageObserver.ABORT) != 0)
    {
      throw new IllegalArgumentException("Error while fetching image."+
                                         " grabbed "+pixels.length+
                                         " pixel values of the "+width+
                                         " x "+height+" image.");
View Full Code Here

        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

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.