public class GPUImage
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
GPUImage.OnPictureSavedListener |
static interface |
GPUImage.ResponseListener<T> |
static class |
GPUImage.ScaleType |
| Constructor and Description |
|---|
GPUImage(android.content.Context context)
Instantiates a new GPUImage object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
deleteImage()
Deletes the current image.
|
static void |
getBitmapForMultipleFilters(android.graphics.Bitmap bitmap,
java.util.List<GPUImageFilter> filters,
GPUImage.ResponseListener<android.graphics.Bitmap> listener)
Gets the images for multiple filters on a image.
|
android.graphics.Bitmap |
getBitmapWithFilterApplied()
Gets the current displayed image with applied filter as a Bitmap.
|
android.graphics.Bitmap |
getBitmapWithFilterApplied(android.graphics.Bitmap bitmap)
Gets the given bitmap with current filter applied as a Bitmap.
|
android.graphics.Bitmap |
getBitmapWithFilterApplied(android.graphics.Bitmap bitmap,
boolean recycle)
Gets the given bitmap with current filter applied as a Bitmap.
|
GPUImageRenderer |
getRenderer() |
int[] |
getScaleSize()
This gets the size of the image.
|
void |
requestRender()
Request the preview to be rendered again.
|
void |
saveToPictures(android.graphics.Bitmap bitmap,
java.lang.String folderName,
java.lang.String fileName,
GPUImage.OnPictureSavedListener listener)
Apply and save the given bitmap with applied filter to Pictures.
|
void |
saveToPictures(java.lang.String folderName,
java.lang.String fileName,
GPUImage.OnPictureSavedListener listener)
Save current image with applied filter to Pictures.
|
void |
setBackgroundColor(float red,
float green,
float blue)
Sets the background color
|
void |
setFilter(GPUImageFilter filter)
Sets the filter which should be applied to the image which was (or will
be) set by setImage(...).
|
void |
setGLSurfaceView(android.opengl.GLSurfaceView view)
Sets the GLSurfaceView which will display the preview.
|
void |
setGLTextureView(GLTextureView view)
Sets the GLTextureView which will display the preview.
|
void |
setImage(android.graphics.Bitmap bitmap)
Sets the image on which the filter should be applied.
|
void |
setImage(java.io.File file)
Sets the image on which the filter should be applied from a File.
|
void |
setImage(android.net.Uri uri)
Sets the image on which the filter should be applied from a Uri.
|
void |
setRotation(Rotation rotation)
Sets the rotation of the displayed image.
|
void |
setRotation(Rotation rotation,
boolean flipHorizontal,
boolean flipVertical)
Sets the rotation of the displayed image with flip options.
|
void |
setScaleType(GPUImage.ScaleType scaleType)
This sets the scale type of GPUImage.
|
void |
setUpCamera(android.hardware.Camera camera)
Deprecated.
|
void |
setUpCamera(android.hardware.Camera camera,
int degrees,
boolean flipHorizontal,
boolean flipVertical)
Deprecated.
|
void |
updatePreviewFrame(byte[] data,
int width,
int height)
Update camera preview frame with YUV format data.
|
public GPUImage(android.content.Context context)
context - the contextpublic void setGLSurfaceView(android.opengl.GLSurfaceView view)
view - the GLSurfaceViewpublic void setGLTextureView(GLTextureView view)
view - the GLTextureViewpublic void setBackgroundColor(float red,
float green,
float blue)
red - red color valuegreen - green color valueblue - red color valuepublic void requestRender()
@Deprecated public void setUpCamera(android.hardware.Camera camera)
updatePreviewFrame(byte[], int, int) frame by frame
Sets the up camera to be connected to GPUImage to get a filtered preview.
camera - the camera@Deprecated
public void setUpCamera(android.hardware.Camera camera,
int degrees,
boolean flipHorizontal,
boolean flipVertical)
updatePreviewFrame(byte[], int, int) frame by frame
Sets the up camera to be connected to GPUImage to get a filtered preview.
camera - the cameradegrees - by how many degrees the image should be rotatedflipHorizontal - if the image should be flipped horizontallyflipVertical - if the image should be flipped verticallypublic void setFilter(GPUImageFilter filter)
filter - the new filterpublic void setImage(android.graphics.Bitmap bitmap)
bitmap - the new imagepublic void updatePreviewFrame(byte[] data,
int width,
int height)
data - Camera preview YUV data for frame.width - width of camera previewheight - height of camera previewpublic void setScaleType(GPUImage.ScaleType scaleType)
scaleType - The new ScaleTypepublic int[] getScaleSize()
public void setRotation(Rotation rotation)
rotation - new rotationpublic void setRotation(Rotation rotation, boolean flipHorizontal, boolean flipVertical)
rotation - new rotationpublic void deleteImage()
public void setImage(android.net.Uri uri)
uri - the uri of the new imagepublic void setImage(java.io.File file)
file - the file of the new imagepublic android.graphics.Bitmap getBitmapWithFilterApplied()
public android.graphics.Bitmap getBitmapWithFilterApplied(android.graphics.Bitmap bitmap)
bitmap - the bitmap on which the current filter should be appliedpublic android.graphics.Bitmap getBitmapWithFilterApplied(android.graphics.Bitmap bitmap,
boolean recycle)
bitmap - the bitmap on which the current filter should be appliedrecycle - recycle the bitmap or not.public static void getBitmapForMultipleFilters(android.graphics.Bitmap bitmap,
java.util.List<GPUImageFilter> filters,
GPUImage.ResponseListener<android.graphics.Bitmap> listener)
bitmap - the bitmap on which the filters will be appliedfilters - the filters which will be applied on the bitmaplistener - the listener on which the results will be notifiedpublic void saveToPictures(java.lang.String folderName,
java.lang.String fileName,
GPUImage.OnPictureSavedListener listener)
folderName - the folder namefileName - the file namelistener - the listenerpublic void saveToPictures(android.graphics.Bitmap bitmap,
java.lang.String folderName,
java.lang.String fileName,
GPUImage.OnPictureSavedListener listener)
bitmap - the bitmapfolderName - the folder namefileName - the file namelistener - the listenerpublic GPUImageRenderer getRenderer()