All Packages  Class Hierarchy  This Package  Previous  Next  Index


Class Acme.JPM.Filters.RGBBlockFilter

java.lang.Object
   |
   +----java.awt.image.ImageFilter
           |
           +----Acme.JPM.Filters.ImageFilterPlus
                   |
                   +----Acme.JPM.Filters.RGBBlockFilter

public abstract class RGBBlockFilter
extends ImageFilterPlus
More efficient RGB ImageFilter.

Similar in concept to java.awt.image.RGBImageFilter, but designed to run more efficiently when filtering large images.

As with RGBImageFilter, you only have to implement a single routine to use the filter. However, RGBImageFilter's routine filters a single pixel at a time. This means a lot of routine-calling overhead. RGBBlockFilter filters a block at a time.

Here's a sample RGBBlockFilter that makes an image translucent by setting all the alpha values to 0x80:

 class TranslucentFilter extends RGBBlockFilter
     {
     public int[] filterRGBBlock(
         int x, int y, int width, int height, int[][] rgbPixels )
         {
         for ( int row = 0; row < height; ++row )
             for ( int col = 0; col < width; ++col )
                 rgbPixels[row][col] =
                     ( rgbPixels[row][col] & 0x00ffffff ) | 0x80000000;
         return rgbPixels;
         }
     }
 

Fetch the software.
Fetch the entire Acme package.


Constructor Index

 o RGBBlockFilter(ImageProducer)

Method Index

 o filterRGBBlock(int, int, int, int, int[][])
This is the routine that subclasses must implement.
 o setColorModel(ColorModel)
 o setPixels(int, int, int, int, ColorModel, byte[], int, int)
Byte version of setPixels reformats the pixels to RGB and the array to 2 dimensions.
 o setPixels(int, int, int, int, ColorModel, int[], int, int)
Int version of setPixels reformats the array to 2 dimensions.

Constructors

 o RGBBlockFilter
 public RGBBlockFilter(ImageProducer producer)

Methods

 o filterRGBBlock
 public abstract int[][] filterRGBBlock(int x,
                                        int y,
                                        int width,
                                        int height,
                                        int rgbPixels[][])
This is the routine that subclasses must implement. It gets a block of the image as an int[height][width] in the default RGB color model. It should return a filtered array, same size and same model.

 o setColorModel
 public void setColorModel(ColorModel model)
Overrides:
setColorModel in class ImageFilter
 o setPixels
 public void setPixels(int x,
                       int y,
                       int width,
                       int height,
                       ColorModel model,
                       byte pixels[],
                       int offset,
                       int scansize)
Byte version of setPixels reformats the pixels to RGB and the array to 2 dimensions.

Overrides:
setPixels in class ImageFilter
 o setPixels
 public void setPixels(int x,
                       int y,
                       int width,
                       int height,
                       ColorModel model,
                       int pixels[],
                       int offset,
                       int scansize)
Int version of setPixels reformats the array to 2 dimensions.

Overrides:
setPixels in class ImageFilter

All Packages  Class Hierarchy  This Package  Previous  Next  Index

ACME Java  ACME Labs