1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Affect area now affects the previews. (#320)

This commit is contained in:
Darshan Phaldesai 2020-08-26 16:59:49 +05:30 committed by GitHub
parent 719708fb10
commit 60c5ec9ad5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 5 deletions

View file

@ -8,6 +8,7 @@ enum {CEL, FRAME, ALL_FRAMES, ALL_PROJECTS}
var affect : int = CEL
var pixels := []
var current_cel : Image
var current_frame : Image
var preview_image : Image
var preview_texture : ImageTexture
var preview : TextureRect
@ -18,6 +19,8 @@ var affect_option_button : OptionButton
func _ready() -> void:
set_nodes()
current_cel = Image.new()
current_frame = Image.new()
current_frame.create(Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8)
preview_image = Image.new()
preview_texture = ImageTexture.new()
connect("about_to_show", self, "_about_to_show")
@ -31,6 +34,8 @@ func _ready() -> void:
func _about_to_show() -> void:
current_cel = Global.current_project.frames[Global.current_project.current_frame].cels[Global.current_project.current_layer].image
var frame = Global.current_project.frames[Global.current_project.current_frame]
Export.blend_layers(current_frame, frame)
if selection_checkbox:
_on_SelectionCheckBox_toggled(selection_checkbox.pressed)
update_transparent_background_size()
@ -58,6 +63,7 @@ func _on_SelectionCheckBox_toggled(button_pressed : bool) -> void:
func _on_AffectOptionButton_item_selected(index : int) -> void:
affect = index
update_preview()
func update_preview() -> void:

View file

@ -69,7 +69,11 @@ func _on_AButton_toggled(button_pressed : bool) -> void:
func update_preview() -> void:
preview_image.copy_from(current_cel)
match affect:
CEL:
preview_image.copy_from(current_cel)
_:
preview_image.copy_from(current_frame)
DrawingAlgos.desaturate_image(preview_image, pixels, red, green, blue, alpha)
preview_image.unlock()
preview_texture.create_from_image(preview_image, 0)

View file

@ -60,7 +60,11 @@ func _on_SelectionCheckBox_toggled(button_pressed : bool) -> void:
func update_preview() -> void:
preview_image.copy_from(current_cel)
match affect:
CEL:
preview_image.copy_from(current_cel)
_:
preview_image.copy_from(current_frame)
flip_image(preview_image, pixels)
preview_texture.create_from_image(preview_image, 0)
preview.texture = preview_texture

View file

@ -65,7 +65,11 @@ func reset() -> void:
func update_preview() -> void:
preview_image.copy_from(current_cel)
match affect:
CEL:
preview_image.copy_from(current_cel)
_:
preview_image.copy_from(current_frame)
DrawingAlgos.adjust_hsv(preview_image, hue_slider.value, sat_slider.value, val_slider.value, pixels)
preview_texture.create_from_image(preview_image, 0)
preview.texture = preview_texture

View file

@ -69,7 +69,11 @@ func _on_AButton_toggled(button_pressed : bool) -> void:
func update_preview() -> void:
preview_image.copy_from(current_cel)
match affect:
CEL:
preview_image.copy_from(current_cel)
_:
preview_image.copy_from(current_frame)
DrawingAlgos.invert_image_colors(preview_image, pixels, red, green, blue, alpha)
preview_image.unlock()
preview_texture.create_from_image(preview_image, 0)

View file

@ -76,7 +76,11 @@ func _on_InsideImageCheckBox_toggled(button_pressed : bool) -> void:
func update_preview() -> void:
preview_image.copy_from(current_cel)
match affect:
CEL:
preview_image.copy_from(current_cel)
_:
preview_image.copy_from(current_frame)
DrawingAlgos.generate_outline(preview_image, pixels, color, thickness, diagonal, inside_image)
preview_texture.create_from_image(preview_image, 0)
preview.texture = preview_texture