createSwatch

suspend fun createSwatch(screenScale: Float, width: Float? = null, height: Float? = null, backgroundColor: Color = Color.transparent): Result<BitmapDrawable>

Creates a swatch of the symbol. This method will scale the symbol up or down in order to fit it in to the desired width and height of the swatch.

Note: Picture marker symbols without a set width or height are not scaled by the given scale, as a null value is taken to mean "render at native scale".

Return

A Result containing a BitmapDrawable or an error if one occurred.

Since

200.1.0

Parameters

screenScale

The scale factor to assume when interpreting the image data. This value is used to scale symbology when rendering the swatch. The value should be set appropriately in order to render swatches at the correct scale for a given display.

width

The width of the swatch in points.

height

The height of the swatch in points.

backgroundColor

The background color of the swatch. The default is Color.transparent.


suspend fun createSwatch(screenScale: Float, width: Float, height: Float, geometry: Geometry, backgroundColor: Color = Color.transparent): Result<BitmapDrawable>

Creates a swatch of the symbol.

Return

A Result containing a BitmapDrawable or an error if one occurred.

Since

200.1.0

Parameters

screenScale

The scale factor to assume when interpreting the image data. This value is used to scale symbology when rendering the swatch. The value should be set appropriately in order to render swatches at the correct scale for a given display.

width

The width of the swatch in points.

height

The height of the swatch in points.

geometry

The geometry of the symbol to be drawn in the swatch image. The specified geometry is in points, with the point {0,0} located at the center of the swatch image. The X-axis increases towards the right side of the swatch image. The Y-axis increases towards the top of the swatch image. For example, when creating a swatch for a MarkerSymbol, specifying a geometry of {10,10} will draw the marker 10 points up and to the right of the center of the swatch. The geometry type (Point, Polyline, Polygon) should correspond to the symbol type (MarkerSymbol, LineSymbol, FillSymbol). The geometry's spatial reference is ignored.

backgroundColor

The background color of the swatch. The default is Color.TRANSPARENT.