def cover.image.clip

gralha-svg-render@0.1.0.1 · svg.bend:4390

import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base

4390# An image's own rectangle joins the scene clip, so its edges get coverage like
4391# any shape (the bitmap read clamps to its edge pixels); iv maps device to local.
4392def cover.image.clip(+brush: Brush, clip: Clip, +iv: Matrix, +frame: Raster, +sub: U32) -> Clip:
4393  match brush:
4394    case Bitmap{raster, inv, nearest}:
4395      +to = matrix.mul(inv, iv)
4396      +rect = cover.image.rect(raster)
4397      ClipIntersect{clip, ClipShape{edge.tree(rect), to, False{}, cover.edges(rect, matrix.inverse(to), False{}, frame, sub, True{})}}
4398    case _: clip

Uses (11)

Used by (1)