1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-21 13:03:13 +00:00

Compare commits

..

No commits in common. "8c7594a1c8573b55b7a00507d7599b918e72914a" and "1b48eac843a9cc6b4071e51c0b616dc52efec96a" have entirely different histories.

4 changed files with 29 additions and 17 deletions

View file

@ -28,8 +28,6 @@ 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,22 +63,17 @@ func commit_action(cel: Image, project := Global.current_project) -> void:
var dither_texture := selected_dither_matrix.texture
var gradient := gradient_edit.gradient
var offsets := gradient.offsets
offsets.sort()
var n_of_colors := offsets.size()
var n_of_colors := gradient.offsets.size()
# Pass the gradient offsets as an array to the shader
# ...but we can't provide arrays with variable sizes as uniforms, instead we construct
# ...but since Godot 3.x doesn't support uniform arrays, 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 := offsets[i]
var c := gradient.offsets[i]
offsets_image.set_pixel(i, 0, Color(c, c, c, c))
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])
gradient_image.set_pixel(i, 0, gradient.colors[i])
var offsets_tex := ImageTexture.create_from_image(offsets_image)
var gradient_tex: Texture2D
if shader == shader_linear:

View file

@ -32,9 +32,10 @@ unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
selected = 0
item_count = 2
selected = 0
popup/item_0/text = "Linear"
popup/item_0/id = 0
popup/item_1/text = "Radial"
popup/item_1/id = 1
@ -46,9 +47,10 @@ text = "Dithering pattern:"
unique_name_in_owner = true
layout_mode = 2
mouse_default_cursor_shape = 2
selected = 0
item_count = 1
selected = 0
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
@ -58,9 +60,10 @@ text = "Repeat:"
unique_name_in_owner = true
layout_mode = 2
mouse_default_cursor_shape = 2
selected = 0
item_count = 4
selected = 0
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,9 +17,25 @@ 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)
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)
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
width_spinbox.value = Global.current_project.size.x
height_spinbox.value = Global.current_project.size.y
update_preview()