Skip to content

fix: convert tint to RGBA array in _getTintedImageCanvas#8913

Open
BHARATH0153 wants to merge 1 commit into
processing:mainfrom
BHARATH0153:fix/tint-2d
Open

fix: convert tint to RGBA array in _getTintedImageCanvas#8913
BHARATH0153 wants to merge 1 commit into
processing:mainfrom
BHARATH0153:fix/tint-2d

Conversation

@BHARATH0153

@BHARATH0153 BHARATH0153 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Resolves #8910

Changes

tint() stores a p5.Color object but _getTintedImageCanvas() reads it as a plain array with numeric indices and .slice(). A p5.Color has no numeric indices, so states.tint[3] returns undefined, giving ctx.globalAlpha = NaN which the canvas ignores — tint appears as a no-op.

convert the stored color to its RGBA array via ._array at the top of _getTintedImageCanvas() before using array operations.

PR Checklist

  • npm run lint passes
  • Inline reference is included / updated
  • Unit tests are included / updated

@BHARATH0153

Copy link
Copy Markdown
Contributor Author

@davepagurek @perminder-17 please review

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.

[p5.js 2.0+ Bug Report]: tint() has no effect on images in 2D mode (states.tint is a p5.Color but read as an array → globalAlpha = NaN)

1 participant