00001 #ifndef __PAINT_H_
00002 #define __PAINT_H_
00003
00004 #include <cairo.h>
00005 #include "mb_types.h"
00006 #include "mb_redraw_man.h"
00007 #include "mb_tools.h"
00008
00009 typedef float co_comp_t;
00010
00011 extern paint_t *rdman_paint_color_new(redraw_man_t *rdman,
00012 co_comp_t r, co_comp_t g,
00013 co_comp_t b, co_comp_t a);
00014 extern void paint_color_set(paint_t *paint,
00015 co_comp_t r, co_comp_t g,
00016 co_comp_t b, co_comp_t a);
00017 extern void paint_color_get(paint_t *paint,
00018 co_comp_t *r, co_comp_t *g,
00019 co_comp_t *b, co_comp_t *a);
00020 #define paint_init(_paint, _prepare, _free) \
00021 do { \
00022 (_paint)->flags = 0; \
00023 (_paint)->prepare = _prepare; \
00024 (_paint)->free = _free; \
00025 STAILQ_INIT((_paint)->members); \
00026 (_paint)->pnt_next = NULL; \
00027 } while(0) \
00028
00029
00030 typedef struct _grad_stop {
00031 co_aix offset;
00032 co_comp_t r, g, b, a;
00033 } grad_stop_t;
00034
00035 extern paint_t *rdman_paint_linear_new(redraw_man_t *rdman,
00036 co_aix x1, co_aix y1,
00037 co_aix x2, co_aix y2);
00038 extern grad_stop_t *paint_linear_stops(paint_t *paint,
00039 int n_stops,
00040 grad_stop_t *stops);
00041 extern paint_t *rdman_paint_radial_new(redraw_man_t *rdman,
00042 co_aix cx, co_aix cy, co_aix r);
00043 extern grad_stop_t *paint_radial_stops(paint_t *paint,
00044 int n_stops,
00045 grad_stop_t *stops);
00046
00047 #define grad_stop_init(stop, _offset, _r, _g, _b, _a) \
00048 do { \
00049 (stop)->offset = _offset; \
00050 (stop)->r = _r; \
00051 (stop)->g = _g; \
00052 (stop)->b = _b; \
00053 (stop)->a = _a; \
00054 } while(0)
00055
00056
00057 #endif