Raster Methods

	    ////////////////////////// Methods //////////////////////////
	
	    /**
	     *  Returns the number of pixels in the Raster
	     */
	    public final int size( )
	    {
	        return pixel.length;
	    }
	
	    /**
	     *  Fills a Raster with a solid color
	     */
	    public final void fill(Color c)
	    {
	        int s = size();
	        int rgb = c.getRGB();
	        for (int i = 0; i < s; i++)
	            pixel[i] = rgb;
	    }
	
	    /**
	     *  Converts Rasters to Images
	     */
	    public final Image toImage(Component root)
	    {
	        return root.createImage(new MemoryImageSource(width, height, pixel, 0, width));
	    }
	
Lecture 2 Slide 22 6.837 Fall '98