Methods Summary |
---|
public android.filterfw.core.FrameFormat | getOutputFormat(java.lang.String portName, android.filterfw.core.FrameFormat inputFormat)
return inputFormat;
|
public void | initProgram(android.filterfw.core.FilterContext context, int target)
switch (target) {
case FrameFormat.TARGET_GPU:
ShaderProgram shaderProgram = new ShaderProgram(context, mDuotoneShader);
shaderProgram.setMaximumTileSize(mTileSize);
mProgram = shaderProgram;
break;
default:
throw new RuntimeException("Filter Duotone does not support frames of " +
"target " + target + "!");
}
mTarget = target;
|
public void | process(android.filterfw.core.FilterContext context)
// Get input frame
Frame input = pullInput("image");
FrameFormat inputFormat = input.getFormat();
// Create output frame
Frame output = context.getFrameManager().newFrame(inputFormat);
// Create program if not created already
if (mProgram == null || inputFormat.getTarget() != mTarget) {
initProgram(context, inputFormat.getTarget());
}
updateParameters();
// Process
mProgram.process(input, output);
// Push output
pushOutput("image", output);
// Release pushed frame
output.release();
|
public void | setupPorts()
addMaskedInputPort("image", ImageFormat.create(ImageFormat.COLORSPACE_RGBA));
addOutputBasedOnInput("image", "image");
|
private void | updateParameters()
float first[] = { Color.red(mFirstColor)/255f,
Color.green(mFirstColor)/255f,
Color.blue(mFirstColor)/255f };
float second[] = { Color.red(mSecondColor)/255f,
Color.green(mSecondColor)/255f,
Color.blue(mSecondColor)/255f };
mProgram.setHostValue("first", first);
mProgram.setHostValue("second", second);
|