17 #ifndef __WXAGGDRAWER_H__
18 #define __WXAGGDRAWER_H__
25 #include "a2dprivate.h"
27 #if wxART2D_USE_AGGDRAWER
30 #include "agg_basics.h"
31 #include "agg_rendering_buffer.h"
32 #include "agg_rasterizer_scanline_aa.h"
33 #include "agg_scanline_u.h"
34 #include "agg_path_storage.h"
35 #include "agg_conv_stroke.h"
37 #include "wx/geometry.h"
39 #include "agg_pixfmt_rgb.h"
40 #include "agg_pixfmt_rgba.h"
41 #include "agg_image_accessors.h"
42 #include "agg_span_allocator.h"
43 #include "agg_conv_dash.h"
44 #include "agg_pixfmt_rgba.h"
45 #include "agg_span_image_filter_rgba.h"
47 #include "agg_rendering_buffer.h"
48 #include "agg_rasterizer_scanline_aa.h"
49 #include "agg_renderer_outline_aa.h"
50 #include "agg_rasterizer_outline_aa.h"
51 #include "agg_conv_transform.h"
52 #include "agg_bspline.h"
53 #include "agg_gsv_text.h"
54 #include "agg_scanline_p.h"
55 #include "agg_renderer_scanline.h"
56 #include "agg_renderer_mclip.h"
58 #include "agg_conv_stroke.h"
59 #include "agg_conv_dash.h"
60 #include "agg_conv_curve.h"
61 #include "agg_conv_contour.h"
62 #include "agg_conv_smooth_poly1.h"
63 #include "agg_conv_marker.h"
64 #include "agg_arrowhead.h"
65 #include "agg_vcgen_markers_term.h"
66 #include "agg_rendering_buffer.h"
68 #include "agg_ellipse.h"
69 #include "agg_rounded_rect.h"
70 #include "agg_path_storage.h"
71 #include "agg_span_pattern_rgb.h"
72 #include "agg_trans_affine.h"
73 #include "agg_span_image_filter_rgb.h"
74 #include "agg_span_gradient.h"
75 #include "agg_span_interpolator_linear.h"
76 #include "agg_span_converter.h"
78 #ifdef A2DAGGDRAWERMAKINGDLL
79 #define A2DAGGDRAWERDLLEXP WXEXPORT
80 #define A2DAGGDRAWERDLLEXP_DATA(type) WXEXPORT type
81 #define A2DAGGDRAWERDLLEXP_CTORFN
82 #elif defined(WXART2D_USINGDLL)
83 #define A2DAGGDRAWERDLLEXP WXIMPORT
84 #define A2DAGGDRAWERDLLEXP_DATA(type) WXIMPORT type
85 #define A2DAGGDRAWERDLLEXP_CTORFN
86 #else // not making nor using DLL
87 #define A2DAGGDRAWERDLLEXP
88 #define A2DAGGDRAWERDLLEXP_DATA(type) type
89 #define A2DAGGDRAWERDLLEXP_CTORFN
92 #if defined(WXART2D_USINGDLL)
93 template struct A2DAGGDRAWERDLLEXP agg::rect_base<int>;
95 template class A2DAGGDRAWERDLLEXP agg::pod_array<agg::int8u*>;
96 template class A2DAGGDRAWERDLLEXP agg::row_ptr_cache<agg::int8u>;
98 template class A2DAGGDRAWERDLLEXP agg::rasterizer_sl_clip<agg::ras_conv_int>;
99 template class A2DAGGDRAWERDLLEXP agg::pod_vector<agg::rasterizer_cells_aa<agg::cell_aa>::cell_type*>;
100 template class A2DAGGDRAWERDLLEXP agg::pod_vector<agg::rasterizer_cells_aa<agg::cell_aa>::sorted_y>;
101 template class A2DAGGDRAWERDLLEXP agg::rasterizer_cells_aa<agg::cell_aa>;
102 template class A2DAGGDRAWERDLLEXP agg::rasterizer_scanline_aa<>;
104 template class A2DAGGDRAWERDLLEXP agg::row_accessor<agg::int8u>;
106 class A2DAGGDRAWERDLLEXP agg::scanline_u8;
109 typedef agg::order_rgba wxImageComponentOrder;
113 typedef agg::pixfmt_rgb24 PixFormat;
114 typedef agg::blender_rgba<color_type, wxImageComponentOrder> Blender;
120 typedef agg::renderer_scanline_bin_solid<RendererBase> RendererSolidBin;
122 typedef agg::renderer_outline_aa<RendererBase> RendererOutlineAa;
123 typedef agg::rasterizer_outline_aa<RendererOutlineAa> RasterOutLineAa;
125 #include "agg_pixfmt_rgba.h"
128 #if defined(__WXMSW__)
130 typedef agg::order_bgra ComponentOrder;
133 typedef agg::order_rgba ComponentOrder;
135 typedef agg::comp_op_adaptor_rgba<color_type, ComponentOrder> BlenderCompA;
136 typedef agg::pixfmt_custom_blend_rgba<BlenderCompA, agg::rendering_buffer> PixFormatComp;
139 typedef agg::renderer_base<PixFormatComp> RendererBaseComp;
142 typedef agg::renderer_scanline_aa_solid<RendererBaseComp> RendererSolidComp;
144 typedef agg::renderer_scanline_bin_solid<RendererBase> RendererSolidBin;
146 typedef agg::renderer_outline_aa<RendererBaseA> RendererOutlineAaA;
147 typedef agg::rasterizer_outline_aa<RendererOutlineAaA> RasterOutLineAaA;
149 typedef agg::pod_auto_array<color_type, 256> GradientArray;
151 typedef agg::span_gradient<color_type, agg::span_interpolator_linear<>, agg::gradient_x, GradientArray> LinearGradientSpan;
152 typedef agg::span_gradient<color_type, agg::span_interpolator_linear<>, agg::gradient_circle, GradientArray> RadialGradientSpan;
154 typedef agg::span_allocator<agg::rgba8> span_allocator_type;
158 LinearGradientSpan > RendererLinearGradient;
161 RadialGradientSpan > RendererRadialGradient;
165 LinearGradientSpan > RendererLinearGradientA;
168 RadialGradientSpan > RendererRadialGradientA;
170 typedef agg::renderer_scanline_aa < RendererBaseComp,
172 LinearGradientSpan > RendererLinearGradientComp;
173 typedef agg::renderer_scanline_aa < RendererBaseComp,
175 RadialGradientSpan > RendererRadialGradientComp;
177 static const char* HORIZONTAL_HATCH_XPM[] =
183 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
184 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
185 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
186 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
187 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
188 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
189 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
191 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
192 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
193 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
194 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
195 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
196 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
197 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
199 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
200 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
201 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
202 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
203 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
204 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
205 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
207 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
208 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
209 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
210 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
211 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
212 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
213 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
216 static const char* VERTICAL_HATCH_XPM[] =
221 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
222 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
223 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
224 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
225 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
226 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
227 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
228 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
229 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
230 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
231 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
232 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
233 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
234 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
235 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
236 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
237 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
238 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
239 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
240 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
241 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
242 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
243 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
244 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
245 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
246 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
247 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
248 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
249 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
250 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
251 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
252 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!"
255 static const char* FDIAGONAL_HATCH_XPM[] =
260 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
261 "! !!!!!!! !!!!!!! !!!!!!! !!!!!!",
262 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
263 "!!! !!!!!!! !!!!!!! !!!!!!! !!!!",
264 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
265 "!!!!! !!!!!!! !!!!!!! !!!!!!! !!",
266 "!!!!!! !!!!!!! !!!!!!! !!!!!!! !",
267 "!!!!!!! !!!!!!! !!!!!!! !!!!!!! ",
268 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
269 "! !!!!!!! !!!!!!! !!!!!!! !!!!!!",
270 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
271 "!!! !!!!!!! !!!!!!! !!!!!!! !!!!",
272 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
273 "!!!!! !!!!!!! !!!!!!! !!!!!!! !!",
274 "!!!!!! !!!!!!! !!!!!!! !!!!!!! !",
275 "!!!!!!! !!!!!!! !!!!!!! !!!!!!! ",
276 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
277 "! !!!!!!! !!!!!!! !!!!!!! !!!!!!",
278 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
279 "!!! !!!!!!! !!!!!!! !!!!!!! !!!!",
280 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
281 "!!!!! !!!!!!! !!!!!!! !!!!!!! !!",
282 "!!!!!! !!!!!!! !!!!!!! !!!!!!! !",
283 "!!!!!!! !!!!!!! !!!!!!! !!!!!!! ",
284 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
285 "! !!!!!!! !!!!!!! !!!!!!! !!!!!!",
286 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
287 "!!! !!!!!!! !!!!!!! !!!!!!! !!!!",
288 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
289 "!!!!! !!!!!!! !!!!!!! !!!!!!! !!",
290 "!!!!!! !!!!!!! !!!!!!! !!!!!!! !",
291 "!!!!!!! !!!!!!! !!!!!!! !!!!!!! "
294 static const char* BDIAGONAL_HATCH_XPM[] =
299 "!!!!!!! !!!!!!! !!!!!!! !!!!!!! ",
300 "!!!!!! !!!!!!! !!!!!!! !!!!!!! !",
301 "!!!!! !!!!!!! !!!!!!! !!!!!!! !!",
302 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
303 "!!! !!!!!!! !!!!!!! !!!!!!! !!!!",
304 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
305 "! !!!!!!! !!!!!!! !!!!!!! !!!!!!",
306 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
307 "!!!!!!! !!!!!!! !!!!!!! !!!!!!! ",
308 "!!!!!! !!!!!!! !!!!!!! !!!!!!! !",
309 "!!!!! !!!!!!! !!!!!!! !!!!!!! !!",
310 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
311 "!!! !!!!!!! !!!!!!! !!!!!!! !!!!",
312 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
313 "! !!!!!!! !!!!!!! !!!!!!! !!!!!!",
314 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
315 "!!!!!!! !!!!!!! !!!!!!! !!!!!!! ",
316 "!!!!!! !!!!!!! !!!!!!! !!!!!!! !",
317 "!!!!! !!!!!!! !!!!!!! !!!!!!! !!",
318 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
319 "!!! !!!!!!! !!!!!!! !!!!!!! !!!!",
320 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
321 "! !!!!!!! !!!!!!! !!!!!!! !!!!!!",
322 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
323 "!!!!!!! !!!!!!! !!!!!!! !!!!!!! ",
324 "!!!!!! !!!!!!! !!!!!!! !!!!!!! !",
325 "!!!!! !!!!!!! !!!!!!! !!!!!!! !!",
326 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
327 "!!! !!!!!!! !!!!!!! !!!!!!! !!!!",
328 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
329 "! !!!!!!! !!!!!!! !!!!!!! !!!!!!",
330 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!"
333 static const char* CROSSDIAG_HATCH_XPM[] =
338 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
339 "! !!!!! ! !!!!! ! !!!!! ! !!!!! ",
340 "!! !!! !!! !!! !!! !!! !!! !!! !",
341 "!!! ! !!!!! ! !!!!! ! !!!!! ! !!",
342 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
343 "!!! ! !!!!! ! !!!!! ! !!!!! ! !!",
344 "!! !!! !!! !!! !!! !!! !!! !!! !",
345 "! !!!!! ! !!!!! ! !!!!! ! !!!!! ",
346 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
347 "! !!!!! ! !!!!! ! !!!!! ! !!!!! ",
348 "!! !!! !!! !!! !!! !!! !!! !!! !",
349 "!!! ! !!!!! ! !!!!! ! !!!!! ! !!",
350 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
351 "!!! ! !!!!! ! !!!!! ! !!!!! ! !!",
352 "!! !!! !!! !!! !!! !!! !!! !!! !",
353 "! !!!!! ! !!!!! ! !!!!! ! !!!!! ",
354 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
355 "! !!!!! ! !!!!! ! !!!!! ! !!!!! ",
356 "!! !!! !!! !!! !!! !!! !!! !!! !",
357 "!!! ! !!!!! ! !!!!! ! !!!!! ! !!",
358 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
359 "!!! ! !!!!! ! !!!!! ! !!!!! ! !!",
360 "!! !!! !!! !!! !!! !!! !!! !!! !",
361 "! !!!!! ! !!!!! ! !!!!! ! !!!!! ",
362 " !!!!!!! !!!!!!! !!!!!!! !!!!!!!",
363 "! !!!!! ! !!!!! ! !!!!! ! !!!!! ",
364 "!! !!! !!! !!! !!! !!! !!! !!! !",
365 "!!! ! !!!!! ! !!!!! ! !!!!! ! !!",
366 "!!!! !!!!!!! !!!!!!! !!!!!!! !!!",
367 "!!! ! !!!!! ! !!!!! ! !!!!! ! !!",
368 "!! !!! !!! !!! !!! !!! !!! !!! !",
369 "! !!!!! ! !!!!! ! !!!!! ! !!!!! "
372 static const char* CROSS_HATCH_XPM[] =
377 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
378 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
380 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
381 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
382 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
383 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
384 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
385 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
386 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
388 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
389 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
390 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
391 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
392 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
393 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
394 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
396 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
397 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
398 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
399 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
400 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
401 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
402 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
404 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
405 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
406 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
407 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!",
408 "!! !!!!!!! !!!!!!! !!!!!!! !!!!!"
411 typedef agg::rasterizer_scanline_aa<> RasterizerType;
428 void rewind(
unsigned path_id )
430 m_source.rewind( path_id );
433 unsigned vertex(
double* x,
double* y )
435 return m_source.vertex( x, y );
438 void transformer(
void* ) {}
444 VertexSource& m_source;
466 void SetPreStroke(
bool preStroke ) { m_preStroke = preStroke; }
468 bool GetPreStroke() {
return m_preStroke; }
486 void BlitBuffer( wxRect rect,
const wxPoint& bufferpos = wxPoint( 0, 0 ) );
488 void BlitBuffer( wxDC* dc, wxRect rect,
const wxPoint& bufferpos = wxPoint( 0, 0 ) ) = 0;
490 virtual void DrawCircle(
double x,
double y,
double radius );
502 virtual void DrawRoundedRectangle(
double x,
double y,
double width,
double height,
double radius,
bool pixelsize =
false );
504 virtual void DrawEllipse(
double x,
double y,
double width,
double height );
510 virtual void DrawPolygon(
const a2dVertexList* list,
bool spline =
false, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
530 void ShiftBufferInternal(
int dxy,
bool yshift,
int bytesPerPixel );
532 template <
class PathT>
533 void _ras_add_stroked_path_xform( PathT& path,
const agg::trans_affine& mtx );
535 virtual void Render(
bool fillColor ) = 0;
536 virtual void RenderGradient(
bool radial ) = 0;
537 virtual void RenderBitmapFill() = 0;
538 virtual void RenderSetClip() = 0;
540 agg::trans_affine _get_agg_user_to_device_transform()
const;
555 wxClientDC* m_deviceDC;
559 RasterizerType m_rasterizer;
560 agg::comp_op_e m_blendMode;
562 double m_strokewidth;
563 double m_strokewidthDev;
566 agg::line_join_e m_join;
568 agg::line_cap_e m_cap;
571 agg::rendering_buffer m_pattern_rbuf;
573 agg::scanline_u8 m_sl;
575 agg::path_storage m_path;
577 double m_fillGradientD1;
578 double m_lineGradientD1;
579 double m_fillGradientD2;
580 double m_lineGradientD2;
581 GradientArray m_fillGradient;
582 GradientArray m_lineGradient;
583 agg::trans_affine m_fillGradientMatrix;
584 agg::trans_affine m_lineGradientMatrix;
585 agg::span_interpolator_linear<> m_fillGradientInterpolator;
586 agg::span_interpolator_linear<> m_lineGradientInterpolator;
588 agg::gradient_x m_linearGradientFunction;
589 agg::gradient_circle m_radialGradientFunction;
591 unsigned char* m_pdata;
632 void CopyIntoBuffer(
const wxBitmap& bitm );
636 void BlitBuffer( wxDC* dc, wxRect rect,
const wxPoint& bufferpos = wxPoint( 0, 0 ) );
640 void DrawImage(
const wxImage& image,
double x,
double y,
double width,
double height, wxUint8 Opacity = 255 );
642 void DrawImage(
const a2dImageRGBA& image,
double x,
double y,
double width,
double height, wxUint8 Opacity = 255 );
646 void DeviceDrawPixel(
int x1,
int y1,
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a );
648 void Render(
bool fillColor );
649 virtual void RenderGradient(
bool radial );
650 virtual void RenderBitmapFill();
651 virtual void RenderSetClip();
655 bool m_needbufferupdate;
659 PixFormat m_pixFormat;
661 RendererType m_renderer;
663 agg::rendering_buffer m_rendering_buffer;
697 wxImage GetImageBuffer()
const;
705 void CopyIntoBuffer(
const wxBitmap& bitm );
709 void BlitBuffer( wxDC* dc, wxRect rect,
const wxPoint& bufferpos = wxPoint( 0, 0 ) );
713 void DrawImage(
const wxImage& image,
double x,
double y,
double width,
double height, wxUint8 Opacity = 255 );
715 void DrawImage(
const a2dImageRGBA& image,
double x,
double y,
double width,
double height, wxUint8 Opacity = 255 );
719 void DeviceDrawPixel(
int x1,
int y1,
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a );
723 void Render(
bool fillColor );
724 virtual void RenderGradient(
bool radial );
725 virtual void RenderBitmapFill();
726 virtual void RenderSetClip();
730 bool m_needbufferupdate;
735 PixFormatComp m_pixFormatComp;
737 RendererBaseComp m_renBaseComp;
738 RendererSolidComp m_renSolidComp;
741 agg::rendering_buffer m_rendering_buffer;
749 class span_conv_const_alpha_rgba8
753 typedef agg::int8u alpha_type;
755 span_conv_const_alpha_rgba8( alpha_type a ) :
758 void alpha( alpha_type a ) { m_alpha = a; }
759 alpha_type alpha()
const {
return m_alpha; }
762 void generate(
color_type* colors,
int x,
int y,
unsigned len )
const
766 colors->a = colors->a * m_alpha / 255 ;
777 class span_conv_array_alpha_rgba8
781 typedef agg::int8u alpha_type;
783 span_conv_array_alpha_rgba8(
const wxImage& image, alpha_type a ) :
784 m_image( image ), m_alpha( a ) {}
787 void generate(
color_type* colors,
int x,
int y,
unsigned len )
const
791 colors->a = m_image.GetAlpha( x++, y ) * m_alpha / 255;
810 template<>
struct gradient_linear_color<rgba8>
814 gradient_linear_color() {}
815 gradient_linear_color(
const color_type& c1,
const color_type& c2 ) :
816 m_c1( c1 ), m_c2( c2 ) {}
818 color_type operator [] (
unsigned v )
const
821 c.r = ( int8u )( ( ( ( m_c2.r - m_c1.r ) *
int( v ) ) + ( m_c1.r << 8 ) ) >> 8 );
822 c.g = ( int8u )( ( ( ( m_c2.g - m_c1.g ) *
int( v ) ) + ( m_c1.g << 8 ) ) >> 8 );
823 c.b = ( int8u )( ( ( ( m_c2.b - m_c1.b ) * int( v ) ) + ( m_c1.b << 8 ) ) >> 8 );
824 c.a = ( int8u )( ( ( ( m_c2.a - m_c1.a ) * int( v ) ) + ( m_c1.a << 8 ) ) >> 8 );
828 void colors(
const color_type& c1,
const color_type& c2 )
842 typedef Source source_type;
844 typedef typename source_type::order_type order_type;
845 typedef typename color_type::value_type value_type;
846 typedef typename color_type::calc_type calc_type;
851 unsigned offset_x,
unsigned offset_y ) :
853 m_offset_x( offset_x ),
854 m_offset_y( offset_y ),
855 m_alpha( color_type::base_mask )
859 void attach( source_type& v ) { m_src = &v; }
860 source_type& source() {
return *m_src; }
861 const source_type& source()
const {
return *m_src; }
864 void offset_x(
unsigned v ) { m_offset_x = v; }
865 void offset_y(
unsigned v ) { m_offset_y = v; }
866 unsigned offset_x()
const {
return m_offset_x; }
867 unsigned offset_y()
const {
return m_offset_y; }
868 void alpha( value_type v ) { m_alpha = v; }
869 value_type alpha()
const {
return m_alpha; }
873 void generate( color_type* span,
int x,
int y,
unsigned len )
877 const value_type* p = (
const value_type* )m_src->span( x, y, len );
880 span->r = p[order_type::R];
881 span->g = p[order_type::G];
882 span->b = p[order_type::B];
883 if ( span->r == 255 && span->g == 255 && span->b == 255 )
906 plain_rect(
double x1,
double y1,
double x2,
double y2 ) :
907 m_x1( x1 ), m_y1( y1 ), m_x2( x2 ), m_y2( y2 )
909 if( x1 > x2 ) { m_x1 = x2; m_x2 = x1; }
910 if( y1 > y2 ) { m_y1 = y2; m_y2 = y1; }
913 void rect(
double x1,
double y1,
double x2,
double y2 )
915 m_x1 = x1; m_y1 = y1; m_x2 = x2; m_y2 = y2;
916 if( x1 > x2 ) { m_x1 = x2; m_x2 = x1; }
917 if( y1 > y2 ) { m_y1 = y2; m_y2 = y1; }
919 void rewind(
unsigned ) { m_status = 0;}
920 unsigned vertex(
double* x,
double* y )
925 *x = m_x1; *y = m_y1;
927 return agg::path_cmd_move_to;
930 *x = m_x2; *y = m_y1;
932 return agg::path_cmd_line_to;
935 *x = m_x2; *y = m_y2;
937 return agg::path_cmd_line_to;
940 *x = m_x1; *y = m_y2;
942 return agg::path_cmd_line_to;
945 *x = m_x1; *y = m_y1;
947 return agg::path_cmd_line_to;
951 return agg::path_cmd_end_poly | agg::path_flags_close | agg::path_flags_ccw;
953 return agg::path_cmd_stop;
virtual void ExtendClippingRegion(a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE, a2dBooleanClip clipoperation=a2dCLIP_AND)=0
extend clipping region with a polygon to which everything drawn will be clipped.
virtual void DeviceDrawPixel(int x1, int y1, unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
draw a single, unstroked pixel in device coordinates with the given color
agg::renderer_scanline_aa_solid< RendererBaseA > RendererSolidAaA
solid rendering on top of base rendering Agg
virtual void DestroyClippingRegion()=0
set clipping region off
virtual void DrawPolygon(a2dVertexArray *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)
Draw polygon in world coordinates using pointarray.
vertex array of line and arc segments.
vertex list of line and arc segments.
virtual void DrawCharStroke(wxChar c)
Draw a stroke character.
a2dDrawStyle
Define the manner in which a2dCanvasView draws to the device.
virtual wxBitmap GetSubBitmap(wxRect sub_rect) const =0
A way to get parts form the buffer that is drawn into.
virtual void DrawRoundedRectangle(double x, double y, double width, double height, double radius, bool pixelsize=false)
Draw RoundedRectangle in world coordinates.
virtual void ResetStyle()
set a pre-defined style reseting cashed values.
virtual void DrawCharDc(wxChar c)
Draw a dc character.
virtual void DrawPoint(double xc, double yc)=0
draw a single point
virtual void DrawPolyPolygon(a2dListOfa2dVertexList polylist, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)
draw a list of polygons ( contour clockwise becomes hole )
the antigrain based drawing context derived from a2dDrawer2D
Drawing context abstraction.
virtual void DrawImage(const wxImage &image, double x, double y, double width, double height, wxUint8 Opacity=255)=0
Draw wxImage in world coordinates.
bool HasAlpha()
does a derived drawer have alpha support or not
virtual void ShiftBuffer(int dxy, bool yshift)
quick scroll over small distance
agg::renderer_base< PixFormatA > RendererBaseA
base rendering Agg
virtual void DoSetActiveStroke()=0
per drawer implementation
virtual void DoSetActiveFill()=0
per drawer implementation
wxImage & GetImageBuffer()
return wxImage which is used as buffer here
the antigrain based drawing context derived from a2dDrawer2D
agg::pixfmt_rgba32 PixFormatA
color format in a2dAggDrawer
agg::rgba8 color_type
color format in a2dAggDrawer
virtual void ExtendAndPushClippingRegion(a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE, a2dBooleanClip clipoperation=a2dCLIP_AND)=0
push on stack the current clipping region and extend clipping region
virtual void SetClippingRegion(a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)=0
set clipping region from polygon to which everything drawn will be clipped.
wxDC * GetDeviceDC() const
get the DC that is used for rendering
Contains graphical drawing context specific classes. a2dDrawer2D and derived classes are used for dra...
a2dBooleanClip
Used for defining how a ClippingRegion defined as a polygon is combined with.
virtual void DrawCharFreetype(wxChar c)
Draw a freetype character.
virtual void SetClippingRegionDev(wxCoord minx, wxCoord miny, wxCoord maxx, wxCoord maxy)=0
set clipping region using x y values in device coordinates
virtual wxBitmap GetBuffer() const =0
Return the buffer as a bitmap.
virtual void BeginDraw()=0
start to draw on this context (used to initialize a specific drawer)
void BlitBuffer()
blit whole buffer to device
virtual void PopClippingRegion()=0
pop a previously pushed clipping region
virtual void EndDraw()=0
end drawing on this context (used to reset a specific drawer)
virtual void DrawEllipse(double x, double y, double width, double height)
Draw Ellipse in world coordinates.
virtual void SetBufferSize(int w, int h)=0
Change the buffer size.
virtual void DrawCircle(double x, double y, double radius)
Draw Circle in world coordinates.
agg::renderer_base< PixFormat > RendererBase
base rendering Agg
virtual void DrawLines(a2dVertexArray *points, bool spline=false)
Draw polyline in world coordinates using pointarray.
a2dStrokeStyle
stroke styles for a2dStroke
agg::renderer_scanline_aa_solid< RendererBase > RendererSolidAa
solid rendering on top of base rendering Agg