ImagePattern

data class ImagePattern(val image: ImageRef, val opacity: Float = 1.0f) : ShapeStyle

The shape is filled with image, repeated as a pattern, drawn at opacity.

What WWK does with it (verified on Android): the image is tiled across the shape and sized in screen pixels — a tile comes out about the size of the image's own pixels, not a fixed geographic size. There is no scale setting: WWK doesn't offer one for patterns. The image is drawn unmodified (no tint) and opacity fades it: 1f is as opaque as the image itself, 0f invisible. (WWK multiplies each image pixel by the fill colour; white with this alpha is what is used, so the image's own transparency still applies on top.)

A pattern wants a small tile, ideally one that repeats seamlessly — a photo repeated as a pattern shows seams and a small crop of it, not the whole picture.

For ImageRef.Url the device must be able to reach it (nothing but http/https is accepted), a host app on a recent Android must itself allow cleartext traffic for plain http, and the image is fetched lazily, so the shape shows nothing until it has downloaded. For ImageRef.Bytes there is no network involved. Where the platform can't decode bytes yet (web and iOS for now), or the bytes aren't a decodable image, a neutral grey placeholder fill is drawn instead of the image.

Constructors

Link copied to clipboard
constructor(image: ImageRef, opacity: Float = 1.0f)
constructor(imageUrl: String, opacity: Float = 1.0f)

A pattern from an http/https URL.

Properties

Link copied to clipboard
Link copied to clipboard