FileDocCategorySizeDatePackage
ThresholdOp.javaAPI DocExample1900Mon Apr 05 11:16:26 BST 1999None

ThresholdOp

public class ThresholdOp extends Object implements BufferedImageOp

Fields Summary
protected int
mThreshold
protected int
mMinimum
protected int
mMaximum
Constructors Summary
public ThresholdOp(int threshold, int minimum, int maximum)

    mThreshold = threshold;
    mMinimum = minimum;
    mMaximum = maximum;
  
Methods Summary
public java.awt.image.BufferedImagecreateCompatibleDestImage(java.awt.image.BufferedImage src, java.awt.image.ColorModel dstCM)

    BufferedImage image;
    if (dstCM == null) dstCM = src.getColorModel();
  
    int width = src.getWidth();
    int height = src.getHeight();
    image = new BufferedImage (dstCM,
        dstCM.createCompatibleWritableRaster(width, height),
        dstCM.isAlphaPremultiplied(), null);
    
    return image;
  
public final java.awt.image.BufferedImagefilter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst)

    if (dst == null) dst = createCompatibleDestImage(src, null);
    
    for (int y = 0; y < src.getHeight(); y++) {
      for (int x = 0; x < src.getWidth(); x++) {
        int srcPixel = src.getRGB(x, y);
        Color c = new Color(srcPixel);
        int red = threshold(c.getRed());
        int green = threshold(c.getGreen());
        int blue = threshold(c.getBlue());
        dst.setRGB(x, y, new Color(red, green, blue).getRGB());
      }
    }

    return dst;
  
public final java.awt.geom.Rectangle2DgetBounds2D(java.awt.image.BufferedImage src)

    return src.getRaster().getBounds();
  
public final java.awt.geom.Point2DgetPoint2D(java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt)

    if (dstPt == null) dstPt = new Point2D.Float();
    dstPt.setLocation(srcPt.getX(), srcPt.getY());
    return dstPt;
  
public final java.awt.RenderingHintsgetRenderingHints()

 return null; 
public intthreshold(int input)

    if (input < mThreshold) return mMinimum;
    else return mMaximum;