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()
|
Global.undo_redo.commit_action()
|
||||||
|
|
||||||
|
|
||||||
func flip_image_horizontal() -> void:
|
func flip_image(horizontal : bool) -> void:
|
||||||
var canvas : Canvas = Global.canvas
|
var image : Image = Global.frames[Global.current_frame].cels[Global.current_layer].image
|
||||||
canvas.handle_undo("Draw")
|
Global.canvas.handle_undo("Draw")
|
||||||
canvas.layers[Global.current_layer].image.unlock()
|
image.unlock()
|
||||||
canvas.layers[Global.current_layer].image.flip_x()
|
if horizontal:
|
||||||
canvas.layers[Global.current_layer].image.lock()
|
image.flip_x()
|
||||||
canvas.handle_redo("Draw")
|
else:
|
||||||
|
image.flip_y()
|
||||||
|
image.lock()
|
||||||
func flip_image_vertical() -> void:
|
Global.canvas.handle_redo("Draw")
|
||||||
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 show_rotate_image_popup() -> void:
|
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.set_sprite(image)
|
||||||
$RotateImage.popup_centered()
|
$RotateImage.popup_centered()
|
||||||
Global.dialog_open(true)
|
Global.dialog_open(true)
|
||||||
|
|
||||||
|
|
||||||
func invert_image_colors() -> void:
|
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")
|
Global.canvas.handle_undo("Draw")
|
||||||
for xx in image.get_size().x:
|
for xx in image.get_size().x:
|
||||||
for yy in image.get_size().y:
|
for yy in image.get_size().y:
|
||||||
|
@ -474,7 +468,7 @@ func invert_image_colors() -> void:
|
||||||
|
|
||||||
|
|
||||||
func desaturate_image() -> 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")
|
Global.canvas.handle_undo("Draw")
|
||||||
for xx in image.get_size().x:
|
for xx in image.get_size().x:
|
||||||
for yy in image.get_size().y:
|
for yy in image.get_size().y:
|
||||||
|
@ -508,10 +502,10 @@ func image_menu_id_pressed(id : int) -> void:
|
||||||
crop_image()
|
crop_image()
|
||||||
|
|
||||||
2: # Flip Horizontal
|
2: # Flip Horizontal
|
||||||
flip_image_horizontal()
|
flip_image(true)
|
||||||
|
|
||||||
3: # Flip Vertical
|
3: # Flip Vertical
|
||||||
flip_image_vertical()
|
flip_image(false)
|
||||||
|
|
||||||
4: # Rotate
|
4: # Rotate
|
||||||
show_rotate_image_popup()
|
show_rotate_image_popup()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
extends WindowDialog
|
extends WindowDialog
|
||||||
|
|
||||||
var current_layer : Image
|
var current_cel : Image
|
||||||
var preview_image : Image
|
var preview_image : Image
|
||||||
var preview_texture : ImageTexture
|
var preview_texture : ImageTexture
|
||||||
|
|
||||||
|
@ -16,15 +16,15 @@ onready var preview = $MarginContainer/VBoxContainer/TextureRect
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
current_layer = Image.new()
|
current_cel = Image.new()
|
||||||
preview_image = Image.new()
|
preview_image = Image.new()
|
||||||
preview_texture = ImageTexture.new()
|
preview_texture = ImageTexture.new()
|
||||||
preview_texture.flags = 0
|
preview_texture.flags = 0
|
||||||
|
|
||||||
|
|
||||||
func _on_HSVDialog_about_to_show() -> void:
|
func _on_HSVDialog_about_to_show() -> void:
|
||||||
current_layer = Global.canvas.layers[Global.current_layer].image
|
current_cel = Global.frames[Global.current_frame].cels[Global.current_layer].image
|
||||||
preview_image.copy_from(current_layer)
|
preview_image.copy_from(current_cel)
|
||||||
update_preview()
|
update_preview()
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,9 +35,9 @@ func _on_Cancel_pressed() -> void:
|
||||||
|
|
||||||
func _on_Apply_pressed() -> void:
|
func _on_Apply_pressed() -> void:
|
||||||
Global.canvas.handle_undo("Draw")
|
Global.canvas.handle_undo("Draw")
|
||||||
DrawingAlgos.adjust_hsv(current_layer,0,hue_slider.value)
|
DrawingAlgos.adjust_hsv(current_cel,0,hue_slider.value)
|
||||||
DrawingAlgos.adjust_hsv(current_layer,1,sat_slider.value)
|
DrawingAlgos.adjust_hsv(current_cel,1,sat_slider.value)
|
||||||
DrawingAlgos.adjust_hsv(current_layer,2,val_slider.value)
|
DrawingAlgos.adjust_hsv(current_cel,2,val_slider.value)
|
||||||
Global.canvas.update_texture(Global.current_layer)
|
Global.canvas.update_texture(Global.current_layer)
|
||||||
Global.canvas.handle_redo("Draw")
|
Global.canvas.handle_redo("Draw")
|
||||||
reset()
|
reset()
|
||||||
|
@ -56,7 +56,7 @@ func reset() -> void:
|
||||||
|
|
||||||
|
|
||||||
func update_preview() -> 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,0,hue_slider.value)
|
||||||
DrawingAlgos.adjust_hsv(preview_image,1,sat_slider.value)
|
DrawingAlgos.adjust_hsv(preview_image,1,sat_slider.value)
|
||||||
DrawingAlgos.adjust_hsv(preview_image,2,val_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 diagonal : bool = $OptionsContainer/DiagonalCheckBox.pressed
|
||||||
var inside_image : bool = $OptionsContainer/InsideImageCheckBox.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():
|
if image.is_invisible():
|
||||||
return
|
return
|
||||||
var new_image := Image.new()
|
var new_image := Image.new()
|
||||||
|
|
Loading…
Reference in a new issue