15 #ifndef AGG_PATTERN_FILTERS_RGBA8_INCLUDED 16 #define AGG_PATTERN_FILTERS_RGBA8_INCLUDED 18 #include "agg_basics.h" 19 #include "agg_line_aa_basics.h" 20 #include "agg_color_rgba.h" 29 typedef ColorT color_type;
30 static unsigned dilation() {
return 0; }
32 static void AGG_INLINE pixel_low_res(color_type
const*
const* buf,
33 color_type* p,
int x,
int y)
38 static void AGG_INLINE pixel_high_res(color_type
const*
const* buf,
39 color_type* p,
int x,
int y)
41 *p = buf[y >> line_subpixel_shift]
42 [x >> line_subpixel_shift];
53 typedef ColorT color_type;
54 typedef typename color_type::value_type value_type;
55 typedef typename color_type::calc_type calc_type;
58 static unsigned dilation() {
return 1; }
60 static AGG_INLINE
void pixel_low_res(color_type
const*
const* buf,
61 color_type* p,
int x,
int y)
66 static AGG_INLINE
void pixel_high_res(color_type
const*
const* buf,
67 color_type* p,
int x,
int y)
73 int x_lr = x >> line_subpixel_shift;
74 int y_lr = y >> line_subpixel_shift;
76 x &= line_subpixel_mask;
77 y &= line_subpixel_mask;
78 const color_type* ptr = buf[y_lr] + x_lr;
80 weight = (line_subpixel_scale - x) *
81 (line_subpixel_scale - y);
89 weight = x * (line_subpixel_scale - y);
95 ptr = buf[y_lr + 1] + x_lr;
97 weight = (line_subpixel_scale - x) * y;
100 b += weight * ptr->b;
101 a += weight * ptr->a;
106 r += weight * ptr->r;
107 g += weight * ptr->g;
108 b += weight * ptr->b;
109 a += weight * ptr->a;
111 p->r = (value_type)color_type::downshift(r, line_subpixel_shift * 2);
112 p->g = (value_type)color_type::downshift(g, line_subpixel_shift * 2);
113 p->b = (value_type)color_type::downshift(b, line_subpixel_shift * 2);
114 p->a = (value_type)color_type::downshift(a, line_subpixel_shift * 2);