public class BaseImageFilter extends Object
BaseImageFilter
is a base filter for Straas streaming SDK. You can extend this class and
override methods by OpenGLES to build a filter.
This filter can be used by StreamManager.setFilter(BaseImageFilter)
.
You can use mShapeCoordinate
as shape coordinate buffer and mTextureCoordinate
as texture coordinate buffer and mIndicesOrder
as indices order buffer to draw a picture
with default direction. To change direction, you can use the information of the variables to create
your own coordinates and order.Modifier and Type | Field and Description |
---|---|
protected static int |
COORDS_PER_VERTEX
How many elements per shape vertex in
mShapeCoordinate . |
protected int |
mHeight
Output video height.
|
protected ShortBuffer |
mIndicesOrder
Order of drawing indices by default.
|
protected FloatBuffer |
mShapeCoordinate
Shape coordinate by default.
|
protected FloatBuffer |
mTextureCoordinate
Texture coordinate by default.
|
protected int |
mWidth
Output video width.
|
protected static int |
TEXTURE_COORDS_PER_VERTEX
How many elements per texture vertex in
mTextureCoordinate . |
Constructor and Description |
---|
BaseImageFilter() |
Modifier and Type | Method and Description |
---|---|
void |
onDestroy()
Called when this filter destroys.
|
void |
onDraw(int imageTexture,
int targetFrameBuffer)
Override this method by OpenGLES
to define how the drawing occurs.
|
void |
onInit(int width,
int height)
Called when initializing.
|
protected static final int COORDS_PER_VERTEX
mShapeCoordinate
.protected static final int TEXTURE_COORDS_PER_VERTEX
mTextureCoordinate
.protected int mWidth
onInit(int, int)
.protected int mHeight
onInit(int, int)
.protected ShortBuffer mIndicesOrder
onInit(int, int)
finishes.protected FloatBuffer mShapeCoordinate
onInit(int, int)
finishes. Two elements represent a vertex(X, Y) and we use four
vertex to draw a rectangle image.protected FloatBuffer mTextureCoordinate
onInit(int, int)
finishes. Two elements represent a vertex(X, Y) and we use four
vertex to draw a rectangle image.public void onInit(int width, int height)
width
- output video widthheight
- output video heightpublic void onDraw(int imageTexture, int targetFrameBuffer)
imageTexture
- origin texture name. see OpenGLES glGenTexturestargetFrameBuffer
- target frame buffer object name. see OpenGLES glGenFramebufferspublic void onDestroy()