mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Added Scale3X algorithm as an option to scale sprites (#290)
This commit is contained in:
parent
5bbea6fa03
commit
6d23f95d07
|
@ -226,6 +226,13 @@ func scale_image(width : int, height : int, interpolation : int) -> void:
|
|||
for i in range(f.cels.size() - 1, -1, -1):
|
||||
var sprite := Image.new()
|
||||
sprite.copy_from(f.cels[i].image)
|
||||
# Different method for scale3x
|
||||
if interpolation == 5:
|
||||
var times : Vector2 = Vector2(ceil(width/(3.0*sprite.get_width())),ceil(height/(3.0*sprite.get_height())))
|
||||
for j in range(max(times.x,times.y)):
|
||||
sprite.copy_from(scale3X(sprite))
|
||||
sprite.resize(width, height, 0)
|
||||
else:
|
||||
sprite.resize(width, height, interpolation)
|
||||
Global.current_project.undo_redo.add_do_property(f.cels[i].image, "data", sprite.data)
|
||||
Global.current_project.undo_redo.add_undo_property(f.cels[i].image, "data", f.cels[i].image.data)
|
||||
|
|
|
@ -5,22 +5,24 @@
|
|||
[node name="ScaleImage" type="ConfirmationDialog"]
|
||||
margin_right = 200.0
|
||||
margin_bottom = 114.0
|
||||
rect_min_size = Vector2( 250, 87.5 )
|
||||
window_title = "Confirmá, por favor..."
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 192.0
|
||||
margin_right = 242.0
|
||||
margin_bottom = 102.0
|
||||
|
||||
[node name="ImageSize" type="Label" parent="VBoxContainer"]
|
||||
margin_right = 184.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 14.0
|
||||
text = "Image Size"
|
||||
|
||||
[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 184.0
|
||||
margin_right = 234.0
|
||||
margin_bottom = 94.0
|
||||
custom_constants/vseparation = 4
|
||||
custom_constants/hseparation = 2
|
||||
|
@ -71,7 +73,7 @@ margin_top = 56.0
|
|||
margin_right = 168.0
|
||||
margin_bottom = 76.0
|
||||
text = "Nearest"
|
||||
items = [ "Nearest", null, false, 0, null, "Bilinear", null, false, 1, null, "Cubic", null, false, 2, null, "Trilinear", null, false, 3, null, "Lanczos", null, false, 4, null ]
|
||||
items = [ "Nearest", null, false, 0, null, "Bilinear", null, false, 1, null, "Cubic", null, false, 2, null, "Trilinear", null, false, 3, null, "Lanczos", null, false, 4, null, "Scale3X", null, false, 5, null ]
|
||||
selected = 0
|
||||
[connection signal="confirmed" from="." to="." method="_on_ScaleImage_confirmed"]
|
||||
[connection signal="popup_hide" from="." to="." method="_on_ScaleImage_popup_hide"]
|
||||
|
|
Loading…
Reference in a new issue