mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-03-15 15:55:18 +00:00
Compare commits
4 commits
b75573d19c
...
8b91d95258
Author | SHA1 | Date | |
---|---|---|---|
|
8b91d95258 | ||
|
bec6dfc256 | ||
|
a05dbabf98 | ||
|
3935bfd2d3 |
3 changed files with 9 additions and 10 deletions
|
@ -55,12 +55,11 @@ vec3 rgb_to_hsl(vec3 rgb)
|
|||
|
||||
|
||||
vec4 blend(int blend_type, vec4 current_color, vec4 prev_color, float opacity) {
|
||||
vec4 result;
|
||||
if (current_color.a <= 0.001 || opacity <= 0.001) {
|
||||
current_color.a *= opacity; // Combine the layer opacity
|
||||
if (current_color.a <= 0.001) {
|
||||
return prev_color;
|
||||
}
|
||||
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
|
||||
vec4 result;
|
||||
switch(blend_type) {
|
||||
case 1: // Darken
|
||||
result.rgb = min(prev_color.rgb, current_color.rgb);
|
||||
|
@ -78,7 +77,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 = mix(prev_color.rgb, 1.0 - (1.0 - prev_color.rgb) * (1.0 - current_color.rgb), current_color.a);
|
||||
result.rgb = 1.0 - (1.0 - prev_color.rgb) * (1.0 - current_color.rgb);
|
||||
break;
|
||||
case 7: // Color dodge
|
||||
result.rgb = prev_color.rgb / (1.0 - current_color.rgb);
|
||||
|
@ -128,9 +127,10 @@ 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 = prev_color.rgb * (1.0 - current_color.a) + current_color.rgb;
|
||||
result.rgb = 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);
|
||||
|
|
|
@ -9,13 +9,12 @@ 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"
|
||||
is_global = true
|
||||
global_increment_action = "brush_size_increment"
|
||||
global_decrement_action = "brush_size_decrement"
|
||||
|
||||
[node name="Brush" parent="." index="3"]
|
||||
visible = false
|
||||
|
|
|
@ -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
|
||||
layer_container.custom_minimum_size.x = layer_settings_container.size.x + 12
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
|
|
Loading…
Add table
Reference in a new issue