Class OpacityFilter

All Implemented Interfaces:
BufferedImageOp, Serializable, Cloneable

public class OpacityFilter extends PointFilter implements Serializable
Sets the opacity (alpha) of every pixel in an image to a constant value.
See Also:
  • Constructor Details

    • OpacityFilter

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

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

    • 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)
      Specified by:
      filterRGB in class PointFilter
    • toString

      public String toString()
      Overrides:
      toString in class Object