Skip to content

feat(canvas): add per-layer lock transparency option#8943

Open
Pfannkuchensack wants to merge 1 commit intoinvoke-ai:mainfrom
Pfannkuchensack:feat/lock_transparency
Open

feat(canvas): add per-layer lock transparency option#8943
Pfannkuchensack wants to merge 1 commit intoinvoke-ai:mainfrom
Pfannkuchensack:feat/lock_transparency

Conversation

@Pfannkuchensack
Copy link
Collaborator

Summary

Add a "Lock Transparency" toggle to raster layers that preserves the alpha channel when painting. When enabled, brush strokes use source-atop compositing to only paint on existing non-transparent pixels, similar to Photoshop's "Lock Transparent Pixels" feature.

Closes #7321

Related Issues / Discussions

QA Instructions

  1. Create a raster layer and paint something on it
  2. Toggle the new "Lock Transparency" button (drop icon) in the raster layer header
  3. Switch to a different color and paint over the layer:
    • Brush should only paint where existing non-transparent pixels are
    • Painting on transparent areas should have no effect
  4. Toggle lock transparency off — normal painting should resume
  5. Test with both regular brush and pressure-sensitive pen input
  6. Test the onStagePointerEnter path: start painting, drag cursor off canvas, drag back on — stroke should respect transparency lock
  7. Verify undo/redo works correctly with locked transparency strokes

Merge Plan

No special merge considerations. isTransparencyLocked is an optional field, so existing state without it will default to undefined/false.

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)

Add a "Lock Transparency" toggle to raster layers that preserves the
alpha channel when painting. When enabled, brush strokes use
'source-atop' compositing to only paint on existing non-transparent
pixels, similar to Photoshop's "Lock Transparent Pixels" feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend PRs that change frontend files v6.13.x

Projects

Status: 6.13.x

Development

Successfully merging this pull request may close these issues.

[enhancement]: Lock transparency on layers

3 participants