def bounds.transform
gralha-svg-render@0.1.0.1 · svg.bend:2569
import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
2569def bounds.transform(box: Bounds, +mat: Matrix) -> Bounds:
2570 Bounds{x0, y0, x1, y1} = box
2571 +left = x0
2572 +top = y0
2573 +right = x1
2574 +bottom = y1
2575
2576 +a = (left - 0.0001 : F32)
2577 +b = (top - 0.0001 : F32)
2578 +c = (right + 0.0001 : F32)
2579 +d = (bottom + 0.0001 : F32)
2580 U.branch(Bounds, F32.is_gt(left, right) || F32.is_gt(top, bottom), _ => bounds.empty(),
2581 _ => bounds.safe(bounds.point(bounds.point(bounds.point(bounds.point(bounds.empty(), matrix.point(mat, Point{a, b})), matrix.point(mat, Point{c, b})), matrix.point(mat, Point{a, d})), matrix.point(mat, Point{c, d}))))