1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-03-16 08:15:18 +00:00

Compare commits

..

No commits in common. "8b91d952589fd9be9402c126220333b49b3540a2" and "b75573d19c1fa61b553674742d74201346fb43d5" have entirely different histories.

3 changed files with 10 additions and 9 deletions

View file

@ -55,11 +55,12 @@ vec3 rgb_to_hsl(vec3 rgb)
vec4 blend(int blend_type, vec4 current_color, vec4 prev_color, float opacity) {
current_color.a *= opacity; // Combine the layer opacity
if (current_color.a <= 0.001) {
vec4 result;
if (current_color.a <= 0.001 || opacity <= 0.001) {
return prev_color;
}
vec4 result;
current_color.rgb = current_color.rgb * opacity; // Premultiply with the layer texture's alpha to prevent semi transparent pixels from being too bright (ALL LAYER TYPES!)
current_color.a = current_color.a * opacity; // Combine the layer opacity
switch(blend_type) {
case 1: // Darken
result.rgb = min(prev_color.rgb, current_color.rgb);
@ -77,7 +78,7 @@ vec4 blend(int blend_type, vec4 current_color, vec4 prev_color, float opacity) {
result.rgb = max(prev_color.rgb, current_color.rgb);
break;
case 6: // Screen
result.rgb = 1.0 - (1.0 - prev_color.rgb) * (1.0 - current_color.rgb);
result.rgb = mix(prev_color.rgb, 1.0 - (1.0 - prev_color.rgb) * (1.0 - current_color.rgb), current_color.a);
break;
case 7: // Color dodge
result.rgb = prev_color.rgb / (1.0 - current_color.rgb);
@ -127,10 +128,9 @@ vec4 blend(int blend_type, vec4 current_color, vec4 prev_color, float opacity) {
result.rgb = hsl_to_rgb(vec3(prev_hsl.r, prev_hsl.g, current_hsl.b));
break;
default: // Normal (case 0)
result.rgb = current_color.rgb;
result.rgb = prev_color.rgb * (1.0 - current_color.a) + current_color.rgb;
break;
}
result.rgb = mix(prev_color.rgb, result.rgb, current_color.a);
result.a = prev_color.a * (1.0 - current_color.a) + current_color.a;
result = clamp(result, 0.0, 1.0);
return mix(current_color, result, prev_color.a);

View file

@ -9,12 +9,13 @@ script = ExtResource("2")
[node name="ThicknessSlider" parent="." index="2" instance=ExtResource("3")]
layout_mode = 2
focus_mode = 2
theme_type_variation = &"ValueSlider"
min_value = 1.0
value = 1.0
prefix = "Size:"
suffix = "px"
global_increment_action = "brush_size_increment"
global_decrement_action = "brush_size_decrement"
is_global = true
[node name="Brush" parent="." index="3"]
visible = false

View file

@ -116,7 +116,7 @@ func _notification(what: int) -> void:
drag_highlight.hide()
elif what == NOTIFICATION_THEME_CHANGED:
if is_instance_valid(layer_settings_container):
layer_container.custom_minimum_size.x = layer_settings_container.size.x + 12
layer_container.custom_minimum_size.x = layer_settings_container.size.x
func _input(event: InputEvent) -> void: