javax.media.jai.operator
Class XorConstDescriptor
java.lang.Object
|
+--javax.media.jai.OperationDescriptorImpl
|
+--javax.media.jai.operator.XorConstDescriptor
- All Implemented Interfaces:
- OperationDescriptor, RegistryElementDescriptor, Serializable
- public class XorConstDescriptor
- extends OperationDescriptorImpl
An OperationDescriptor
describing the "XorConst" operation.
The XorConst operation takes one rendered or renderable image
and an array of integer constants, and performs a bit-wise logical
"xor" between every pixel in the same band of the source and the
constant from the corresponding array entry. If the number of
constants supplied is less than the number of bands of the
destination, then the constant from entry 0 is applied to all the
bands. Otherwise, a constant from a different entry is applied to
each band.
The source image must have an integral data type. By default,
the destination image bound, data type, and number of bands are the
same as the source image.
The following matrix defines the "xor" operation.
Logical "xor"
src | const | Result |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
The destination pixel values are defined by the pseudocode:
if (constants.length < dstNumBands) {
dst[x][y][b] = src[x][y][b] ^ constants[0];
} else {
dst[x][y][b] = src[x][y][b] ^ constants[b];
}
Resource List
Name | Value |
GlobalName | XorConst |
LocalName | XorConst |
Vendor | com.sun.media.jai |
Description | Logically "xors" an image
with constants. |
DocURL | http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/XorConstDescriptor.html |
Version | 1.0 |
arg0Desc | The constants to logically "xor" with. |
Parameter List
Name | Class Type |
Default Value |
constants | int[] |
{0} |
- See Also:
OperationDescriptor
, Serialized Form
Methods inherited from class javax.media.jai.OperationDescriptorImpl |
arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamMaxValue, getParamMinValue, getParamNames, getPropertyGenerators, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isImmediate, isModeSupported, isRenderableSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, validateParameters, validateParameters, validateRenderableArguments, validateRenderableSources, validateSources, validateSources |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XorConstDescriptor
public XorConstDescriptor()
- Constructor.
validateArguments
public boolean validateArguments(String modeName,
ParameterBlock args,
StringBuffer message)
- Validates the input source and parameter.
In addition to the standard checks performed by the
superclass method, this method checks that the source image has
an integral data type and that "constants" has length at least 1.
- Overrides:
validateArguments
in class OperationDescriptorImpl
- Following copied from class:
javax.media.jai.OperationDescriptorImpl
- Parameters:
modeName
- the operation mode nameargs
- Input arguments, including source(s) and/or parameter(s).msg
- A string that may contain error messages.- Throws:
IllegalArgumentException
- if modeName
is null
- See Also:
OperationDescriptorImpl.validateSources(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)
,
OperationDescriptorImpl.validateParameters(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)
create
public static RenderedOp create(RenderedImage source0,
int[] constants,
RenderingHints hints)
- Logically "xors" an image with constants.
Creates a ParameterBlockJAI
from all
supplied arguments except hints
and invokes
JAI.create(String,ParameterBlock,RenderingHints)
.
- Parameters:
source0
- RenderedImage
source 0.constants
- The constants to logically "xor" with.
May be null
.hints
- The RenderingHints
to use.
May be null
.- Returns:
- The
RenderedOp
destination. - Throws:
IllegalArgumentException
- if source0
is null
.- See Also:
JAI
,
ParameterBlockJAI
,
RenderedOp
createRenderable
public static RenderableOp createRenderable(RenderableImage source0,
int[] constants,
RenderingHints hints)
- Logically "xors" an image with constants.
Creates a ParameterBlockJAI
from all
supplied arguments except hints
and invokes
JAI.createRenderable(String,ParameterBlock,RenderingHints)
.
- Parameters:
source0
- RenderableImage
source 0.constants
- The constants to logically "xor" with.
May be null
.hints
- The RenderingHints
to use.
May be null
.- Returns:
- The
RenderableOp
destination. - Throws:
IllegalArgumentException
- if source0
is null
.- See Also:
JAI
,
ParameterBlockJAI
,
RenderableOp