mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Added "Place inside image" option for outline generation
And this concludes outlines for v0.6
This commit is contained in:
parent
bd9c2c6dd0
commit
eb28fd3d14
|
@ -3,6 +3,7 @@
|
|||
[ext_resource path="res://Scripts/Dialogs/OutlineDialog.gd" type="Script" id=1]
|
||||
|
||||
[node name="OutlineDialog" type="ConfirmationDialog"]
|
||||
visible = true
|
||||
margin_right = 200.0
|
||||
margin_bottom = 70.0
|
||||
script = ExtResource( 1 )
|
||||
|
@ -12,23 +13,23 @@ anchor_left = 0.5
|
|||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -92.0
|
||||
margin_top = -27.0
|
||||
margin_right = 92.0
|
||||
margin_bottom = -1.0
|
||||
margin_left = -121.0
|
||||
margin_top = -52.0
|
||||
margin_right = 121.0
|
||||
margin_bottom = 24.0
|
||||
custom_constants/vseparation = 4
|
||||
custom_constants/hseparation = 4
|
||||
columns = 2
|
||||
|
||||
[node name="ThickLabel" type="Label" parent="OptionsContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 139.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 19.0
|
||||
text = "Thickness:"
|
||||
|
||||
[node name="ThickValue" type="SpinBox" parent="OptionsContainer"]
|
||||
margin_left = 143.0
|
||||
margin_right = 217.0
|
||||
margin_left = 94.0
|
||||
margin_right = 242.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = 1.0
|
||||
|
@ -38,22 +39,30 @@ suffix = "px"
|
|||
|
||||
[node name="OutlineColorLabel" type="Label" parent="OptionsContainer"]
|
||||
margin_top = 31.0
|
||||
margin_right = 139.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 45.0
|
||||
text = "Fill with color:"
|
||||
|
||||
[node name="OutlineColor" type="ColorPickerButton" parent="OptionsContainer"]
|
||||
margin_left = 143.0
|
||||
margin_left = 94.0
|
||||
margin_top = 28.0
|
||||
margin_right = 217.0
|
||||
margin_right = 242.0
|
||||
margin_bottom = 48.0
|
||||
rect_min_size = Vector2( 64, 20 )
|
||||
color = Color( 1, 0, 0, 1 )
|
||||
|
||||
[node name="DiagonalCheckBox" type="CheckBox" parent="OptionsContainer"]
|
||||
margin_top = 52.0
|
||||
margin_right = 139.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 76.0
|
||||
mouse_default_cursor_shape = 2
|
||||
text = "Diagonal"
|
||||
|
||||
[node name="InsideImageCheckBox" type="CheckBox" parent="OptionsContainer"]
|
||||
margin_left = 94.0
|
||||
margin_top = 52.0
|
||||
margin_right = 242.0
|
||||
margin_bottom = 76.0
|
||||
mouse_default_cursor_shape = 2
|
||||
text = "Place inside image"
|
||||
[connection signal="confirmed" from="." to="." method="_on_OutlineDialog_confirmed"]
|
||||
|
|
|
@ -73,5 +73,4 @@ func _on_GitHub_pressed() -> void:
|
|||
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama")
|
||||
|
||||
func _on_Donate_pressed() -> void:
|
||||
OS.shell_open("https://paypal.me/OverloadedOrama")
|
||||
OS.shell_open("https://ko-fi.com/overloadedorama")
|
||||
OS.shell_open("https://www.patreon.com/OramaInteractive")
|
||||
|
|
|
@ -4,6 +4,7 @@ func _on_OutlineDialog_confirmed() -> void:
|
|||
var outline_color : Color = $OptionsContainer/OutlineColor.color
|
||||
var thickness : int = $OptionsContainer/ThickValue.value
|
||||
var diagonal : bool = $OptionsContainer/DiagonalCheckBox.pressed
|
||||
var inside_image : bool = $OptionsContainer/InsideImageCheckBox.pressed
|
||||
|
||||
var image : Image = Global.canvas.layers[Global.canvas.current_layer_index][0]
|
||||
if image.is_invisible():
|
||||
|
@ -21,54 +22,121 @@ func _on_OutlineDialog_confirmed() -> void:
|
|||
continue
|
||||
|
||||
for i in range(1, thickness + 1):
|
||||
var new_pos : Vector2 = pos + Vector2.LEFT * i # Left
|
||||
if new_pos.x >= 0:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
if inside_image:
|
||||
var outline_pos : Vector2 = pos + Vector2.LEFT # Left
|
||||
var outline_pixel = image.get_pixelv(outline_pos)
|
||||
if outline_pixel.a == 0:
|
||||
var new_pos : Vector2 = pos + Vector2.RIGHT * (i - 1)
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a > 0 && new_pos.x < Global.canvas.size.x:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
new_pos = pos + Vector2.RIGHT * i # Right
|
||||
if new_pos.x < Global.canvas.size.x:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
outline_pos = pos + Vector2.RIGHT # Right
|
||||
outline_pixel = image.get_pixelv(outline_pos)
|
||||
if outline_pixel.a == 0:
|
||||
var new_pos : Vector2 = pos + Vector2.LEFT * (i - 1)
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a > 0 && new_pos.x >= 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
new_pos = pos + Vector2.UP * i # Up
|
||||
if new_pos.y >= 0:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
outline_pos = pos + Vector2.UP # Up
|
||||
outline_pixel = image.get_pixelv(outline_pos)
|
||||
if outline_pixel.a == 0:
|
||||
var new_pos : Vector2 = pos + Vector2.DOWN * (i - 1)
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a > 0 && new_pos.y < Global.canvas.size.y:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
new_pos = pos + Vector2.DOWN * i # Down
|
||||
if new_pos.y < Global.canvas.size.y:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
outline_pos = pos + Vector2.DOWN # Down
|
||||
outline_pixel = image.get_pixelv(outline_pos)
|
||||
if outline_pixel.a == 0:
|
||||
var new_pos : Vector2 = pos + Vector2.UP * (i - 1)
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a > 0 && new_pos.y >= 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
if diagonal:
|
||||
new_pos = pos + (Vector2.LEFT + Vector2.UP) * i # Top left
|
||||
if new_pos.x >= 0 && new_pos.y >= 0:
|
||||
if diagonal:
|
||||
outline_pos = pos + (Vector2.LEFT + Vector2.UP) # Top left
|
||||
outline_pixel = image.get_pixelv(outline_pos)
|
||||
if outline_pixel.a == 0:
|
||||
var new_pos : Vector2 = pos + (Vector2.RIGHT + Vector2.DOWN) * (i - 1)
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a > 0 && new_pos.x < Global.canvas.size.x && new_pos.y < Global.canvas.size.y:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
outline_pos = pos + (Vector2.LEFT + Vector2.DOWN) # Bottom left
|
||||
outline_pixel = image.get_pixelv(outline_pos)
|
||||
if outline_pixel.a == 0:
|
||||
var new_pos : Vector2 = pos + (Vector2.RIGHT + Vector2.UP) * (i - 1)
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a > 0 && new_pos.x < Global.canvas.size.x && new_pos.y >= 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
outline_pos = pos + (Vector2.RIGHT + Vector2.UP) # Top right
|
||||
outline_pixel = image.get_pixelv(outline_pos)
|
||||
if outline_pixel.a == 0:
|
||||
var new_pos : Vector2 = pos + (Vector2.LEFT + Vector2.DOWN) * (i - 1)
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a > 0 && new_pos.x >= 0 && new_pos.y < Global.canvas.size.y:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
outline_pos = pos + (Vector2.RIGHT + Vector2.DOWN) # Bottom right
|
||||
outline_pixel = image.get_pixelv(outline_pos)
|
||||
if outline_pixel.a == 0:
|
||||
var new_pos : Vector2 = pos + (Vector2.LEFT + Vector2.UP) * (i - 1)
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a > 0 && new_pos.x >= 0 && new_pos.y >= 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
else:
|
||||
var new_pos : Vector2 = pos + Vector2.LEFT * i # Left
|
||||
if new_pos.x >= 0:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
new_pos = pos + (Vector2.LEFT + Vector2.DOWN) * i # Bottom left
|
||||
if new_pos.x >= 0 && new_pos.y < Global.canvas.size.y:
|
||||
new_pos = pos + Vector2.RIGHT * i # Right
|
||||
if new_pos.x < Global.canvas.size.x:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
new_pos = pos + (Vector2.RIGHT + Vector2.UP) * i # Top right
|
||||
if new_pos.x < Global.canvas.size.x && new_pos.y >= 0:
|
||||
new_pos = pos + Vector2.UP * i # Up
|
||||
if new_pos.y >= 0:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
new_pos = pos + (Vector2.RIGHT + Vector2.DOWN) * i # Bottom right
|
||||
if new_pos.x < Global.canvas.size.x && new_pos.y < Global.canvas.size.y:
|
||||
new_pos = pos + Vector2.DOWN * i # Down
|
||||
if new_pos.y < Global.canvas.size.y:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
if diagonal:
|
||||
new_pos = pos + (Vector2.LEFT + Vector2.UP) * i # Top left
|
||||
if new_pos.x >= 0 && new_pos.y >= 0:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
new_pos = pos + (Vector2.LEFT + Vector2.DOWN) * i # Bottom left
|
||||
if new_pos.x >= 0 && new_pos.y < Global.canvas.size.y:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
new_pos = pos + (Vector2.RIGHT + Vector2.UP) * i # Top right
|
||||
if new_pos.x < Global.canvas.size.x && new_pos.y >= 0:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
new_pos = pos + (Vector2.RIGHT + Vector2.DOWN) * i # Bottom right
|
||||
if new_pos.x < Global.canvas.size.x && new_pos.y < Global.canvas.size.y:
|
||||
var new_pixel = image.get_pixelv(new_pos)
|
||||
if new_pixel.a == 0:
|
||||
new_image.set_pixelv(new_pos, outline_color)
|
||||
|
||||
image.copy_from(new_image)
|
||||
Global.canvas.handle_redo("Draw")
|
||||
|
|
|
@ -279,7 +279,7 @@ msgid "GitHub Contributors"
|
|||
msgstr "GitHub 貢獻者"
|
||||
|
||||
msgid "Art by"
|
||||
msgstr "作者:"
|
||||
msgstr "作者"
|
||||
|
||||
msgid "untitled"
|
||||
msgstr "未命名"
|
||||
|
|
Loading…
Reference in a new issue