use of android.filterfw.geometry.Quad in project android_frameworks_base by crdroidandroid.
the class CropFilter method process.
@Override
public void process(FilterContext env) {
// Get input frame
Frame imageFrame = pullInput("image");
Frame boxFrame = pullInput("box");
createProgram(env, imageFrame.getFormat());
// Get the box
Quad box = (Quad) boxFrame.getObjectValue();
// Create output format
MutableFrameFormat outputFormat = imageFrame.getFormat().mutableCopy();
outputFormat.setDimensions(mOutputWidth == -1 ? outputFormat.getWidth() : mOutputWidth, mOutputHeight == -1 ? outputFormat.getHeight() : mOutputHeight);
// Create output frame
Frame output = env.getFrameManager().newFrame(outputFormat);
// Set the program parameters
if (mProgram instanceof ShaderProgram) {
ShaderProgram shaderProgram = (ShaderProgram) mProgram;
shaderProgram.setSourceRegion(box);
}
mProgram.process(imageFrame, output);
// Push output
pushOutput("image", output);
// Release pushed frame
output.release();
}
use of android.filterfw.geometry.Quad 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