Package com.luciad.imaging
Class TLcdBandColorSemanticsBuilder
java.lang.Object
com.luciad.imaging.TLcdBandColorSemanticsBuilder
Builder for creating
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
- The number of significant bits.
- The component index
>= 0
ALcdBandColorSemantics.Type.ALPHA
at least the following
properties must be configured:
ALcdBandColorSemantics.Type
ALcdBandSemantics.DataType
- The number of significant bits.
ALcdBandColorSemantics.Type.PALETTE_INDEX
at least the following
properties must be configured:
ALcdBandColorSemantics.Type
ALcdBandSemantics.DataType
- The palette.
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();
- Since:
- 2015.0
-
Method Summary
Modifier and TypeMethodDescriptionall
(ALcdBandSemantics aSemantics) Sets all parameters on the builder based on the given semantics.alphaPremultiplied
(boolean aAlphaPremultiplied) Set alpha pre-multiplication.Build semantics for all bands based on the color model.Build semantic for a single band.colorModel
(ColorModel aColorModel) Set theColorModel
on which to base the semantics.colorSpace
(ColorSpace aColorSpace) Set the color space, can benull
.componentIndex
(int aComponentIndex) Set the component index.dataType
(ALcdBandSemantics.DataType aDataType) Set the data type.Create a band color semantics builder.noDataValue
(Number aNoDataValue) Set the 'no data' value.normalized
(boolean aNormalized) Set if the band is normalized.normalizedRangeMaxValue
(Number aNormalizedRangeMaxValue) Set the maximum value of the normalized range.normalizedRangeMinValue
(Number aNormalizedRangeMinValue) Set the minimum value of the normalized range.palette
(IndexColorModel aPalette) Set the palette, can benull
.significantBits
(int aNumSignificantBits) Set the number of significant bits.type
(ALcdBandColorSemantics.Type aType) Set the type of the band.
-
Method Details
-
newBuilder
Create a band color semantics builder.- Returns:
- a new builder instance
-
buildSingleBandSemantic
Build semantic for a single band. If a color model is set on this builder all other parameters, except the color model and component index, will be ignored.- Returns:
- the color semantics for a single band
- Throws:
IllegalArgumentException
- when a combination of parameters set on this builder is invalid
-
buildSemantics
Build semantics for all bands based on the color model. To create the semantics the color model must be set on this builder.- Returns:
- the list of color semantics
- Throws:
IllegalArgumentException
- when no valid color model is set
-
colorModel
Set theColorModel
on which to base the semantics. The followingColorModel
's are supported: In addition the color space type of the color model must be one of the following:- Parameters:
aColorModel
- the color model- Returns:
- this builder
-
componentIndex
Set the component index. For aalpha
orpalette index
band the component index is-1
. For otherALcdBandColorSemantics.Type
the component index must be>= 0
and smaller than the number of bands in theColorSpace
. The default value is-1
.- Parameters:
aComponentIndex
- the component index- Returns:
- this builder
- See Also:
-
type
Set the type of the band.- Parameters:
aType
- the type- Returns:
- this builder
- See Also:
-
colorSpace
Set the color space, can benull
. Default isnull
.- Parameters:
aColorSpace
- the color space ornull
- Returns:
- this builder
- See Also:
-
alphaPremultiplied
Set alpha pre-multiplication. Default isfalse
.- Parameters:
aAlphaPremultiplied
-true
if alpha is pre-multiplied- Returns:
- this builder
- See Also:
-
palette
- Parameters:
aPalette
- the palette ornull
- Returns:
- this builder
- See Also:
-
dataType
Set the data type.- Parameters:
aDataType
- the data type- Returns:
- this builder
- See Also:
-
significantBits
Set the number of significant bits.- Parameters:
aNumSignificantBits
- the number of significant bits- Returns:
- this builder
- See Also:
-
noDataValue
Set the 'no data' value.- Parameters:
aNoDataValue
- the 'no data' value- Returns:
- this builder
- See Also:
-
normalized
Set if the band is normalized. Typically this isfalse
except for bands of typeALcdBandColorSemantics.Type.PALETTE_INDEX
or bands with a floating point data type. The default isfalse
.- Parameters:
aNormalized
-true
if the band is normalized- Returns:
- this builder
- See Also:
-
normalizedRangeMinValue
Set the minimum value of the normalized range. Typically this should be the values from thecolor space
. This is0.0
in most cases. By default the normalized range is based on the data type if the band isnormalized
or otherwise on thecolor space
.- Parameters:
aNormalizedRangeMinValue
- the minimum value of the normalized range- Returns:
- this builder
- See Also:
-
normalizedRangeMaxValue
Set the maximum value of the normalized range. Typically this should be the values from thecolor space
. This is1.0
in most cases. By default the normalized range is based on the data type if the band isnormalized
or otherwise on thecolor space
.- Parameters:
aNormalizedRangeMaxValue
- the maximum value of the normalized range- Returns:
- this builder
- See Also:
-
all
Sets all parameters on the builder based on the given semantics. This is useful for example to create a new semantics that has almost all properties equal to another semantics.- Parameters:
aSemantics
- the semantics to copy- Returns:
this
-