BlurEffect

@Immutable
class BlurEffect(radiusX: Float, radiusY: Float = radiusX, edgeTreatment: TileMode = TileMode.Clamp) : RenderEffect

Blurs the recording of the ImageLayer it is set on, by radiusX across and radiusY down.

A radius is how far each pixel is spread, as in SwingModifier.blur, in the recording's own units: a recording made at a scale of 2.0, or aligned to a destination scaled by two, is blurred across twice as many pixels. A radius of 0f or less leaves that direction sharp; any radius above that spreads it, however slightly. A recording aligned to a destination is blurred along the device's axes, so under a rotated destination radiusX and radiusY do not follow the destination's own axes.

edgeTreatment decides what the blur reads past the recording's edges: TileMode.Clamp repeats the edge pixels, so the blur stays within the recording and keeps it opaque to its edges; TileMode.Decal reads transparency, so the recording fades out at its edges and the blur spreads past them.

On a screen scaled by d, this blur is 0.5 * (d - 1) device pixels wider than Compose Multiplatform's, which adds its rounding offset directly in device pixels rather than scaling it with the recording.

Effects are equal when their radii and edge treatment are.

Parameters

radiusX

how far the blur spreads each pixel across.

radiusY

how far the blur spreads each pixel down. Defaults to radiusX.

edgeTreatment

what the blur reads past the recording's edges. Defaults to TileMode.Clamp.

Throws

Constructors

Link copied to clipboard
constructor(radiusX: Float, radiusY: Float = radiusX, edgeTreatment: TileMode = TileMode.Clamp)

Functions

Link copied to clipboard
open override fun createOp(scale: Double): BufferedImageOp

The op to apply to a recording of scale device pixels per user-space unit: its width in pixels over its width in user space, or for a recording aligned to a destination, the destination's scale.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun outsets(scale: Double): Insets

How far the output of createOp reaches past the recording on each side, in device pixels at scale; the op's input is grown by as much. Defaults to none.

Link copied to clipboard
open override fun toString(): String