Mercurial > MadButterfly
diff src/paint.c @ 21:83d24300a992
opacity (alpha) channel
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sat, 02 Aug 2008 16:06:53 +0800 |
parents | cf6d65398619 |
children | 56f592f56ff7 |
line wrap: on
line diff
--- a/src/paint.c Sat Aug 02 15:46:26 2008 +0800 +++ b/src/paint.c Sat Aug 02 16:06:53 2008 +0800 @@ -5,7 +5,7 @@ typedef struct _paint_color { paint_t paint; - co_comp_t r, g, b; + co_comp_t r, g, b, a; redraw_man_t *rdman; } paint_color_t; @@ -13,7 +13,7 @@ static void paint_color_prepare(paint_t *paint, cairo_t *cr) { paint_color_t *color = (paint_color_t *)paint; - cairo_set_source_rgb(cr, color->r, color->g, color->b); + cairo_set_source_rgba(cr, color->r, color->g, color->b, color->a); } static void paint_color_free(paint_t *paint) { @@ -24,7 +24,8 @@ } paint_t *paint_color_new(redraw_man_t *rdman, - co_comp_t r, co_comp_t g, co_comp_t b) { + co_comp_t r, co_comp_t g, + co_comp_t b, co_comp_t a) { paint_color_t *color; color = (paint_color_t *)malloc(sizeof(paint_color_t)); @@ -34,15 +35,18 @@ color->r = r; color->g = g; color->b = b; + color->a = a; paint_init(&color->paint, paint_color_prepare, paint_color_free); return (paint_t *)color; } void paint_color_set(paint_t *paint, - co_comp_t r, co_comp_t g, co_comp_t b) { + co_comp_t r, co_comp_t g, + co_comp_t b, co_comp_t a) { paint_color_t *color = (paint_color_t *)paint; color->r = r; color->g = g; color->b = b; + color->a = a; }