PulpCore

pulpcore.image.filter
Class Filter

java.lang.Object
  extended by pulpcore.image.filter.Filter
Direct Known Subclasses:
Blur, ColorOverlay, FilterChain, Grayscale, HSBAdjust, Identity, MotionBlur, Negative, Reflection, Sepia, Stroke, Superimpose, Thermal

public abstract class Filter
extends Object

Base class for image filters. Subclasses override the filter(pulpcore.image.CoreImage, pulpcore.image.CoreImage) method.

See Also:
Sprite.setFilter(pulpcore.image.filter.Filter)

Constructor Summary
Filter()
           
 
Method Summary
abstract  Filter copy()
          Creates a copy of the Filter for another Sprite to use.
 CoreImage filter(CoreImage input)
          Performs this filter on the input image onto a newly created output image.
protected abstract  void filter(CoreImage input, CoreImage output)
          Performs this filter on the input image onto the specified output image.
 int getHeight()
          Gets the height of the output of this filter.
 CoreImage getInput()
           
 CoreImage getOutput()
          Gets the filtered output image.
 int getWidth()
          Gets the width of the output of this filter.
 int getX()
          Gets the x offset the output image should display relative to the input.
 int getY()
          Gets the y offset the output image should display relative to the input.
 boolean isDirty()
           
 boolean isOpaque()
          Returns true if the output of this filter is opaque.
 void setDirty()
           
 void setInput(CoreImage input)
          Sets the filter input.
 void update(int elapsedTime)
          Updates the filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filter

public Filter()
Method Detail

getX

public int getX()
Gets the x offset the output image should display relative to the input.


getY

public int getY()
Gets the y offset the output image should display relative to the input.


getWidth

public int getWidth()
Gets the width of the output of this filter. By default, the width is the same as the input's width.


getHeight

public int getHeight()
Gets the height of the output of this filter. By default, the height is the same as the input's height.


isOpaque

public boolean isOpaque()
Returns true if the output of this filter is opaque. By default, the output is opaque if the input is opaque.


update

public void update(int elapsedTime)
Updates the filter. The default method does nothing.


filter

protected abstract void filter(CoreImage input,
                               CoreImage output)
Performs this filter on the input image onto the specified output image.

This method is called from getOutput() if isDirty() returns true. The output image will be the same dimensions as (getWidth() x getHeight(). Implementors must ensure that every pixel in output is drawn.


copy

public abstract Filter copy()
Creates a copy of the Filter for another Sprite to use. The input filter is also copied. The properties of the copy, if any, will be bound to the original filter's properties.

This method is used by the Sprite class. Most apps will not need to call this method.

Subclasses should bind all properties of the cloned object using bindWithInverse(). For example, for the HSBAdjust filter:

        public Filter copy() {
            HSBAdjust copy = new HSBAdjust();
            copy.hue.bindWithInverse(hue);
            copy.brightness.bindWithInverse(brightness);
            copy.saturation.bindWithInverse(saturation);
            return copy;
        }
        


filter

public final CoreImage filter(CoreImage input)
Performs this filter on the input image onto a newly created output image. The current input image, if any, is ignored.


setInput

public final void setInput(CoreImage input)
Sets the filter input.


getInput

public final CoreImage getInput()

getOutput

public final CoreImage getOutput()
Gets the filtered output image.


isDirty

public final boolean isDirty()

setDirty

public final void setDirty()

PulpCore

Copyright © 2007-2009 Interactive Pulp, LLC.