use of android.filterfw.core.Filter in project android_frameworks_base by AOSPA.
the class FilterFunctionEnvironment method createFunction.
/**
* Create a new FilterFunction from a specific filter class. The function is initialized with
* the given key-value list of parameters. Note, that this function uses the default shared
* FilterFactory to create the filter instance.
*
* @param filterClass The class of the filter to wrap. This must be a Filter subclass.
* @param parameters An argument list of alternating key-value filter parameters.
* @return A new FilterFunction instance.
*/
public FilterFunction createFunction(Class filterClass, Object... parameters) {
String filterName = "FilterFunction(" + filterClass.getSimpleName() + ")";
Filter filter = FilterFactory.sharedFactory().createFilterByClass(filterClass, filterName);
filter.initWithAssignmentList(parameters);
return new FilterFunction(getContext(), filter);
}
use of android.filterfw.core.Filter in project platform_frameworks_base by android.
the class BackDropperEffect method setParameter.
@Override
public void setParameter(String parameterKey, Object value) {
if (parameterKey.equals("source")) {
Filter background = mGraph.getFilter("background");
background.setInputValue("sourceUrl", value);
} else if (parameterKey.equals("context")) {
Filter background = mGraph.getFilter("background");
background.setInputValue("context", value);
}
}
use of android.filterfw.core.Filter in project platform_frameworks_base by android.
the class FilterFunctionEnvironment method createFunction.
/**
* Create a new FilterFunction from a specific filter class. The function is initialized with
* the given key-value list of parameters. Note, that this function uses the default shared
* FilterFactory to create the filter instance.
*
* @param filterClass The class of the filter to wrap. This must be a Filter subclass.
* @param parameters An argument list of alternating key-value filter parameters.
* @return A new FilterFunction instance.
*/
public FilterFunction createFunction(Class filterClass, Object... parameters) {
String filterName = "FilterFunction(" + filterClass.getSimpleName() + ")";
Filter filter = FilterFactory.sharedFactory().createFilterByClass(filterClass, filterName);
filter.initWithAssignmentList(parameters);
return new FilterFunction(getContext(), filter);
}
use of android.filterfw.core.Filter in project platform_frameworks_base by android.
the class RoundRobinScheduler method scheduleNextNode.
@Override
public Filter scheduleNextNode() {
Set<Filter> all_filters = getGraph().getFilters();
if (mLastPos >= all_filters.size())
mLastPos = -1;
int pos = 0;
Filter first = null;
int firstNdx = -1;
for (Filter filter : all_filters) {
if (filter.canProcess()) {
if (pos <= mLastPos) {
if (first == null) {
// store the first available filter
first = filter;
firstNdx = pos;
}
} else {
// return the next available filter since last
mLastPos = pos;
return filter;
}
}
pos++;
}
// going around from the beginning
if (first != null) {
mLastPos = firstNdx;
return first;
}
// position.
return null;
}
use of android.filterfw.core.Filter in project android_frameworks_base by crdroidandroid.
the class FilterGraphEffect method apply.
@Override
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();
}
Aggregations