Class RasterStyle.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
RasterStyle
The default raster style has a white modulation color, with brightness, contrast and transparency values all equal to 1.
Example usage:
var rasterStyle = RasterStyle.newBuilder().opacity(0.5).contrast(0.7).build();
- Since:
- 2023.1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbrightness
(double brightness) Sets the brightness.build()
Returns a newly created raster style, based on the properties set on this builder.void
close()
contrast
(double contrast) Sets the contrast.protected void
finalize()
modulationColor
(android.graphics.Color color) Sets the color that is modulated with the raster.opacity
(double opacity) Sets the opacity of the raster.
-
Constructor Details
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
build
Returns a newly created raster style, based on the properties set on this builder.- Returns:
- a newly created raster style, based on the properties set on this builder.
-
opacity
Sets the opacity of the raster.This can also be achieved by setting a modulation color with opacity directly. When both opacity and a modulation color are set, the opacity set using this method takes precedence over that of the modulation color.
This parameter is optional. If not set, default is 1.
- Parameters:
opacity
- the alpha value. Must be contained in the[0, 1]
interval (0 is fully transparent, 1 is fully opaque).- Returns:
- this builder.
- Throws:
IllegalArgumentException
- when opacity < 0 or opacity > 1.
-
brightness
Sets the brightness.The brightness is a value in
[0, 2]
. A value of 1 (the default) leaves the brightness unchanged. Values larger than 1 makes the colors brighter, while a value smaller than 1 makes the colors less bright.This parameter is optional. If not set, default is 1.
- Parameters:
brightness
- the brightness- Returns:
- this builder.
- Throws:
IllegalArgumentException
- when brightness < 0 or brightness > 2.
-
contrast
Sets the contrast.The contrast is a value in
[0, 2]
. A value of 1 (the default) leaves the contrast unchanged. A value larger than 1 enhances the contrast of dark colors by making them brighter, while a value smaller than 1 enhances the contrast of bright colors by making them darker.This parameter is optional. If not set, default is 1.
- Parameters:
contrast
- the contrast- Returns:
- this builder.
- Throws:
IllegalArgumentException
- when contrast < 0 or contrast > 2.
-
modulationColor
Sets the color that is modulated with the raster.For example using a raster with gray-scale colors and a red modulation color will result in a resulting painted raster with red hues.
Using a white color has no effect.
This parameter is optional. If not set, default is white.
- Parameters:
color
- the modulation color- Returns:
- this builder.
-