Lets talk about Pixels


    • Pixels stored as ints in the array called pixel[]
    • Java's standard model of a pixel

    
        /**
         *  This constructor creates an Raster initialized
         *  with the contents of an image.
         */
        public Raster(Image img)
        {
            try {
                PixelGrabber grabber = new PixelGrabber(img, 0, 0, -1, -1, true);
                if (grabber.grabPixels()) {
                    width = grabber.getWidth();
                    height = grabber.getHeight();
                    pixel = (int []) grabber.getPixels();
                }
            } catch (InterruptedException e) {
            }
        }
    	
Lecture 2 Slide 21 6.837 Fall '98