project.android.imageprocessing.output
Class JPGFileEndpoint

java.lang.Object
  extended by project.android.imageprocessing.GLRenderer
      extended by project.android.imageprocessing.output.JPGFileEndpoint
All Implemented Interfaces:
GLTextureInputRenderer

public class JPGFileEndpoint
extends GLRenderer
implements GLTextureInputRenderer

A JPG image renderer extension of GLRenderer. This class accepts a texture as input and renders it to a jpeg image file. Images will be saved to file every time the texture is updated. If increment is on, it will save the file with the given base name and an added number in the format "filePath%d.jpg". The filepath is the path and name of the image file that should be written to (".jpg" will be appened automatically). This class does not handle displaying to the screen; however it does use the screen to render to the video recorder, so if display is not required the opengl context should be hidden. Storing to the camera roll is optional. If it is false, the context is allowed to be null. Either way the image is written to filePath; however, it will only be visible in the gallery if storing to media is true. Storing to media may slow down the file writing. Also, if it is true, every image will be stored to the camera roll whether or not increment is on.

Author:
Chris Batt

Field Summary
 
Fields inherited from class project.android.imageprocessing.GLRenderer
ATTRIBUTE_POSITION, ATTRIBUTE_TEXCOORD, UNIFORM_TEXTURE0, VARYING_TEXCOORD
 
Constructor Summary
JPGFileEndpoint(android.content.Context context, boolean storeToMedia, java.lang.String filePath, boolean increment)
          Creates a JPGFileEndpoint that writes to disk on the given file path and may or may not also write to the camera roll.
 
Method Summary
 void newTextureReady(int texture, GLTextureOutputRenderer source)
          Signals that a new texture is available and the image should be reprocessed.
 
Methods inherited from class project.android.imageprocessing.GLRenderer
destroy, 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

JPGFileEndpoint

public JPGFileEndpoint(android.content.Context context,
                       boolean storeToMedia,
                       java.lang.String filePath,
                       boolean increment)
Creates a JPGFileEndpoint that writes to disk on the given file path and may or may not also write to the camera roll.

Parameters:
context - An activity context. Can be null if storeToMedia is false.
storeToMedia - Whether or not it should also be written to the camera roll.
filePath - The file path and name of the file that the image should be written to.
increment - Whether or not a new image should be written for each input change.
Method Detail

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
Parameters:
texture - The texture id to be used as input.
source - The GLTextureOutputRenderer which produced the texture.