Class BufferedImageFilter

java.lang.Object
java.awt.image.ImageFilter
java.awt.image.BufferedImageFilter
All Implemented Interfaces:
ImageConsumer, Cloneable

public class BufferedImageFilter extends ImageFilter implements Cloneable
The BufferedImageFilter class subclasses an ImageFilter to provide a simple means of using a single-source/single-destination image operator (BufferedImageOp) to filter a BufferedImage in the Image Producer/Consumer/Observer paradigm. Examples of these image operators are: ConvolveOp, AffineTransformOp and LookupOp.
See Also:
  • Field Summary

    Fields declared in class ImageFilter

    consumer
    Modifier and Type
    Field
    Description
    protected ImageConsumer
    The consumer of the particular image data stream for which this instance of the ImageFilter is filtering data.

    Fields declared in interface ImageConsumer

    COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT
    Modifier and Type
    Field
    Description
    static final int
    The pixels will be delivered in (multiples of) complete scanlines at a time.
    static final int
    The image creation process was deliberately aborted.
    static final int
    An error was encountered while producing the image.
    static final int
    The pixels will be delivered in a random order.
    static final int
    The image contain a single static image.
    static final int
    One frame of the image is complete but there are more frames to be delivered.
    static final int
    The pixels will be delivered in a single pass.
    static final int
    The image is complete and there are no more pixels or frames to be delivered.
    static final int
    The pixels will be delivered in top-down, left-to-right order.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a BufferedImageFilter with the specified single-source/single-destination operator.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the BufferedImageOp.
    void
    imageComplete(int status)
    Filters the information provided in the imageComplete method of the ImageConsumer interface.
    void
    Filters the information provided in the setColorModel method of the ImageConsumer interface.
    void
    setDimensions(int width, int height)
    Filters the information provided in the setDimensions method of the ImageConsumer interface.
    void
    setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, int scansize)
    Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of bytes.
    void
    setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize)
    Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of integers.

    Methods declared in class ImageFilter

    clone, getFilterInstance, resendTopDownLeftRight, setHints, setProperties
    Modifier and Type
    Method
    Description
    Clones this object.
    Returns a unique instance of an ImageFilter object which will actually perform the filtering for the specified ImageConsumer.
    void
    Responds to a request for a TopDownLeftRight (TDLR) ordered resend of the pixel data from an ImageConsumer.
    void
    setHints(int hints)
    Filters the information provided in the setHints method of the ImageConsumer interface.
    void
    Passes the properties from the source object along after adding a property indicating the stream of filters it has been run through.

    Methods declared in class Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Constructor Details

    • BufferedImageFilter

      public BufferedImageFilter(BufferedImageOp op)
      Constructs a BufferedImageFilter with the specified single-source/single-destination operator.
      Parameters:
      op - the specified BufferedImageOp to use to filter a BufferedImage
      Throws:
      NullPointerException - if op is null
  • Method Details

    • getBufferedImageOp

      public BufferedImageOp getBufferedImageOp()
      Returns the BufferedImageOp.
      Returns:
      the operator of this BufferedImageFilter.
    • setDimensions

      public void setDimensions(int width, int height)
      Filters the information provided in the setDimensions method of the ImageConsumer interface.

      Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

      Specified by:
      setDimensions in interface ImageConsumer
      Overrides:
      setDimensions in class ImageFilter
      Parameters:
      width - the width to which to set the width of this BufferedImageFilter
      height - the height to which to set the height of this BufferedImageFilter
      See Also:
    • setColorModel

      public void setColorModel(ColorModel model)
      Filters the information provided in the setColorModel method of the ImageConsumer interface.

      If model is null, this method clears the current ColorModel of this BufferedImageFilter.

      Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

      Specified by:
      setColorModel in interface ImageConsumer
      Overrides:
      setColorModel in class ImageFilter
      Parameters:
      model - the ColorModel to which to set the ColorModel of this BufferedImageFilter
      See Also:
    • setPixels

      public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, int scansize)
      Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of bytes.

      Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

      Specified by:
      setPixels in interface ImageConsumer
      Overrides:
      setPixels in class ImageFilter
      Parameters:
      x - the X coordinate of the upper-left corner of the area of pixels to be set
      y - the Y coordinate of the upper-left corner of the area of pixels to be set
      w - the width of the area of pixels
      h - the height of the area of pixels
      model - the specified ColorModel
      pixels - the array of pixels
      off - the offset into the pixels array
      scansize - the distance from one row of pixels to the next in the pixels array
      Throws:
      IllegalArgumentException - if width or height are less than zero.
      See Also:
    • setPixels

      public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize)
      Filters the information provided in the setPixels method of the ImageConsumer interface which takes an array of integers.

      Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

      Specified by:
      setPixels in interface ImageConsumer
      Overrides:
      setPixels in class ImageFilter
      Parameters:
      x - the X coordinate of the upper-left corner of the area of pixels to be set
      y - the Y coordinate of the upper-left corner of the area of pixels to be set
      w - the width of the area of pixels
      h - the height of the area of pixels
      model - the specified ColorModel
      pixels - the array of pixels
      off - the offset into the pixels array
      scansize - the distance from one row of pixels to the next in the pixels array
      Throws:
      IllegalArgumentException - if width or height are less than zero.
      See Also:
    • imageComplete

      public void imageComplete(int status)
      Filters the information provided in the imageComplete method of the ImageConsumer interface.

      Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being filtered. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

      Specified by:
      imageComplete in interface ImageConsumer
      Overrides:
      imageComplete in class ImageFilter
      Parameters:
      status - the status of image loading
      Throws:
      ImagingOpException - if there was a problem calling the filter method of the BufferedImageOp associated with this instance.
      See Also: