project.android.imageprocessing
Class FastImageProcessingPipeline

java.lang.Object
  extended by project.android.imageprocessing.FastImageProcessingPipeline
All Implemented Interfaces:
android.opengl.GLSurfaceView.Renderer

public class FastImageProcessingPipeline
extends java.lang.Object
implements android.opengl.GLSurfaceView.Renderer

Filter pipeline renderer implementation of the GLSurfaceView.Renderer. In addition to the GLSurfaceView.Renderer methods, this class provides methods for processing the given graph of filters. This graph of filters can be set by creating one or more filter graphs and then passing the root of the graphs to this class using addRootRenderer(GLRenderer rootRenderer). This class will not start processing the filters until startRendering() has been called. Once it has started rendering, the filter graph should not be changed without first calling pauseRendering(). Although this is theoretically not required, it is recommended. If a filter is removed from the processing pipeline, addFilterToDestroy(GLRenderer filter) should be called to clean up opengl memory.

Author:
Chris Batt

Constructor Summary
FastImageProcessingPipeline()
          Creates a FastImageProcessingPipeline with the initial state as paused and having no rootRenderer.
 
Method Summary
 void addFilterToDestroy(GLRenderer renderer)
          Adds a given filter to the list of filters to have its resources removed next time this pipeline receives an opengl context.
 void addRootRenderer(GLRenderer rootRenderer)
          Adds a root node of graph of filters that the pipeline will process and draw to the given endpoints of the graph.
 int getHeight()
          Returns the height of GLSurfaceView on the screen.
 int getWidth()
          Returns the width of GLSurfaceView on the screen.
 void onDrawFrame(javax.microedition.khronos.opengles.GL10 unused)
           
 void onSurfaceChanged(javax.microedition.khronos.opengles.GL10 unused, int width, int height)
           
 void onSurfaceCreated(javax.microedition.khronos.opengles.GL10 unused, javax.microedition.khronos.egl.EGLConfig config)
           
 void pauseRendering()
          Pauses the rendering of the graph.
 void removeRootRenderer(GLRenderer rootRenderer)
          Removes a root node of graph of filters that the pipeline will process and draw to the given endpoints of the graph.
 void startRendering()
          Starts the rendering of the graph.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastImageProcessingPipeline

public FastImageProcessingPipeline()
Creates a FastImageProcessingPipeline with the initial state as paused and having no rootRenderer.

Method Detail

addFilterToDestroy

public void addFilterToDestroy(GLRenderer renderer)
Adds a given filter to the list of filters to have its resources removed next time this pipeline receives an opengl context. The filter will still be usable and will recreate all of the destroyed opengl objects next time it is used in the pipeline.

Parameters:
renderer -

addRootRenderer

public void addRootRenderer(GLRenderer rootRenderer)
Adds a root node of graph of filters that the pipeline will process and draw to the given endpoints of the graph.

Parameters:
rootRenderer - A root node (input node) of the graph of filters and endpoints.

getHeight

public int getHeight()
Returns the height of GLSurfaceView on the screen.

Returns:
height

getWidth

public int getWidth()
Returns the width of GLSurfaceView on the screen.

Returns:
width

onDrawFrame

public void onDrawFrame(javax.microedition.khronos.opengles.GL10 unused)
Specified by:
onDrawFrame in interface android.opengl.GLSurfaceView.Renderer

onSurfaceChanged

public void onSurfaceChanged(javax.microedition.khronos.opengles.GL10 unused,
                             int width,
                             int height)
Specified by:
onSurfaceChanged in interface android.opengl.GLSurfaceView.Renderer

onSurfaceCreated

public void onSurfaceCreated(javax.microedition.khronos.opengles.GL10 unused,
                             javax.microedition.khronos.egl.EGLConfig config)
Specified by:
onSurfaceCreated in interface android.opengl.GLSurfaceView.Renderer

pauseRendering

public void pauseRendering()
Pauses the rendering of the graph. This method should be called before the alteration of the filter graph; however, altering the filter graph without pauses should still work.


removeRootRenderer

public void removeRootRenderer(GLRenderer rootRenderer)
Removes a root node of graph of filters that the pipeline will process and draw to the given endpoints of the graph.

Parameters:
rootRenderer - A root node (input node) of the graph of filters and endpoints.

startRendering

public void startRendering()
Starts the rendering of the graph. If this is called before a root node renderer has been added, it will do nothing.