fromBitmap

fun fromBitmap(bitmap: Bitmap, anchor: Point? = null, scaledSize: Size? = null): Icon

Build an Icon from an in-memory Bitmap.

The bitmap's pixel buffer is hashed (SHA-1) once at construction to mint a stable cache key — for a 512×512 ARGB icon that's roughly 1 MB hashed per call, so prefer reusing the returned Icon over rebuilding it.

val icon = Icon.fromBitmap(myBitmap, anchor = Point(0.5f, 1f))

Parameters

bitmap

source bitmap, used as the marker image as-is

anchor

anchor in pixels from the icon's top-left corner

scaledSize

display size in pixels (null keeps the bitmap's intrinsic size)