PulpCore

pulpcore.image.filter
Class Blur

java.lang.Object
  extended by pulpcore.image.filter.Filter
      extended by pulpcore.image.filter.Blur
Direct Known Subclasses:
DropShadow, Glow

public class Blur
extends Filter

A blur filter.

For an opaque input image (for example, a photo), the output image has the same dimensions as the input. For a non-opaque input image, the output image is expanded to show the complete blur.


Field Summary
 Int quality
          The number of times to perform the blur.
 Fixed radius
          The blur radius.
 
Constructor Summary
Blur()
          Creates a blur filter with a radius of 4 and a quality of 1.
Blur(Blur filter)
          Copy constructor.
Blur(float radius)
          Creates a blur filter with the specified radius, from 0 (no blur) to 255, and a quality of 1.
Blur(float radius, int quality)
          Creates a blur filter with the specified radius, from 0 (no blur) to 255, and the specified quality, typically from 1 (default) to 3 (Guassian approximation).
 
Method Summary
 Filter copy()
          Creates a copy of the Filter for another Sprite to use.
protected  void filter(CoreImage input, CoreImage output)
          Performs this filter on the input image onto the specified output image.
protected  void filter(CoreImage input, CoreImage output, int shiftX, int shiftY, boolean clamp)
           
 boolean getClampEdges()
          Gets whether the edges of the output is clamped (sharp edges).
 int getHeight()
          Gets the height of the output of this filter.
 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 isOpaque()
          Returns true if the output of this filter is opaque.
 void setClampEdges(boolean clamp)
          Sets whether the edges of the output is clamped (sharp edges).
 void update(int elapsedTime)
          Updates the filter.
 
Methods inherited from class pulpcore.image.filter.Filter
filter, getInput, getOutput, isDirty, setDirty, setInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

radius

public final Fixed radius
The blur radius. The radius can range from 0 (no blur) to 255. The default value is 4. Integer values are optimized to render slightly faster.


quality

public final Int quality
The number of times to perform the blur. The default value is 3 (Gaussian approximation). A value of 1 renders faster.

Constructor Detail

Blur

public Blur()
Creates a blur filter with a radius of 4 and a quality of 1.


Blur

public Blur(float radius)
Creates a blur filter with the specified radius, from 0 (no blur) to 255, and a quality of 1. Integer values are optimized to render slightly faster.


Blur

public Blur(float radius,
            int quality)
Creates a blur filter with the specified radius, from 0 (no blur) to 255, and the specified quality, typically from 1 (default) to 3 (Guassian approximation).


Blur

public Blur(Blur filter)
Copy constructor. Subclasses can use this to help implement copy().

Method Detail

setClampEdges

public void setClampEdges(boolean clamp)
Sets whether the edges of the output is clamped (sharp edges). The default is false (blurry edges).

See Also:
getClampEdges()

getClampEdges

public boolean getClampEdges()
Gets whether the edges of the output is clamped (sharp edges). The default is false (blurry edges).

See Also:
setClampEdges(boolean)

copy

public Filter copy()
Description copied from class: Filter
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;
        }
        

Specified by:
copy in class Filter

update

public void update(int elapsedTime)
Description copied from class: Filter
Updates the filter. The default method does nothing.

Overrides:
update in class Filter

getX

public int getX()
Description copied from class: Filter
Gets the x offset the output image should display relative to the input.

Overrides:
getX in class Filter

getY

public int getY()
Description copied from class: Filter
Gets the y offset the output image should display relative to the input.

Overrides:
getY in class Filter

getWidth

public int getWidth()
Description copied from class: Filter
Gets the width of the output of this filter. By default, the width is the same as the input's width.

Overrides:
getWidth in class Filter

getHeight

public int getHeight()
Description copied from class: Filter
Gets the height of the output of this filter. By default, the height is the same as the input's height.

Overrides:
getHeight in class Filter

isOpaque

public boolean isOpaque()
Description copied from class: Filter
Returns true if the output of this filter is opaque. By default, the output is opaque if the input is opaque.

Overrides:
isOpaque in class Filter

filter

protected void filter(CoreImage input,
                      CoreImage output)
Description copied from class: Filter
Performs this filter on the input image onto the specified output image.

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

Specified by:
filter in class Filter

filter

protected void filter(CoreImage input,
                      CoreImage output,
                      int shiftX,
                      int shiftY,
                      boolean clamp)

PulpCore

Copyright © 2007-2009 Interactive Pulp, LLC.