Skip to content

feat(canvas): draw canvases at a resolution scale below the display's density - #2511

Merged
oneo-me merged 1 commit into
mainfrom
agiox/canvas-resolution-scale
Nov 26, 2026
Merged

oneo-me merged 1 commit into
mainfrom
agiox/canvas-resolution-scale

Conversation

@oneo-me

@oneo-me oneo-me commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #2261

Adds Canvas.ResolutionScale / ResolutionScaleFunc and Canvas.Sampling / SamplingFunc, to draw a canvas below the display's pixel density and stretch it to its box.

  • The factor and sampling travel on the drawing (driver.Drawing.Resolution, Upscale); a change resends the same ops without rerunning Draw. Values outside (0, 1) keep today's behaviour.
  • Each backend multiplies the raster scale it already has (zoom and transform steps included) by the factor: Apple (content layer contentsScale + magnification filter), Android (backing bitmap + paint filtering), Windows (own Direct2D bitmap, linear/nearest), Linux (lower Cairo surface, one GSK scaled texture), the web (<canvas> backing size + image-rendering), watchOS (CGLayer) and mini programs (offscreen canvas size).
  • Hit tests, OnPress and Size stay in points.
  • nsgotest: View.ResolutionScale, View.CanvasSampling and App.CanvasScale(selector).
  • Tests: the shared canvastest.Resolution sample, checked with smooth and nearest sampling on Apple, Windows (run on a Windows 11 device), Linux (run on a Linux device), the web and Android (emulator capture test, added to the emulator job); mini program and nsgotest unit tests.
  • Roadmap: HarmonyOS (needs its ArkTS host to draw offscreen) and a matching gpu.View option.

🤖 Claude Opus 5.5

🤖 Generated with Claude Code

@oneo-me oneo-me self-assigned this Nov 26, 2026
@github-actions github-actions Bot added enhancement New feature or request size/XS labels Nov 26, 2026
… density

Closes #2261

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oneo-me
oneo-me force-pushed the agiox/canvas-resolution-scale branch from 09102c0 to 9a7bf1d Compare November 26, 2026 11:56
@oneo-me
oneo-me marked this pull request as ready for review November 26, 2026 11:56
@oneo-me
oneo-me merged commit b78d869 into main Nov 26, 2026
70 of 74 checks passed
@oneo-me
oneo-me deleted the agiox/canvas-resolution-scale branch November 26, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: Canvas has no resolution scale to draw below the display's pixel density and upscale

1 participant