public class TLcdBandColorSemanticsBuilder extends Object
ALcdBandColorSemantics
instances.
This builder can create a list of color semantics for all bands at once, or create
one color semantic for a single band.
When creating semantics for all bands via buildSemantics()
only the
configured ColorModel
is used during the construction of the semantics.
Other configured properties will be ignored, thus only the ColorModel
needs to be
set in this case.
When creating semantics for a single band via buildSingleBandSemantic()
and a ColorModel
has been set, than only the ColorModel
and the
component index are used during the construction of the semantics. If no ColorModel
is set,
at least the following properties must be set for all ALcdBandColorSemantics.Type
except for ALcdBandColorSemantics.Type.ALPHA
and
ALcdBandColorSemantics.Type.PALETTE_INDEX
:
ALcdBandColorSemantics.Type
ALcdBandSemantics.DataType
ColorSpace
ALcdBandColorSemantics.Type.ALPHA
at least the following
properties must be configured:
ALcdBandColorSemantics.Type
ALcdBandSemantics.DataType
ALcdBandColorSemantics.Type.PALETTE_INDEX
at least the following
properties must be configured:
ALcdBandColorSemantics.Type
ALcdBandSemantics.DataType
ColorModel
:
List semantics = TLcdBandColorSemanticsBuilder
.newBuilder()
.colorModel(cm)
.buildSemantics();
Create semantic for a single RED color band using a ColorModel
:
ALcdBandColorSemantics s = TLcdBandColorSemanticsBuilder
.newBuilder()
.colorModel(cm)
.componentIndex(0)
.buildSingleBandSemantic();
Create semantic for a single RED color band without using a ColorModel
:
ALcdBandColorSemantics s = TLcdBandColorSemanticsBuilder
.newBuilder()
.type(ALcdBandColorSemantics.Type.RED)
.dataType(ALcdBandSemantics.DataType.UNSIGNED_INT)
.colorSpace(ColorModel.getRGBdefault().getColorSpace())
.significantBits(16)
.componentIndex(0)
.buildSingleBandSemantic();
Modifier and Type | Method and Description |
---|---|
TLcdBandColorSemanticsBuilder |
all(ALcdBandSemantics aSemantics)
Sets all parameters on the builder based on the given semantics.
|
TLcdBandColorSemanticsBuilder |
alphaPremultiplied(boolean aAlphaPremultiplied)
Set alpha pre-multiplication.
|
List<ALcdBandSemantics> |
buildSemantics()
Build semantics for all bands based on the color model.
|
ALcdBandColorSemantics |
buildSingleBandSemantic()
Build semantic for a single band.
|
TLcdBandColorSemanticsBuilder |
colorModel(ColorModel aColorModel)
Set the
ColorModel on which to base the semantics. |
TLcdBandColorSemanticsBuilder |
colorSpace(ColorSpace aColorSpace)
Set the color space, can be
null . |
TLcdBandColorSemanticsBuilder |
componentIndex(int aComponentIndex)
Set the component index.
|
TLcdBandColorSemanticsBuilder |
dataType(ALcdBandSemantics.DataType aDataType)
Set the data type.
|
static TLcdBandColorSemanticsBuilder |
newBuilder()
Create a band color semantics builder.
|
TLcdBandColorSemanticsBuilder |
noDataValue(Number aNoDataValue)
Set the 'no data' value.
|
TLcdBandColorSemanticsBuilder |
normalized(boolean aNormalized)
Set if the band is normalized.
|
TLcdBandColorSemanticsBuilder |
normalizedRangeMaxValue(Number aNormalizedRangeMaxValue)
Set the maximum value of the normalized range.
|
TLcdBandColorSemanticsBuilder |
normalizedRangeMinValue(Number aNormalizedRangeMinValue)
Set the minimum value of the normalized range.
|
TLcdBandColorSemanticsBuilder |
palette(IndexColorModel aPalette)
Set the palette, can be
null . |
TLcdBandColorSemanticsBuilder |
significantBits(int aNumSignificantBits)
Set the number of significant bits.
|
TLcdBandColorSemanticsBuilder |
type(ALcdBandColorSemantics.Type aType)
Set the type of the band.
|
public static TLcdBandColorSemanticsBuilder newBuilder()
public ALcdBandColorSemantics buildSingleBandSemantic()
IllegalArgumentException
- when a combination of parameters set on this builder is invalidpublic List<ALcdBandSemantics> buildSemantics()
IllegalArgumentException
- when no valid color model is setpublic TLcdBandColorSemanticsBuilder colorModel(ColorModel aColorModel)
ColorModel
on which to base the semantics.
The following ColorModel
's are supported:
In addition the color space type of the color model must be one of the following:
aColorModel
- the color modelpublic TLcdBandColorSemanticsBuilder componentIndex(int aComponentIndex)
alpha
or palette index
band the component index is -1
. For other ALcdBandColorSemantics.Type
the
component index must be >= 0 and smaller than the number of bands in the ColorSpace
.
The default value is -1
.aComponentIndex
- the component indexALcdBandColorSemantics.getComponentIndex()
public TLcdBandColorSemanticsBuilder type(ALcdBandColorSemantics.Type aType)
aType
- the typeALcdBandColorSemantics.getType()
public TLcdBandColorSemanticsBuilder colorSpace(ColorSpace aColorSpace)
null
.
Default is null
.aColorSpace
- the color space or null
ALcdBandColorSemantics.getColorSpace()
public TLcdBandColorSemanticsBuilder alphaPremultiplied(boolean aAlphaPremultiplied)
false
.aAlphaPremultiplied
- true
if alpha is pre-multipliedALcdBandColorSemantics.isAlphaPremultiplied()
public TLcdBandColorSemanticsBuilder palette(IndexColorModel aPalette)
aPalette
- the palette or null
ALcdBandColorSemantics.getPalette()
public TLcdBandColorSemanticsBuilder dataType(ALcdBandSemantics.DataType aDataType)
aDataType
- the data typeALcdBandSemantics.getDataType()
public TLcdBandColorSemanticsBuilder significantBits(int aNumSignificantBits)
aNumSignificantBits
- the number of significant bitsALcdBandSemantics.getNumSignificantBits()
public TLcdBandColorSemanticsBuilder noDataValue(Number aNoDataValue)
aNoDataValue
- the 'no data' valueALcdBandSemantics.getNoDataValue()
public TLcdBandColorSemanticsBuilder normalized(boolean aNormalized)
false
except for bands of type ALcdBandColorSemantics.Type.PALETTE_INDEX
or bands with a floating point data type.
The default is false
.aNormalized
- true
if the band is normalizedALcdBandSemantics.isNormalized()
public TLcdBandColorSemanticsBuilder normalizedRangeMinValue(Number aNormalizedRangeMinValue)
color space
. This
is 0.0
in most cases.
By default the normalized range is based on the data type if the band is normalized
or
otherwise on the color space
.aNormalizedRangeMinValue
- the minimum value of the normalized rangeALcdBandSemantics.getNormalizedRangeMinValue()
public TLcdBandColorSemanticsBuilder normalizedRangeMaxValue(Number aNormalizedRangeMaxValue)
color space
. This
is 1.0
in most cases.
By default the normalized range is based on the data type if the band is normalized
or
otherwise on the color space
.aNormalizedRangeMaxValue
- the maximum value of the normalized rangeALcdBandSemantics.getNormalizedRangeMaxValue()
public TLcdBandColorSemanticsBuilder all(ALcdBandSemantics aSemantics)
aSemantics
- the semantics to copythis