ImageFillRasterizer

Turns "this picture, fitted this way into this shape" into pixels: the picture placed in the shape's bounding box and cut to the shape (anti-aliased), everything outside it transparent. The result is meant to be laid on the globe over exactly that box, where latitude and longitude are linear in the pixel grid. Pure Kotlin so it behaves the same on every target and is testable without a map.

Functions

Link copied to clipboard
fun render(source: PixelImage, rings: List<List<GeoPosition>>, fit: ImageFit, scale: Float, opacity: Float, maxDimension: Int, background: ColorRgba? = null, repeat: Boolean = false, anchorX: Float? = null, anchorY: Float? = null, extendEdges: Boolean = false, edgeSoftness: Float = 0.0f): RasterizedFill?

rings are the shape's outlines, filled with the even-odd rule — a ring inside another is a hole, so this handles multi-part shapes and shapes with holes. Returns null if there is nothing to draw: no area, or a longitude span over 180 degrees (a shape across the antimeridian would need its box split).