project.android.imageprocessing.filter
Class CompositeFilter

java.lang.Object
  extended by project.android.imageprocessing.GLRenderer
      extended by project.android.imageprocessing.input.GLTextureOutputRenderer
          extended by project.android.imageprocessing.filter.BasicFilter
              extended by project.android.imageprocessing.filter.MultiInputFilter
                  extended by project.android.imageprocessing.filter.CompositeFilter
All Implemented Interfaces:
GLTextureInputRenderer
Direct Known Subclasses:
AdaptiveThresholdFilter, GaussianBlurPositionFilter, TiltShiftFilter, UnsharpMaskFilter

public class CompositeFilter
extends MultiInputFilter

An extension of a MultiInputFilter. This class can be used to create a filter that takes multiple inputs where some of the inputs are other filters internal to this filter. For example, if a filter requires both an input image and the blur of the input image, a CompositeFilter should be used. Internal filters need to be registered so that they can be distinguished from external inputs. All of the internal filters should be registered with registerInitialFilter(GLTextureOutputRenderer filter), registerTerminalFilter(GLTextureOutputRenderer filter) or registerFilter(GLTextureOutputRenderer filter). If the internal filter requires the input of the external filter then it should be registered as an initial filter. If the filter output is used in the fragment shader of the CompositeFilter, it should be registered as an terminal filter. If it is neither an initial or terminal filter, but is still part of the pipeline that is internal to the CompositeFilter, it should be registered using registerFilter. If an external input is required as input to an initial filter and is also required as input to the CompositeFilter, it should be registered with registerInputOutputFilter(GLTextureOutputRenderer filter). On top of the registering the internal filters, the filter locations for the MultiInputFilter should also be registered.


Field Summary
 
Fields inherited from class project.android.imageprocessing.GLRenderer
ATTRIBUTE_POSITION, ATTRIBUTE_TEXCOORD, UNIFORM_TEXTURE0, VARYING_TEXCOORD
 
Constructor Summary
CompositeFilter(int numOfInputs)
          Creates a CompositeFilter with the default BasicFilter shaders that takes in a given number of inputs
 
Method Summary
 void destroy()
          Cleans up the opengl objects for this renderer.
 void newTextureReady(int texture, GLTextureOutputRenderer source)
          Signals that a new texture is available and the image should be reprocessed.
 void setRenderSize(int width, int height)
          Sets the render size of the renderer to the given width and height.
 
Methods inherited from class project.android.imageprocessing.filter.MultiInputFilter
clearRegisteredFilterLocations, registerFilterLocation, registerFilterLocation
 
Methods inherited from class project.android.imageprocessing.input.GLTextureOutputRenderer
addTarget, getLockObject, getTargets, removeTarget
 
Methods inherited from class project.android.imageprocessing.GLRenderer
getBackgroundAlpha, getBackgroundBlue, getBackgroundGreen, getBackgroundRed, getHeight, getWidth, onDrawFrame, reInitialize, rotateClockwise90Degrees, rotateCounterClockwise90Degrees, setBackgroundAlpha, setBackgroundBlue, setBackgroundColour, setBackgroundGreen, setBackgroundRed
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeFilter

public CompositeFilter(int numOfInputs)
Creates a CompositeFilter with the default BasicFilter shaders that takes in a given number of inputs

Parameters:
numOfInputs - The number of inputs that this filter expects
Method Detail

destroy

public void destroy()
Description copied from class: GLRenderer
Cleans up the opengl objects for this renderer. Must be called with opengl context. Normally called by FastImageProcessingPipeline.

Overrides:
destroy in class GLTextureOutputRenderer

newTextureReady

public void newTextureReady(int texture,
                            GLTextureOutputRenderer source)
Description copied from interface: GLTextureInputRenderer
Signals that a new texture is available and the image should be reprocessed.

Specified by:
newTextureReady in interface GLTextureInputRenderer
Overrides:
newTextureReady in class MultiInputFilter
Parameters:
texture - The texture id to be used as input.
source - The GLTextureOutputRenderer which produced the texture.

setRenderSize

public void setRenderSize(int width,
                          int height)
Description copied from class: GLRenderer
Sets the render size of the renderer to the given width and height. This also prevents the size of the renderer from changing automatically when one of the source(s) of the renderer has a size change. If the renderer has been rotated an odd number of times, the width and height will be swapped.

Overrides:
setRenderSize in class GLRenderer
Parameters:
width - The width at which the renderer should draw at.
height - The height at which the renderer should draw at.