com.jhlabs.image

Class OpacityFilter

Implemented Interfaces:
BufferedImageOp, Cloneable

public class OpacityFilter
extends PointFilter

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

Field Summary

Fields inherited from class com.jhlabs.image.PointFilter

canFilterIndexColorModel

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)
int
getOpacity()
Get the opacity setting.
void
setOpacity(int opacity)
Set the opacity.
String
toString()

Methods inherited from class com.jhlabs.image.PointFilter

filter, filterRGB, setDimensions

Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp

clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRGB, getRenderingHints, setRGB

Constructor Details

OpacityFilter

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

OpacityFilter

public OpacityFilter(int opacity)
Construct an OpacityFilter with the given opacity (alpha).
Parameters:
opacity - the opacity (alpha) in the range 0..255

Method Details

filterRGB

public int filterRGB(int x,
                     int y,
                     int rgb)
Overrides:
filterRGB in interface PointFilter

getOpacity

public int getOpacity()
Get the opacity setting.
Returns:
the opacity

setOpacity

public void setOpacity(int opacity)
Set the opacity.
Parameters:
opacity - the opacity (alpha) in the range 0..255

toString

public String toString()