You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Canvas: tint an image, or composite in a layer of its own #1111
Found while building sprites for nsgo-dev/game#4; part of #1047. A Drawing has composite modes (internal/driver/canvas.go:249-274) but no transparency layer or offscreen target, so a multiply tint mixes with everything already drawn under the image: an image cannot be tinted on its own. #565 covers rendering a whole Drawing to pixels, not a layer within one.
Proposal
Either a per-draw tint on DrawImage* (multiply by a color, as Core Graphics' clip-to-mask plus fill, Direct2D's tint effect, Cairo's mask, Android's ColorFilter and the web's offscreen canvas do), or Drawing.BeginLayer(alpha)/EndLayer(), as CanvasKit's saveLayer and Core Graphics' transparency layers. The first is enough for sprites; the second also gives group opacity.
Acceptance
A tinted image draws the same on every target, checked by pixel comparison, without changing what was drawn under it.
Landed in #1200: DrawTintedImage, DrawTintedImageIn and DrawTintedImageFrom (drawTintedImage in TSX) multiply an image's sRGB and alpha by a color before compositing, without touching what is under it. Apple, Windows, Linux, Android and the web support it, the capture test TestCanvasImageTint runs in CI on those targets, and canvas.md and the public docs describe it.
Still open: HarmonyOS draws tinted images untinted. The ArkTS host needs to multiply the pixels and the committed host needs a rebuild (roadmap row "Canvas image tint"). Device verification can follow after that.
HarmonyOS tinting landed in #2016 (the #2003 patch plus the rebuilt committed host), so DrawTintedImage, DrawTintedImageIn and DrawTintedImageFrom now tint on every target: #1200 covered Apple, Windows, Linux, Android and the web, with TestCanvasImageTint in CI.
Remaining, device-only: run the shared tint pixel test (its encoded case) on a HarmonyOS emulator or device (roadmap row "Canvas image tint").
Activity
houko commentedon Nov 22, 2026
Landed in #1200:
DrawTintedImage,DrawTintedImageInandDrawTintedImageFrom(drawTintedImagein TSX) multiply an image's sRGB and alpha by a color before compositing, without touching what is under it. Apple, Windows, Linux, Android and the web support it, the capture test TestCanvasImageTint runs in CI on those targets, and canvas.md and the public docs describe it.Still open: HarmonyOS draws tinted images untinted. The ArkTS host needs to multiply the pixels and the committed host needs a rebuild (roadmap row "Canvas image tint"). Device verification can follow after that.
houko commentedon Nov 23, 2026
HarmonyOS tinting landed in #2016 (the #2003 patch plus the rebuilt committed host), so
DrawTintedImage,DrawTintedImageInandDrawTintedImageFromnow tint on every target: #1200 covered Apple, Windows, Linux, Android and the web, with TestCanvasImageTint in CI.Remaining, device-only: run the shared tint pixel test (its
encodedcase) on a HarmonyOS emulator or device (roadmap row "Canvas image tint").feat(sprite): tint sprites and particles
feat(sprite): tint sprites and particles
feat(sprite): tint sprites and particles