public abstract class ImageFilter extends AbstractConfig implements ImageFilterInterface
Modifier and Type | Class and Description |
---|---|
static interface |
ImageFilter.FilterConfigIntensity
Implement this interface if a Filter has Intensity Control
|
AbstractConfig.BindData
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_ATTRIB_POSITION |
static java.lang.String |
DEFAULT_ATTRIB_TEXTURE_COORDINATE |
static java.lang.String |
DEFAULT_UNIFORM_SAMPLER |
protected static java.lang.String |
DEFAULT_VERTEX_SHADER |
protected static java.lang.String |
TARGET_PLACEHOLDER |
protected static int |
VERTICES_DATA_POS_OFFSET |
protected static int |
VERTICES_DATA_POS_SIZE |
protected static int |
VERTICES_DATA_STRIDE_BYTES |
protected static int |
VERTICES_DATA_UV_OFFSET |
protected static int |
VERTICES_DATA_UV_SIZE |
isDirty, ORIGINAL_THUMBNAIL_SIZE
Modifier | Constructor and Description |
---|---|
|
ImageFilter() |
|
ImageFilter(int name,
int drawableId) |
|
ImageFilter(int name,
int drawableId,
int vertexShaderSourceResId,
int fragmentShaderSourceResId) |
|
ImageFilter(int name,
int drawableId,
java.lang.String vertexShaderSource,
java.lang.String fragmentShaderSource) |
protected |
ImageFilter(Parcel in) |
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
createTargetShader(java.lang.String shader,
int texTarget) |
DataSourceListAdapter.DataSourceViewHolder<AbstractConfig.BindData> |
createViewHolder(View view,
boolean useVerticalLayout)
Create a ViewHolder to Display in List
|
int |
describeContents() |
void |
draw(Texture texture,
float[] mvpMatrix,
float[] stMatrix,
float aspectRatio)
Draw texture in OpenGl Context
|
protected int |
getHandle(java.lang.String name) |
int |
getLayout()
Get the layout res id of the list item view.
|
Bitmap |
getThumbnailBitmap(int maxWidth)
Return the Thumbnail, do not call in Main Thread and use #getThumbnailResId() if #hasStaticThumbnail
|
boolean |
hasIntensityConfig()
Check if the Filter has Intensity Control
|
boolean |
hasStaticThumbnail()
Check if it has a static thumbnail drawable.
|
boolean |
isSelectable() |
protected void |
onDraw() |
void |
release()
Release the shader program and texture
|
protected void |
releaseProgram() |
android.support.v8.renderscript.Allocation |
renderImage(android.support.v8.renderscript.Allocation allocation,
float intensity,
boolean previewMode)
Apply the renderscript filter with a specific intensity.
|
Bitmap |
renderImage(Bitmap bitmap,
boolean previewRendering) |
Bitmap |
renderImage(Bitmap bitmap,
float intensity,
boolean previewRendering)
Apply the renderscript filter with a specific intensity.
|
protected void |
setup(int textureTarget) |
protected void |
useProgram() |
void |
writeToParcel(Parcel dest,
int flags) |
generateBindData, generateBindDataAsync, getName, getThumbnailBitmap, getThumbnailResId, getThumbnailSource, getTitle, getVerticalLayout, isClickable, isDirty, setDirtyFlag
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
generateBindData, generateBindDataAsync, getName, getVerticalLayout, isDirty, setDirtyFlag
public static final java.lang.String DEFAULT_ATTRIB_POSITION
public static final java.lang.String DEFAULT_ATTRIB_TEXTURE_COORDINATE
public static final java.lang.String DEFAULT_UNIFORM_SAMPLER
protected static final java.lang.String DEFAULT_VERTEX_SHADER
protected static final java.lang.String TARGET_PLACEHOLDER
protected static final int VERTICES_DATA_POS_OFFSET
protected static final int VERTICES_DATA_POS_SIZE
protected static final int VERTICES_DATA_STRIDE_BYTES
protected static final int VERTICES_DATA_UV_OFFSET
protected static final int VERTICES_DATA_UV_SIZE
public ImageFilter()
public ImageFilter(@StringRes int name, @DrawableRes int drawableId)
public ImageFilter(@StringRes int name, @DrawableRes int drawableId, @StringRes int vertexShaderSourceResId, @StringRes int fragmentShaderSourceResId)
public ImageFilter(@StringRes int name, @DrawableRes int drawableId, java.lang.String vertexShaderSource, java.lang.String fragmentShaderSource)
protected ImageFilter(Parcel in)
protected static java.lang.String createTargetShader(@NonNull java.lang.String shader, int texTarget)
@NonNull public DataSourceListAdapter.DataSourceViewHolder<AbstractConfig.BindData> createViewHolder(@NonNull View view, boolean useVerticalLayout)
DataSourceInterface
createViewHolder
in interface DataSourceInterface<AbstractConfig.BindData>
createViewHolder
in class AbstractConfig
view
- view inflated with #getLayoutpublic int describeContents()
describeContents
in class AbstractConfig
public void draw(@NonNull Texture texture, float[] mvpMatrix, float[] stMatrix, float aspectRatio)
ImageFilterInterface
draw
in interface ImageFilterInterface
texture
- the camera preview texturemvpMatrix
- the camera sourceType transformationstMatrix
- the stage destination transformationaspectRatio
- the camera image aspectprotected final int getHandle(java.lang.String name)
public int getLayout()
DataSourceInterface
getLayout
in interface DataSourceInterface<AbstractConfig.BindData>
public Bitmap getThumbnailBitmap(int maxWidth)
AbstractConfig
getThumbnailBitmap
in class AbstractConfig
maxWidth
- Size the drawable should be limited to.public boolean hasIntensityConfig()
hasIntensityConfig
in interface ImageFilterInterface
public boolean hasStaticThumbnail()
AbstractConfig
hasStaticThumbnail
in class AbstractConfig
AbstractConfig.getThumbnailBitmap()
public boolean isSelectable()
isSelectable
in interface DataSourceInterface<AbstractConfig.BindData>
protected void onDraw()
public void release()
release
in interface ImageFilterInterface
protected void releaseProgram()
@Nullable public android.support.v8.renderscript.Allocation renderImage(android.support.v8.renderscript.Allocation allocation, float intensity, boolean previewMode)
ImageFilterInterface
renderImage
in interface ImageFilterInterface
allocation
- the sourceType image.intensity
- the filter intensitypreviewMode
- set true to triggerOperatorsIfNeeded a faster previewpublic Bitmap renderImage(Bitmap bitmap, boolean previewRendering)
@Nullable public Bitmap renderImage(Bitmap bitmap, float intensity, boolean previewRendering)
ImageFilterInterface
renderImage
in interface ImageFilterInterface
bitmap
- the sourceType image.intensity
- the filter intensitypreviewRendering
- set true to triggerOperatorsIfNeeded a faster previewprotected void setup(int textureTarget)
protected final void useProgram()
public void writeToParcel(Parcel dest, int flags)
writeToParcel
in class AbstractConfig