1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-18 19:43:14 +00:00

Compare commits

...

5 commits

Author SHA1 Message Date
Emmanouil Papadeas
8c7594a1c8 Add a failsafe to the previous commit's solution 2024-09-13 01:05:53 +03:00
Emmanouil Papadeas
1e2e5dc431 Fix wrong preview in the gradient dialog when editing the gradient and dithering is enabled 2024-09-13 01:02:48 +03:00
Emmanouil Papadeas
501a7d3c02 [skip ci] Update CHANGELOG.md 2024-09-13 00:03:53 +03:00
Emmanouil Papadeas
6ad23f8485 Second attempt to fix a visual bug with resize canvas' dialog preview 2024-09-12 21:08:32 +03:00
Emmanouil Papadeas
462a95a5ae Fix visual bug with the preview of the resize canvas dialog 2024-09-12 20:23:18 +03:00
4 changed files with 17 additions and 29 deletions

View file

@ -28,6 +28,8 @@ Built using Godot 4.3
- The export dialog has been optimized by caching all of the blended frames. Changing export options, besides the layers, no longer cause slowness by re-blending all of the frames.
- Optimized the lasso and polygon select tools, as well as the fill options of the pencil and curve tools. The time they take to complete now depends on the size of the selection, rather than checking all of the pixels of the entire canvas.
- Fixed a crash when re-arranging palette swatches while holding <kbd>Shift</kbd>.
- Fixed a crash when using the move tool snapped to the grid.
- Fixed a visual bug with the preview of the resize canvas dialog.
- Fixed wrong stretch mode in the cel button previews. [#1097](https://github.com/Orama-Interactive/Pixelorama/pull/1097)
## [v1.0.2] - 2024-08-21

View file

@ -63,17 +63,22 @@ func commit_action(cel: Image, project := Global.current_project) -> void:
var dither_texture := selected_dither_matrix.texture
var gradient := gradient_edit.gradient
var n_of_colors := gradient.offsets.size()
var offsets := gradient.offsets
offsets.sort()
var n_of_colors := offsets.size()
# Pass the gradient offsets as an array to the shader
# ...but since Godot 3.x doesn't support uniform arrays, instead we construct
# ...but we can't provide arrays with variable sizes as uniforms, instead we construct
# a nx1 grayscale texture with each offset stored in each pixel, and pass it to the shader
var offsets_image := Image.create(n_of_colors, 1, false, Image.FORMAT_L8)
# Construct an image that contains the selected colors of the gradient without interpolation
var gradient_image := Image.create(n_of_colors, 1, false, Image.FORMAT_RGBA8)
for i in n_of_colors:
var c := gradient.offsets[i]
var c := offsets[i]
offsets_image.set_pixel(i, 0, Color(c, c, c, c))
gradient_image.set_pixel(i, 0, gradient.colors[i])
var actual_index := gradient.offsets.find(offsets[i])
if actual_index == -1:
actual_index = i
gradient_image.set_pixel(i, 0, gradient.colors[actual_index])
var offsets_tex := ImageTexture.create_from_image(offsets_image)
var gradient_tex: Texture2D
if shader == shader_linear:

View file

@ -32,10 +32,9 @@ unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
item_count = 2
selected = 0
item_count = 2
popup/item_0/text = "Linear"
popup/item_0/id = 0
popup/item_1/text = "Radial"
popup/item_1/id = 1
@ -47,10 +46,9 @@ text = "Dithering pattern:"
unique_name_in_owner = true
layout_mode = 2
mouse_default_cursor_shape = 2
item_count = 1
selected = 0
item_count = 1
popup/item_0/text = "None"
popup/item_0/id = 0
[node name="RepeatLabel" type="Label" parent="VBoxContainer/GradientOptions" index="4" groups=["gradient_common"]]
layout_mode = 2
@ -60,10 +58,9 @@ text = "Repeat:"
unique_name_in_owner = true
layout_mode = 2
mouse_default_cursor_shape = 2
item_count = 4
selected = 0
item_count = 4
popup/item_0/text = "None"
popup/item_0/id = 0
popup/item_1/text = "Repeat"
popup/item_1/id = 1
popup/item_2/text = "Mirror"

View file

@ -17,25 +17,9 @@ var image := Image.create(1, 1, false, Image.FORMAT_RGBA8)
func _on_ResizeCanvas_about_to_show() -> void:
Global.canvas.selection.transform_content_confirm()
image.resize(Global.current_project.size.x, Global.current_project.size.y)
var layer_i := 0
for cel in Global.current_project.frames[Global.current_project.current_frame].cels:
var layer := Global.current_project.layers[layer_i]
if cel is PixelCel and layer.is_visible_in_hierarchy():
var cel_image := Image.new()
cel_image.copy_from(cel.get_image())
var opacity := cel.get_final_opacity(layer)
if opacity < 1.0: # If we have cel transparency
for xx in cel_image.get_size().x:
for yy in cel_image.get_size().y:
var pixel_color := cel_image.get_pixel(xx, yy)
pixel_color.a *= cel.opacity
cel_image.set_pixel(xx, yy, pixel_color)
image.blend_rect(
cel_image, Rect2i(Vector2i.ZERO, Global.current_project.size), Vector2i.ZERO
)
layer_i += 1
image.fill(Color(0.0, 0.0, 0.0, 0.0))
var frame := Global.current_project.frames[Global.current_project.current_frame]
DrawingAlgos.blend_layers(image, frame)
width_spinbox.value = Global.current_project.size.x
height_spinbox.value = Global.current_project.size.y
update_preview()