- [Export Graph] Fix "solid background" not completely opaque.

This commit is contained in:
Tanasart 2024-07-05 09:06:33 +07:00
parent 731c8ef48a
commit 9c0f7bf298
2 changed files with 48 additions and 28 deletions

View file

@ -1953,6 +1953,9 @@ function Panel_Animation() : PanelContent() constructor {
if(_hov) keyframe_boxable = false;
}
draw_set_color(COLORS.panel_animation_timeline_top);
draw_rectangle(0, 0, bar_w, hh, false);
var _fr = ceil((bar_w / timeline_scale - timeline_shift) / timeline_separate) * timeline_separate;
for(var i = timeline_separate; i <= _fr; i += timeline_separate) {
@ -2031,9 +2034,6 @@ function Panel_Animation() : PanelContent() constructor {
}
}
draw_set_color(COLORS.panel_animation_timeline_top);
draw_rectangle(0, 0, bar_w, hh, false);
draw_set_font(f_p2);
var cf = string(CURRENT_FRAME + 1);
var tx = string_width(cf) + ui(4);

View file

@ -43,14 +43,14 @@ function graph_export_image(allList, nodeList, settings = {}) {
var s = surface_create(bbox_w, bbox_h);
var cs = surface_create(bbox_w * aa, bbox_h * aa);
var gr_x = -bbox_x0;
var gr_y = -bbox_y0;
var mx = gr_x, my = gr_y;
surface_set_target(s); //draw nodes
if(bgEnable) draw_clear(bgColor);
else draw_clear_alpha(0, 0);
var gr_x = -bbox_x0;
var gr_y = -bbox_y0;
var mx = gr_x, my = gr_y;
if(gridEnable) {
var gls = 32;
var gr_ls = gls * scale;
@ -105,13 +105,12 @@ function graph_export_image(allList, nodeList, settings = {}) {
surface_reset_target();
shader_set(sh_downsample);
shader_set_f("down", aa);
shader_set_f("dimension", surface_get_width_safe(cs), surface_get_height_safe(cs));
draw_surface(cs, 0, 0);
shader_set_f("down", aa);
shader_set_f("dimension", surface_get_width_safe(cs), surface_get_height_safe(cs));
draw_surface(cs, 0, 0);
shader_reset();
surface_free(cs);
#endregion
#region draw node
for(var i = 0; i < array_length(nodeList); i++)
nodeList[i].onDrawNodeBehind(gr_x, gr_y, mx, my, scale);
@ -125,25 +124,46 @@ function graph_export_image(allList, nodeList, settings = {}) {
surface_reset_target();
if(borderPad == 0) return s;
var _sg = surface_create(bbox_w + borderPad * 2, bbox_h + borderPad * 2);
surface_set_target(_sg);
if(bgEnable) draw_clear(bgColor);
else draw_clear_alpha(0, 0);
if(borderPad == 0) {
surface_set_target(_sg);
if(bgEnable) {
draw_clear(bgColor);
gpu_set_colorwriteenable(1, 1, 1, 0);
} else
draw_clear_alpha(0, 0);
BLEND_OVERRIDE
draw_surface(s, borderPad, borderPad);
BLEND_NORMAL
gpu_set_colorwriteenable(1, 1, 1, 1);
surface_reset_target();
BLEND_ALPHA_MULP
draw_surface(s, borderPad, borderPad);
draw_set_color(borderColor);
draw_set_alpha(borderAlpha);
draw_rectangle(borderPad, borderPad, bbox_w + borderPad, bbox_h + borderPad, 1);
draw_set_alpha(1);
BLEND_NORMAL
surface_reset_target();
} else {
surface_set_target(_sg);
if(bgEnable) {
draw_clear(bgColor);
gpu_set_colorwriteenable(1, 1, 1, 0);
} else
draw_clear_alpha(0, 0);
BLEND_ALPHA_MULP
draw_surface(s, borderPad, borderPad);
draw_set_color(borderColor);
draw_set_alpha(borderAlpha);
draw_rectangle(borderPad, borderPad, bbox_w + borderPad, bbox_h + borderPad, 1);
draw_set_alpha(1);
BLEND_NORMAL
gpu_set_colorwriteenable(1, 1, 1, 1);
surface_reset_target();
}
surface_free(cs);
surface_free(s);
return _sg;
}