Skip to content

feat: ctxFillRadialGradient fills canvas's two-circle radial gradient through CGContextDrawRadialGradient, through the current path or a rect, where a renderer had no radial fill to hand one to and drew every radial gradient flat - #121

Merged
sidorares merged 1 commit into
mainfrom
feat/radial-gradient
Oct 8, 2026

Conversation

@sidorares

@sidorares sidorares commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

react-x11's macOS context answered createRadialGradient with a linear gradient along no line, because the bridge had no radial fill to hand one to. Every radial gradient a page drew there came out flat, and <Html> drew none: melbcss.com's liquid glass theme lost the six orbs behind its cards, and the knob of its toggle.

ctxFillRadialGradient(surface, x0, y0, r0, x1, y1, r1, stops, x?, y?, w?, h?) fills canvas's two-circle radial gradient through CGContextDrawRadialGradient, whose two-circle model is canvas's, its end colours carried on past both circles as canvas extends them. Like ctxFillLinearGradient, it fills the current path and keeps it, or the rect that follows the stops. The stop list and the clip are now shared by the two fills.

test/radial-gradient.js checks the start colour at the centre, the end colour at the end circle and past it, a mix halfway out, the rect form filling only its rect, the path form filling the path and keeping it, and circles off the middle moving the colours with them.

The react-x11 side is sidorares/react-x11#926: createRadialGradient uses this where the bridge has it, and keeps the flat stand-in where it does not.

… through CGContextDrawRadialGradient, through the current path or a rect, where a renderer had no radial fill to hand one to and drew every radial gradient flat
@sidorares
sidorares merged commit 4665335 into main Oct 8, 2026
4 checks passed
sidorares added a commit to sidorares/react-x11 that referenced this pull request Oct 9, 2026
…n a Mac and clipboard.write() copies an image there, where 2.47.0's range admitted no bridge with ctxFillRadialGradient or pasteboardWrite (#928)

#926 draws canvas's two-circle radial gradient through
ctxFillRadialGradient, and #892 puts every flavour of a clipboard.write()
on the pasteboard through pasteboardWrite. Both calls are new in
@windowkit/appkit 0.28.0 (windowkit/appkit#121, #119), and the range
stayed at ^0.27.0, which on 0.x admits no 0.28. So every install of
2.47.0 resolves 0.27.0: createRadialGradient keeps the flat stand-in, and
a write with more than text is refused, while the code that draws and
copies them shipped.

Found from react-x11-components' browser example, whose lockfile took
2.47.0 for its filter: blur() and still drew reactmelbourne.com's and
melbcss.com's radial gradients flat on macOS.

test/cocoa-radial-gradient.test.js already holds the real bridge to the
gradient's colours, and skips where the bridge has no
ctxFillRadialGradient, which is CI and 0.27.0: on a Mac it runs on
0.28.0 and passes. All 611 Cocoa tests pass on 0.28.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant