Skip to content

Feat(canvas): add transparency locking support for gradients#9226

Open
DustyShoe wants to merge 4 commits into
invoke-ai:mainfrom
DustyShoe:feat(canvas)-add-transparency-locking-support-for-gradients
Open

Feat(canvas): add transparency locking support for gradients#9226
DustyShoe wants to merge 4 commits into
invoke-ai:mainfrom
DustyShoe:feat(canvas)-add-transparency-locking-support-for-gradients

Conversation

@DustyShoe
Copy link
Copy Markdown
Collaborator

Summary

This PR adds transparency lock support to the canvas Gradient tool for raster layers, so gradients now match Brush behavior when a layer is transparency locked.

2026-05-23.09-37-53.mp4

When the active raster layer has Transparency Lock enabled, both Linear and Radial gradients are applied with source-atop, which keeps the effect inside already-opaque pixels and leaves fully transparent regions untouched.

The change also:

  • centralizes transparency-lock composite operation selection
  • carries the composite operation through gradient buffer state and rendering
  • adds focused Vitest coverage for the new behavior
  • updates the Gradient Tool docs

Related Issues / Discussions

N/A

QA Instructions

  1. Open the canvas and select a raster layer that has painted content plus surrounding transparent space.
  2. Enable Transparency Lock on that layer.
  3. Use the Gradient tool in Linear mode and drag across both painted and transparent regions.
  4. Confirm the gradient only affects existing opaque pixels and does not fill transparent areas.
  5. Repeat in Radial mode and confirm the same behavior.
  6. Disable Clip Gradient and confirm the transparency-lock behavior still holds across the full bbox.

Validated with:

  • cd invokeai/frontend/web && pnpm exec vitest run
  • cd invokeai/frontend/web && pnpm build
  • cd docs && pnpm build

Merge Plan

Normal merge. This is a frontend-and-docs-only change with no backend, schema, or redux slice migration requirements.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions Bot added frontend PRs that change frontend files docs PRs that change docs labels May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs PRs that change docs frontend PRs that change frontend files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant