Class RasterStyle.Builder

java.lang.Object
com.luciad.layers.styles.RasterStyle.Builder
All Implemented Interfaces:
AutoCloseable
Enclosing class:
RasterStyle

public static final class RasterStyle.Builder extends Object implements AutoCloseable
Builder for raster styles.

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 Details Link icon

  • Method Details Link icon

    • finalize Link icon

      protected void finalize()
      Overrides:
      finalize in class Object
    • close Link icon

      public void close()
      Specified by:
      close in interface AutoCloseable
    • build Link icon

      @NotNull public RasterStyle 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 Link icon

      @NotNull public RasterStyle.Builder opacity(double opacity) throws IllegalArgumentException
      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 Link icon

      @NotNull public RasterStyle.Builder brightness(double brightness) throws IllegalArgumentException
      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 Link icon

      @NotNull public RasterStyle.Builder contrast(double contrast) throws IllegalArgumentException
      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 Link icon

      @NotNull public RasterStyle.Builder modulationColor(@NotNull android.graphics.Color color)
      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.