Invert only within Free-Form Select's polygon

It turns out this isn't actually how MS Paint works (in Windows 98, my go-to reference), but, isn't it better this way?
This commit is contained in:
Isaiah Odhner 2023-07-08 01:36:52 -04:00
parent a3e7a2d8b9
commit 505cb389f2
2 changed files with 5 additions and 15 deletions

View File

@ -179,7 +179,6 @@ To preview ANSI art files in file managers like Nautilus, Thunar, Nemo, or Caja,
- Some languages don't display correctly.
- Large files can make the program very slow, as can magnifying the canvas. There is a 500 KB limit when opening files to prevent it from freezing.
- Free-Form Select stamping/finalizing is incorrect when the selection is off-screen to the left or top.
- Image > Invert Colors ignores Free-Form Select's mask region, and acts on the rectangular bound.
- Moving the selection with the arrow keys does not cut out the selection from the canvas, it only moves the selection box.
- Status bar description can be left blank when selecting a menu item <!--I'm guessing Leave can come after close-->
- Menu items like Copy/Cut/Paste are not grayed out when inapplicable. Only unimplemented items are grayed out.

View File

@ -3553,20 +3553,11 @@ Columns: {len(palette) // 2}
if sel.textbox_mode:
return
if sel.contained_image is None:
# TODO: DRY undo state creation (at least the undos/redos part)
# FIXME: handle Free-Form Select's mask
action = Action(_("Invert Colors"), sel.region)
action.update(self.image)
if len(self.redos) > 0:
self.redos = []
self.undos.append(action)
self.image.invert_region(sel.region)
self.canvas.refresh_scaled_region(sel.region)
else:
# No extra undo state if the selection is already cut out
sel.contained_image.invert()
self.canvas.refresh_scaled_region(sel.region)
self.extract_to_selection()
assert sel.contained_image is not None
# Note: no undo state will be created if the selection is already extracted
sel.contained_image.invert()
self.canvas.refresh_scaled_region(sel.region)
else:
# TODO: DRY undo state creation (at least the undos/redos part)
action = Action(_("Invert Colors"), Region(0, 0, self.image.width, self.image.height))