Skip to content

feat(flare): stage path conversion to CoreGraphics - #756

Merged
github-actions[bot] merged 1 commit into
devfrom
lead/mac-platform-mp4
Oct 14, 2026
Merged

github-actions[bot] merged 1 commit into
devfrom
lead/mac-platform-mp4

Conversation

@prakashUXtech

@prakashUXtech prakashUXtech commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

MP-4 of the mac-platform feature (docs/blueprints/flare/features/mac-platform.md). Closes #370.

What changed

  • New Sources/FlareApp/StagePath.swift: enum StagePath with
    • static func cgPath(_ path: FlarePath, transform: Matrix) -> CGPath: every FlareCore element maps to one CG element (cubic → one addCurve, quad → one addQuadCurve, line → one addLine, move and close kept). Points go through Matrix.apply first. Any element with a non-finite coordinate after the transform is skipped (no crash); a drawing element that then has no current point starts its subpath at its end point, and a close with no current point is dropped.
    • static func cgColor(_ color: FlareColor) -> CGColor via CGColor(srgbRed:green:blue:alpha:).
    • Imports only CoreGraphics, FlareCore and FlareModel (no SwiftUI), wrapped in #if canImport(CoreGraphics).
  • docs/c4/model.json: the flare-app-sources description now mentions StagePath.

Why

Stage drawing (journey step 6 of the packet, and every stage golden) needs curves to reach CoreGraphics as curves, not flattened polylines, and needs non-finite data never to crash the draw.

Proof

Tests/AppSnapshotTests/StagePathTests.swift (Swift Testing, macOS only):

  • cubicsStayCurves: an ellipse built as 4 cubics gives exactly 4 addCurveToPoint; a pen path with 2 cubics and 1 line gives 2 addCurveToPoint and 1 addLineToPoint (counted with CGPath.applyWithBlock).
  • translationMovesTheBounds: a translate-by-(10, 20) matrix moves boundingBoxOfPath by (10, 20).
  • colorIsSRGB: cgColor of (1, 0.5, 0, 0.25) is in the sRGB color space with those components.
  • nonFinitePointIsSkipped, skippedMoveStartsAtTheNextPoint, emptyPathIsEmpty.

Linux scripts/ci prints CI: PASS (lints, C4, Model tests). The new files compile only in the macOS job on dev. No snapshot PNGs change.

CoreGraphics APIs checked with the apple-docs MCP before use: CGMutablePath.addCurve(to:control1:control2:transform:) (and the move/addLine/addQuadCurve/closeSubpath siblings it lists), CGColor.init(srgbRed:green:blue:alpha:), CGPath.applyWithBlock(_:), CGPathElementType, CGPath.boundingBoxOfPath, CGColor.components, CGColorSpace.name, CGColorSpace.sRGB.

Belt-Lead: act-1a13b14336c-tqna
Feature: mac-platform
Fast-Check: pass
Head: 86fe480


@prakashUXtech prakashUXtech added the fast-lane Merge automatically when small, green and outside protected paths label Oct 14, 2026 — with Claude
@github-actions
github-actions Bot merged commit 9e55f58 into dev Oct 14, 2026
1 check passed
@github-actions github-actions Bot added the fast-lane-merged Merged by the fast lane; review after the fact label Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Fast lane: merged into dev (171 lines, 3 files, Fast-Check marker).

@github-actions github-actions Bot mentioned this pull request Oct 14, 2026
github-actions Bot pushed a commit that referenced this pull request Oct 14, 2026
## What and why

The last PR of the mac-platform feature (#793, resumes #754). It records that the packet is built and carries `feature-done`, so the lane dispatches the full CI run on `dev` that judges the feature.

- `docs/blueprints/flare/features/mac-platform.md`: a **Status** line naming the merged task PRs (MP-1 #757, MP-2 #759, MP-3 #760, MP-4 #756, MP-5 #761, MP-6 #762), the round-1 test fix #764, and the feature issue #793. Nothing is wired into the window yet; F17a #205 and F17c #393 add the menu and the restore alert.
- `docs/blueprints/flare/features/waves.md`: the wave-1 row's feature issue is now #793 (built).

No CI run has judged the feature since 4594082. #801 fixed FlareModel's build against creative-core main, which had broken every Linux build of `dev`.

## Proof

Docs only. `scripts/ci`: CI: PASS (1414 tests) on this head, rebased on 11e3e0c (#801).

Snapshot PNGs changed: none.

Refs #793

Belt-Lead: act-1a13c789856-0qa9
Feature: mac-platform
Fast-Check: pass
Head: e3c132f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fast-lane Merge automatically when small, green and outside protected paths fast-lane-merged Merged by the fast lane; review after the fact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flare LA-0: StagePath: Path and Matrix to CGPath, colors to CGColor(srgbRed:…)

1 participant