Package java.awt.image |
![]() Previous |
![]() Java API |
![]() Index |
![]() Next |
public class java.awt.image.CropImageFilter extends java.awt.image.ImageFilter { // Constructors public CropImageFilter(int x, int y, int w, int h); // Methods public void setDimensions(int w, int h); public void setPixels(int x, int y, int w, int h, ColorModel model, byte pixels[], int off, int scansize); public void setPixels(int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scansize); public void setProperties(Hashtable props); }
The cropped image filter is an image filter for cropping images. This class extends the basic ImageFilter class to extract a given rectangular region of an existing image and provides a source for new image containing only the extracted region.
This class is meant to be used in conjunction with a FilteredImageSource to produce cropped versions of existing images.
public CropImageFilter(int x, int y, int w, int h)Constructs a cropped image filter that extracts the absolute rectangular region of pixels from its source Image as specified by the x, y, w, and h parameters.
Parameter Description x the x location of the top of the rectangle to be extracted y the y location of the top of the rectangle to be extracted w the width of the rectangle to be extracted h the height of the rectangle to be extracted
public void setDimensions(int w, int h)The image producer calls the setDimensions of the image consumer to tell it the width and height of the image.
The setDimensions method of CroppedImageFilter ignores its arguments. It calls the setDimensions method of its image consumer with the width and height arguments of the constructor .
Parameter Description width the width of the image height the height of the image Overrides:
setDimensions in class ImageFilter .
public void setPixels(int x, int y, int w, int h, ColorModel model, byte pixels[], int off, int scansize)The image producer calls the setPixels method of the image consumer one or more times to deliver the pixels of the image. For more information on this method and its arguments, see setPixels.
The setPixels method of CroppedImageFilter determines if the specified rectangle intersects its cropping region. If so, it calls the setPixels method after modifying the x, y, w, h, and offset arguments to reflect only the intersecting region.
Parameter Description x left coordinate of rectangle y top coordinate of rectangle w width of rectangle h height of rectangle model color model for bits pixels array of bits off offset for first element scansize number of elements per row. Overrides:
setPixels in class ImageFilter .
public void setPixels(int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scansize)The image producer calls the setPixels method of the image consumer one or more times to deliver the pixels of the image. For more information on this method and its arguments, see setPixels.
The setPixels method of CroppedImageFilter determines if the specified rectangle intersects its cropping region. If so, it calls the setPixels method after modifying the x, y, w, h, and offset arguments to reflect only the intersecting region.
Parameter Description x left coordinate of rectangle y top coordinte of rectangle w width of rectangle h height of rectangle model color model for bits pixels array of bits off offset for first element scansize number of elements per row. Overrides:
setPixels in class ImageFilter .
public void setProperties(Hashtable props)The image producer calls the setProperties method of the image consumer to let it know of additional properties of the image. For more information on this method and its arguments, see setProperties.
The setProperties method of CroppedImageFilter adds the property "croprect" with the value new Rectangle(x, y, width, height) to the table of properties, and then calls the setProperties method of its image consumer with the modified properties table.
Parameter Description props a hashtable that maps image properties to their value Overrides:
setProperties in class ImageFilter .