Skip to content

Feat(canvas): Add transparency lock for Gradients and Shapes. Extend Clip Strokes to Bbox to Rect/Oval shapes.#9250

Open
DustyShoe wants to merge 9 commits into
invoke-ai:mainfrom
DustyShoe:Feature/clip-shapes-to-bbox
Open

Feat(canvas): Add transparency lock for Gradients and Shapes. Extend Clip Strokes to Bbox to Rect/Oval shapes.#9250
DustyShoe wants to merge 9 commits into
invoke-ai:mainfrom
DustyShoe:Feature/clip-shapes-to-bbox

Conversation

@DustyShoe
Copy link
Copy Markdown
Collaborator

Summary

This PR adds transparency lock support to the canvas Gradient and Shapes tools for raster layers, so they 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.

Shapes now also respect Transparency Lock in Rect, Oval, Polygon, and Freehand modes. Normal shape drawing uses source-atop on transparency-locked raster layers, while subtractive shape drawing still uses destination-out so it can clear existing pixels as expected.

Just for clarity: I merged the previously created Gradient transparency lock PR into this PR so the Gradient and Shapes transparency-lock changes can ship together.

The change also:

  • centralizes transparency-lock composite operation selection
  • carries the composite operation through gradient buffer state and rendering
  • adds shape-specific composite operation selection for transparency-locked raster layers
  • extends the existing Clip Strokes to Bbox behavior to Rect and Oval shapes
  • fixes pixel bbox detection for clipped and transparency-locked canvas objects
  • adds focused Vitest coverage for the new Gradient and Shapes behavior
  • updates the Gradient Tool and Shapes Tool docs
  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.
  7. Switch to the Shapes tool and test Rect, Oval, Polygon, and Freehand modes across painted and transparent regions.
  8. Confirm normal shape drawing only affects existing opaque pixels when Transparency Lock is enabled.
  9. Hold Ctrl/Cmd with the Shapes tool and confirm subtractive mode still clears existing pixels.
  10. Enable Clip Strokes to Bbox and confirm Rect and Oval shapes are clipped to the generation bbox.

Merge Plan

Normal merge. This is a frontend-and-docs-only change with no backend or API schema changes. The canvas object state changes are backward-compatible and do not require a separate redux migration.

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 29, 2026
@lstein lstein added the 6.14.x label May 29, 2026
@lstein lstein moved this to 6.14.x Theme: USER EXPERIENCE in Invoke - Community Roadmap May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.14.x docs PRs that change docs frontend PRs that change frontend files

Projects

Status: 6.14.x Theme: USER EXPERIENCE

Development

Successfully merging this pull request may close these issues.

3 participants