Added Resize Canvas option to Image menu

This commit is contained in:
OverloadedOrama 2020-06-13 20:22:25 +03:00
parent 53b91a4bf4
commit 7219a5a274
7 changed files with 142 additions and 32 deletions

View file

@ -0,0 +1,7 @@
extends ConfirmationDialog
func _on_ResizeCanvas_confirmed() -> void:
var width : int = $VBoxContainer/OptionsContainer/WidthValue.value
var height : int = $VBoxContainer/OptionsContainer/HeightValue.value
DrawingAlgos.resize_canvas(width, height)

View file

@ -0,0 +1,61 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/UI/Dialogs/ResizeCanvas.gd" type="Script" id=1]
[node name="ResizeCanvas" type="ConfirmationDialog"]
margin_right = 200.0
margin_bottom = 114.0
script = ExtResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 8.0
margin_top = 8.0
margin_right = 192.0
margin_bottom = 78.0
[node name="ImageSize" type="Label" parent="VBoxContainer"]
margin_right = 184.0
margin_bottom = 14.0
text = "Canvas Size"
[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"]
margin_top = 18.0
margin_right = 184.0
margin_bottom = 70.0
custom_constants/vseparation = 4
custom_constants/hseparation = 2
columns = 2
[node name="WidthLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
margin_top = 5.0
margin_right = 46.0
margin_bottom = 19.0
text = "Width:"
[node name="WidthValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"]
margin_left = 48.0
margin_right = 122.0
margin_bottom = 24.0
mouse_default_cursor_shape = 2
min_value = 1.0
max_value = 16384.0
value = 64.0
suffix = "px"
[node name="Height" type="Label" parent="VBoxContainer/OptionsContainer"]
margin_top = 33.0
margin_right = 46.0
margin_bottom = 47.0
text = "Height:"
[node name="HeightValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"]
margin_left = 48.0
margin_top = 28.0
margin_right = 122.0
margin_bottom = 52.0
mouse_default_cursor_shape = 2
min_value = 1.0
max_value = 16384.0
value = 64.0
suffix = "px"
[connection signal="confirmed" from="." to="." method="_on_ResizeCanvas_confirmed"]

View file

@ -2,8 +2,6 @@
[ext_resource path="res://src/UI/Dialogs/ScaleImage.gd" type="Script" id=1]
[node name="ScaleImage" type="ConfirmationDialog"]
margin_right = 200.0
margin_bottom = 114.0
@ -17,27 +15,27 @@ margin_bottom = 102.0
[node name="ImageSize" type="Label" parent="VBoxContainer"]
margin_right = 184.0
margin_bottom = 15.0
margin_bottom = 14.0
text = "Image Size"
[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"]
margin_top = 19.0
margin_top = 18.0
margin_right = 184.0
margin_bottom = 90.0
margin_bottom = 94.0
custom_constants/vseparation = 4
custom_constants/hseparation = 2
columns = 2
[node name="WidthLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
margin_top = 5.0
margin_right = 72.0
margin_bottom = 20.0
margin_right = 87.0
margin_bottom = 19.0
text = "Width:"
[node name="WidthValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"]
margin_left = 72.0
margin_right = 155.0
margin_bottom = 25.0
margin_left = 89.0
margin_right = 168.0
margin_bottom = 24.0
mouse_default_cursor_shape = 2
min_value = 1.0
max_value = 16384.0
@ -45,16 +43,16 @@ value = 64.0
suffix = "px"
[node name="Height" type="Label" parent="VBoxContainer/OptionsContainer"]
margin_top = 30.0
margin_right = 72.0
margin_bottom = 45.0
margin_top = 33.0
margin_right = 87.0
margin_bottom = 47.0
text = "Height:"
[node name="HeightValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"]
margin_left = 72.0
margin_top = 25.0
margin_right = 155.0
margin_bottom = 50.0
margin_left = 89.0
margin_top = 28.0
margin_right = 168.0
margin_bottom = 52.0
mouse_default_cursor_shape = 2
min_value = 1.0
max_value = 16384.0
@ -62,16 +60,16 @@ value = 64.0
suffix = "px"
[node name="InterpolationLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
margin_top = 53.0
margin_right = 72.0
margin_bottom = 68.0
margin_top = 59.0
margin_right = 87.0
margin_bottom = 73.0
text = "Interpolation:"
[node name="InterpolationType" type="OptionButton" parent="VBoxContainer/OptionsContainer"]
margin_left = 72.0
margin_top = 50.0
margin_right = 155.0
margin_bottom = 71.0
margin_left = 89.0
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 ]
selected = 0