project.android.imageprocessing.input
Class ImageResourceInput

java.lang.Object
  extended by project.android.imageprocessing.GLRenderer
      extended by project.android.imageprocessing.input.GLTextureOutputRenderer
          extended by project.android.imageprocessing.input.ImageResourceInput

public class ImageResourceInput
extends GLTextureOutputRenderer

A image input renderer extension of the BasicFilter. This class takes an image as input and processes it so that it can be sent to other filters. The image can be changed at any time without creating a new GLImageToTextureRenderer by using the setImage(int resourceId) method.

Author:
Chris Batt

Field Summary
 
Fields inherited from class project.android.imageprocessing.GLRenderer
ATTRIBUTE_POSITION, ATTRIBUTE_TEXCOORD, UNIFORM_TEXTURE0, VARYING_TEXCOORD
 
Constructor Summary
ImageResourceInput(android.opengl.GLSurfaceView view, android.graphics.Bitmap bitmap)
          Creates a GLImageToTextureRenderer using the given bitmap as the image input.
ImageResourceInput(android.opengl.GLSurfaceView view, android.content.Context context, int resourceId)
          Creates a GLImageToTextureRenderer using the given resourceId as the image input.
ImageResourceInput(android.opengl.GLSurfaceView view, java.lang.String pathName)
          Creates a GLImageToTextureRenderer using the given file path to the image input.
 
Method Summary
 void destroy()
          Cleans up the opengl objects for this renderer.
 int getImageHeight()
          Returns the height of the current image being output.
 int getImageWidth()
          Returns the width of the current image being output.
 void setImage(android.graphics.Bitmap bitmap)
          Sets the image being output by this renderer to the given bitmap.
 void setImage(int resourceId)
          Sets the image being output by this renderer to the image loaded from the given id.
 void setImage(java.lang.String filePath)
          Sets the image being output by this renderer to the image loaded from the given file path.
 
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, setRenderSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageResourceInput

public ImageResourceInput(android.opengl.GLSurfaceView view,
                          android.graphics.Bitmap bitmap)
Creates a GLImageToTextureRenderer using the given bitmap as the image input.

Parameters:
bitmap - The bitmap which contains the image.

ImageResourceInput

public ImageResourceInput(android.opengl.GLSurfaceView view,
                          android.content.Context context,
                          int resourceId)
Creates a GLImageToTextureRenderer using the given resourceId as the image input. All future images must also come from the same context.

Parameters:
context - The context in which the resourceId exists.
resourceId - The resource id of the image which should be processed.

ImageResourceInput

public ImageResourceInput(android.opengl.GLSurfaceView view,
                          java.lang.String pathName)
Creates a GLImageToTextureRenderer using the given file path to the image input.

Parameters:
pathName - The file path to the image to load.
Method Detail

getImageHeight

public int getImageHeight()
Returns the height of the current image being output.

Returns:
image height

getImageWidth

public int getImageWidth()
Returns the width of the current image being output.

Returns:
image width

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

setImage

public void setImage(android.graphics.Bitmap bitmap)
Sets the image being output by this renderer to the given bitmap.

Parameters:
bitmap - The bitmap which contains the image.

setImage

public void setImage(int resourceId)
Sets the image being output by this renderer to the image loaded from the given id.

Parameters:
resourceId - The resource id of the new image to be output by this renderer.

setImage

public void setImage(java.lang.String filePath)
Sets the image being output by this renderer to the image loaded from the given file path.

Parameters:
filePath - The file path to the image to load.