org.jscience.media.pictures.filters
Class OpacityFilter

java.lang.Object
  extended by java.awt.image.ImageFilter
      extended by java.awt.image.RGBImageFilter
          extended by org.jscience.media.pictures.filters.OpacityFilter
All Implemented Interfaces:
java.awt.image.ImageConsumer, java.io.Serializable, java.lang.Cloneable

public class OpacityFilter
extends java.awt.image.RGBImageFilter
implements java.io.Serializable

Sets the opacity (alpha) of every pixel in an image to a constant value.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.image.RGBImageFilter
canFilterIndexColorModel, newmodel, origmodel
 
Fields inherited from class java.awt.image.ImageFilter
consumer
 
Fields inherited from interface java.awt.image.ImageConsumer
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT
 
Constructor Summary
OpacityFilter()
          Construct an OpacityFilter with 50% opacity.
OpacityFilter(int opacity)
          Construct an OpacityFilter with the given opacity (alpha).
 
Method Summary
 int filterRGB(int x, int y, int rgb)
          DOCUMENT ME!
 int getOpacity()
          Get the opacity setting.
 void setOpacity(int opacity)
          Set the opacity.
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class java.awt.image.RGBImageFilter
filterIndexColorModel, filterRGBPixels, setColorModel, setPixels, setPixels, substituteColorModel
 
Methods inherited from class java.awt.image.ImageFilter
clone, getFilterInstance, imageComplete, resendTopDownLeftRight, setDimensions, setHints, setProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpacityFilter

public OpacityFilter()
Construct an OpacityFilter with 50% opacity.


OpacityFilter

public OpacityFilter(int opacity)
Construct an OpacityFilter with the given opacity (alpha).

Parameters:
opacity - DOCUMENT ME!
Method Detail

setOpacity

public void setOpacity(int opacity)
Set the opacity.

Parameters:
opacity - the opacity (alpha) in the range 0..255

getOpacity

public int getOpacity()
Get the opacity setting.

Returns:
the opacity

filterRGB

public int filterRGB(int x,
                     int y,
                     int rgb)
DOCUMENT ME!

Specified by:
filterRGB in class java.awt.image.RGBImageFilter
Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
rgb - DOCUMENT ME!
Returns:
DOCUMENT ME!

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!