Class GrayFilter

  • All Implemented Interfaces:
    java.awt.image.ImageConsumer, java.lang.Cloneable

    public class GrayFilter
    extends java.awt.image.RGBImageFilter
    This class can convert a color image to grayscale.

    Uses ITU standard conversion: (222 * Red + 707 * Green + 71 * Blue) / 1000.

    Version:
    $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/image/GrayFilter.java#1 $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int low  
      private float range  
      • 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

      Constructors 
      Constructor Description
      GrayFilter()
      Constructs a GrayFilter using ITU color-conversion.
      GrayFilter​(float pLow, float pHigh)
      Constructs a GrayFilter using ITU color-conversion, and a dynamic range between pLow and pHigh.
      GrayFilter​(int pLow, int pHigh)
      Constructs a GrayFilter using ITU color-conversion, and a dynamic range between pLow and pHigh.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int filterRGB​(int pX, int pY, int pARGB)
      Filters one pixel using ITU color-conversion.
      • 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, toString, wait, wait, wait
    • Field Detail

      • low

        private int low
      • range

        private float range
    • Constructor Detail

      • GrayFilter

        public GrayFilter()
        Constructs a GrayFilter using ITU color-conversion.
      • GrayFilter

        public GrayFilter​(float pLow,
                          float pHigh)
        Constructs a GrayFilter using ITU color-conversion, and a dynamic range between pLow and pHigh.
        Parameters:
        pLow - float in the range 0..1
        pHigh - float in the range 0..1 and >= pLow
      • GrayFilter

        public GrayFilter​(int pLow,
                          int pHigh)
        Constructs a GrayFilter using ITU color-conversion, and a dynamic range between pLow and pHigh.
        Parameters:
        pLow - integer in the range 0..255
        pHigh - integer in the range 0..255 and >= pLow
    • Method Detail

      • filterRGB

        public int filterRGB​(int pX,
                             int pY,
                             int pARGB)
        Filters one pixel using ITU color-conversion.
        Specified by:
        filterRGB in class java.awt.image.RGBImageFilter
        Parameters:
        pX - x
        pY - y
        pARGB - pixel value in default color space
        Returns:
        the filtered pixel value in the default color space