1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 01:29:49 +00:00

Invert colors under Image menu

This commit is contained in:
OverloadedOrama 2019-12-24 19:38:36 +02:00
parent d0c890a63f
commit b8c92f629b

View file

@ -72,6 +72,7 @@ func _ready() -> void:
"Show Guides" : KEY_MASK_CMD + KEY_F "Show Guides" : KEY_MASK_CMD + KEY_F
} }
var image_menu_items := { var image_menu_items := {
"Invert Colors" : 0,
"Outline" : 0 "Outline" : 0
} }
var help_menu_items := { var help_menu_items := {
@ -339,7 +340,17 @@ func view_menu_id_pressed(id : int) -> void:
func image_menu_id_pressed(id : int) -> void: func image_menu_id_pressed(id : int) -> void:
match id: match id:
0: # Outline 0: # Invert Colors
var image : Image = Global.canvas.layers[Global.canvas.current_layer_index][0]
Global.canvas.handle_undo("Draw")
for xx in image.get_size().x:
for yy in image.get_size().y:
var px_color = image.get_pixel(xx, yy).inverted()
if px_color.a == 0:
continue
image.set_pixel(xx, yy, px_color)
Global.canvas.handle_redo("Draw")
1: # Outline
$OutlineDialog.popup_centered() $OutlineDialog.popup_centered()
func help_menu_id_pressed(id : int) -> void: func help_menu_id_pressed(id : int) -> void: