}
@Override
+ public Object getTarget() {
+ try {
+ return mField.get(mFilter);
+ } catch (IllegalAccessException e) {
+ return null;
+ }
+ }
+
+ @Override
public synchronized void transfer(FilterContext context) {
if (mValueWaiting) {
try {
}
/**
+ * Assigns all program variables to the ports they are connected to. Call this after
+ * constructing a Program instance with attached ProgramPorts.
+ */
+ protected void initProgramInputs(Program program, FilterContext context) {
+ if (program != null) {
+ for (InputPort inputPort : mInputPorts.values()) {
+ if (inputPort.getTarget() == program) {
+ inputPort.transfer(context);
+ }
+ }
+ }
+ }
+
+ /**
* Adds an input port to the filter. You should call this from within setupPorts, if your
* filter has input ports. No type-checking is performed on the input. If you would like to
* check against a type mask, use
return mSourcePort != null ? mSourcePort.getPortFormat() : getPortFormat();
}
+ public Object getTarget() {
+ return null;
+ }
+
public boolean filterMustClose() {
return !isOpen() && isBlocking() && !hasFrame();
}
throw new RuntimeException("Could not create a program for image filter "
+ this + "!");
}
- if (mParameterName != null) {
- transferInputPortFrame(mParameterName, context);
- }
+ initProgramInputs(mProgram, context);
mCurrentTarget = target;
}
}
if (mProgram == null) {
throw new RuntimeException("Could not create a program for image filter " + this + "!");
}
- if (mParameterName != null) {
- transferInputPortFrame(mParameterName, context);
- }
+ initProgramInputs(mProgram, context);
mCurrentTarget = target;
}
}