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

Compare commits

...

4 commits

Author SHA1 Message Date
Emmanouil Papadeas
8b91d95258 Make alpha affect all of the blend modes besides Normal and Screen 2024-02-09 20:09:25 +02:00
Emmanouil Papadeas
bec6dfc256 Fix semi-transparent pixels being blended incorrectly in the BlendLayers shader
There may still be some semi-transparency issues in blend modes, some extra testing is required
2024-02-09 19:45:26 +02:00
Emmanouil Papadeas
a05dbabf98 Slightly increase the layer container minimum size to match the layer buttons 2024-02-09 14:50:18 +02:00
Emmanouil Papadeas
3935bfd2d3 Control + wheel works on the line tool's thickness now 2024-02-09 14:42:10 +02:00
3 changed files with 9 additions and 10 deletions

View file

@ -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);

View file

@ -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

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
layer_container.custom_minimum_size.x = layer_settings_container.size.x + 12
func _input(event: InputEvent) -> void: