22 #ifndef AGG_SPAN_GRADIENT_IMAGE_INCLUDED 23 #define AGG_SPAN_GRADIENT_IMAGE_INCLUDED 26 #include "agg_basics.h" 27 #include "agg_span_gradient.h" 28 #include "agg_color_rgba.h" 29 #include "agg_rendering_buffer.h" 30 #include "agg_pixfmt_rgba.h" 39 typedef ColorT color_type;
48 static unsigned size() {
return 1; }
50 const color_type& operator [] (
unsigned i)
const 55 color_type* operator [] (
unsigned i)
66 typedef ColorT color_type;
89 m_color = m_color_function[0 ];
94 if (m_buffer) {
delete [] m_buffer; }
97 void* image_create(
int width,
int height )
101 if (width > m_alocdx || height > m_alocdy)
103 if (m_buffer) {
delete [] m_buffer; }
125 for (
int rows = 0; rows < height; rows++)
127 agg::rgba8* row = &m_buffer[rows * m_alocdx ];
128 std::memset(row ,0 ,m_width * 4 );
136 void* image_buffer() {
return m_buffer; }
137 int image_width() {
return m_width; }
138 int image_height() {
return m_height; }
139 int image_stride() {
return m_alocdx * 4; }
141 int calculate(
int x,
int y,
int d)
const 145 int px = x >> agg::gradient_subpixel_shift;
146 int py = y >> agg::gradient_subpixel_shift;
162 rgba8* pixel = &m_buffer[py * m_alocdx + px ];
164 m_color->r = pixel->r;
165 m_color->g = pixel->g;
166 m_color->b = pixel->b;
167 m_color->a = pixel->a;
182 return m_color_function;