use of android.filterfw.core.GLFrame in project android_frameworks_base by crdroidandroid.
the class ResizeFilter method process.
@Override
public void process(FilterContext env) {
// Get input frame
Frame input = pullInput("image");
createProgram(env, input.getFormat());
// Create output frame
MutableFrameFormat outputFormat = input.getFormat().mutableCopy();
if (mKeepAspectRatio) {
FrameFormat inputFormat = input.getFormat();
mOHeight = mOWidth * inputFormat.getHeight() / inputFormat.getWidth();
}
outputFormat.setDimensions(mOWidth, mOHeight);
Frame output = env.getFrameManager().newFrame(outputFormat);
// Process
if (mGenerateMipMap) {
GLFrame mipmapped = (GLFrame) env.getFrameManager().newFrame(input.getFormat());
mipmapped.setTextureParameter(GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR_MIPMAP_NEAREST);
mipmapped.setDataFromFrame(input);
mipmapped.generateMipMap();
mProgram.process(mipmapped, output);
mipmapped.release();
} else {
mProgram.process(input, output);
}
// Push output
pushOutput("image", output);
// Release pushed frame
output.release();
}
use of android.filterfw.core.GLFrame in project android_frameworks_base by crdroidandroid.
the class DrawRectFilter method process.
@Override
public void process(FilterContext env) {
// Get input frame
Frame imageFrame = pullInput("image");
Frame boxFrame = pullInput("box");
// Get the box
Quad box = (Quad) boxFrame.getObjectValue();
box = box.scaled(2.0f).translated(-1.0f, -1.0f);
// Create output frame with copy of input
GLFrame output = (GLFrame) env.getFrameManager().duplicateFrame(imageFrame);
// Draw onto output
output.focus();
renderBox(box);
// Push output
pushOutput("image", output);
// Release pushed frame
output.release();
}
Aggregations