mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Fixed image effects
Also replaced flip_image_horizontal() and flip_image_vertical() with just flip_image()
This commit is contained in:
parent
54b628f6cb
commit
7371cd79e4
36
src/Main.gd
36
src/Main.gd
|
@ -436,33 +436,27 @@ func crop_image() -> void:
|
|||
Global.undo_redo.commit_action()
|
||||
|
||||
|
||||
func flip_image_horizontal() -> void:
|
||||
var canvas : Canvas = Global.canvas
|
||||
canvas.handle_undo("Draw")
|
||||
canvas.layers[Global.current_layer].image.unlock()
|
||||
canvas.layers[Global.current_layer].image.flip_x()
|
||||
canvas.layers[Global.current_layer].image.lock()
|
||||
canvas.handle_redo("Draw")
|
||||
|
||||
|
||||
func flip_image_vertical() -> void:
|
||||
var canvas : Canvas = Global.canvas
|
||||
canvas.handle_undo("Draw")
|
||||
canvas.layers[Global.current_layer].image.unlock()
|
||||
canvas.layers[Global.current_layer].image.flip_y()
|
||||
canvas.layers[Global.current_layer].image.lock()
|
||||
canvas.handle_redo("Draw")
|
||||
func flip_image(horizontal : bool) -> void:
|
||||
var image : Image = Global.frames[Global.current_frame].cels[Global.current_layer].image
|
||||
Global.canvas.handle_undo("Draw")
|
||||
image.unlock()
|
||||
if horizontal:
|
||||
image.flip_x()
|
||||
else:
|
||||
image.flip_y()
|
||||
image.lock()
|
||||
Global.canvas.handle_redo("Draw")
|
||||
|
||||
|
||||
func show_rotate_image_popup() -> void:
|
||||
var image : Image = Global.canvas.layers[Global.current_layer].image
|
||||
var image : Image = Global.frames[Global.current_frame].cels[Global.current_layer].image
|
||||
$RotateImage.set_sprite(image)
|
||||
$RotateImage.popup_centered()
|
||||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func invert_image_colors() -> void:
|
||||
var image : Image = Global.canvas.layers[Global.current_layer].image
|
||||
var image : Image = Global.frames[Global.current_frame].cels[Global.current_layer].image
|
||||
Global.canvas.handle_undo("Draw")
|
||||
for xx in image.get_size().x:
|
||||
for yy in image.get_size().y:
|
||||
|
@ -474,7 +468,7 @@ func invert_image_colors() -> void:
|
|||
|
||||
|
||||
func desaturate_image() -> void:
|
||||
var image : Image = Global.canvas.layers[Global.current_layer].image
|
||||
var image : Image = Global.frames[Global.current_frame].cels[Global.current_layer].image
|
||||
Global.canvas.handle_undo("Draw")
|
||||
for xx in image.get_size().x:
|
||||
for yy in image.get_size().y:
|
||||
|
@ -508,10 +502,10 @@ func image_menu_id_pressed(id : int) -> void:
|
|||
crop_image()
|
||||
|
||||
2: # Flip Horizontal
|
||||
flip_image_horizontal()
|
||||
flip_image(true)
|
||||
|
||||
3: # Flip Vertical
|
||||
flip_image_vertical()
|
||||
flip_image(false)
|
||||
|
||||
4: # Rotate
|
||||
show_rotate_image_popup()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
extends WindowDialog
|
||||
|
||||
var current_layer : Image
|
||||
var current_cel : Image
|
||||
var preview_image : Image
|
||||
var preview_texture : ImageTexture
|
||||
|
||||
|
@ -16,15 +16,15 @@ onready var preview = $MarginContainer/VBoxContainer/TextureRect
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
current_layer = Image.new()
|
||||
current_cel = Image.new()
|
||||
preview_image = Image.new()
|
||||
preview_texture = ImageTexture.new()
|
||||
preview_texture.flags = 0
|
||||
|
||||
|
||||
func _on_HSVDialog_about_to_show() -> void:
|
||||
current_layer = Global.canvas.layers[Global.current_layer].image
|
||||
preview_image.copy_from(current_layer)
|
||||
current_cel = Global.frames[Global.current_frame].cels[Global.current_layer].image
|
||||
preview_image.copy_from(current_cel)
|
||||
update_preview()
|
||||
|
||||
|
||||
|
@ -35,9 +35,9 @@ func _on_Cancel_pressed() -> void:
|
|||
|
||||
func _on_Apply_pressed() -> void:
|
||||
Global.canvas.handle_undo("Draw")
|
||||
DrawingAlgos.adjust_hsv(current_layer,0,hue_slider.value)
|
||||
DrawingAlgos.adjust_hsv(current_layer,1,sat_slider.value)
|
||||
DrawingAlgos.adjust_hsv(current_layer,2,val_slider.value)
|
||||
DrawingAlgos.adjust_hsv(current_cel,0,hue_slider.value)
|
||||
DrawingAlgos.adjust_hsv(current_cel,1,sat_slider.value)
|
||||
DrawingAlgos.adjust_hsv(current_cel,2,val_slider.value)
|
||||
Global.canvas.update_texture(Global.current_layer)
|
||||
Global.canvas.handle_redo("Draw")
|
||||
reset()
|
||||
|
@ -56,7 +56,7 @@ func reset() -> void:
|
|||
|
||||
|
||||
func update_preview() -> void:
|
||||
preview_image.copy_from(current_layer)
|
||||
preview_image.copy_from(current_cel)
|
||||
DrawingAlgos.adjust_hsv(preview_image,0,hue_slider.value)
|
||||
DrawingAlgos.adjust_hsv(preview_image,1,sat_slider.value)
|
||||
DrawingAlgos.adjust_hsv(preview_image,2,val_slider.value)
|
||||
|
|
|
@ -10,7 +10,7 @@ func _on_OutlineDialog_confirmed() -> void:
|
|||
var diagonal : bool = $OptionsContainer/DiagonalCheckBox.pressed
|
||||
var inside_image : bool = $OptionsContainer/InsideImageCheckBox.pressed
|
||||
|
||||
var image : Image = Global.canvas.layers[Global.current_layer].image
|
||||
var image : Image = Global.frames[Global.current_frame].cels[Global.current_layer].image
|
||||
if image.is_invisible():
|
||||
return
|
||||
var new_image := Image.new()
|
||||
|
|
Loading…
Reference in a new issue