FilterGraphEffectpublic class FilterGraphEffect extends android.media.effect.FilterEffect Effect subclass for effects based on a single Filter. Subclasses need only invoke the
constructor with the correct arguments to obtain an Effect implementation. |
Fields Summary |
---|
private static final String | TAG | protected String | mInputName | protected String | mOutputName | protected android.filterfw.core.GraphRunner | mRunner | protected android.filterfw.core.FilterGraph | mGraph | protected Class | mSchedulerClass |
Constructors Summary |
---|
public FilterGraphEffect(android.media.effect.EffectContext context, String name, String graphString, String inputName, String outputName, Class scheduler)Constructs a new FilterGraphEffect.
super(context, name);
mInputName = inputName;
mOutputName = outputName;
mSchedulerClass = scheduler;
createGraph(graphString);
|
Methods Summary |
---|
public void | apply(int inputTexId, int width, int height, int outputTexId)
beginGLEffect();
Filter src = mGraph.getFilter(mInputName);
if (src != null) {
src.setInputValue("texId", inputTexId);
src.setInputValue("width", width);
src.setInputValue("height", height);
} else {
throw new RuntimeException("Internal error applying effect");
}
Filter dest = mGraph.getFilter(mOutputName);
if (dest != null) {
dest.setInputValue("texId", outputTexId);
} else {
throw new RuntimeException("Internal error applying effect");
}
try {
mRunner.run();
} catch (RuntimeException e) {
throw new RuntimeException("Internal error applying effect: ", e);
}
endGLEffect();
| private void | createGraph(java.lang.String graphString)
GraphReader reader = new TextGraphReader();
try {
mGraph = reader.readGraphString(graphString);
} catch (GraphIOException e) {
throw new RuntimeException("Could not setup effect", e);
}
if (mGraph == null) {
throw new RuntimeException("Could not setup effect");
}
mRunner = new SyncRunner(getFilterContext(), mGraph, mSchedulerClass);
| public void | release()
mGraph.tearDown(getFilterContext());
mGraph = null;
| public void | setParameter(java.lang.String parameterKey, java.lang.Object value)
|
|