diff options
author | Thomas White <taw@physics.org> | 2018-11-10 20:56:20 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-11-10 20:56:20 +0100 |
commit | a12dba1223bba998d3c6d29aada61a609d9ea351 (patch) | |
tree | c9c765c9aa51c1d27262361f8d918a216cb89591 /src | |
parent | e61b873f084e43b1bccff10a64e9392d240562b9 (diff) |
Handle alpha values in gradients
Diffstat (limited to 'src')
-rw-r--r-- | src/render.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/render.c b/src/render.c index 78c5489..3d46e7b 100644 --- a/src/render.c +++ b/src/render.c @@ -63,24 +63,28 @@ static void do_background(cairo_t *cr, struct frame *fr) case GRAD_VERT: patt = cairo_pattern_create_linear(0.0, 0.0, 0.0, fr->h); - cairo_pattern_add_color_stop_rgb(patt, 0.0, fr->bgcol[0], - fr->bgcol[1], - fr->bgcol[2]); - cairo_pattern_add_color_stop_rgb(patt, 1.0, fr->bgcol2[0], - fr->bgcol2[1], - fr->bgcol2[2]); + cairo_pattern_add_color_stop_rgba(patt, 0.0, fr->bgcol[0], + fr->bgcol[1], + fr->bgcol[2], + fr->bgcol[3]); + cairo_pattern_add_color_stop_rgba(patt, 1.0, fr->bgcol2[0], + fr->bgcol2[1], + fr->bgcol2[2], + fr->bgcol2[3]); cairo_set_source(cr, patt); break; case GRAD_HORIZ: patt = cairo_pattern_create_linear(0.0, 0.0, fr->w, 0.0); - cairo_pattern_add_color_stop_rgb(patt, 0.0, fr->bgcol[0], - fr->bgcol[1], - fr->bgcol[2]); - cairo_pattern_add_color_stop_rgb(patt, 1.0, fr->bgcol2[0], - fr->bgcol2[1], - fr->bgcol2[2]); + cairo_pattern_add_color_stop_rgba(patt, 0.0, fr->bgcol[0], + fr->bgcol[1], + fr->bgcol[2], + fr->bgcol[3]); + cairo_pattern_add_color_stop_rgba(patt, 1.0, fr->bgcol2[0], + fr->bgcol2[1], + fr->bgcol2[2], + fr->bgcol2[3]); cairo_set_source(cr, patt); break; |