@@ -296,23 +296,15 @@ template <class path_t>
296
296
inline void
297
297
RendererAgg::_draw_path (path_t &path, bool has_clippath, const facepair_t &face, GCAgg &gc)
298
298
{
299
- typedef agg::conv_stroke<path_t > stroke_t ;
300
- typedef agg::conv_dash<path_t > dash_t ;
301
- typedef agg::conv_stroke<dash_t > stroke_dash_t ;
302
- typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type;
303
- typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
304
- typedef agg::renderer_scanline_aa_solid<amask_ren_type> amask_aa_renderer_type;
305
- typedef agg::renderer_scanline_bin_solid<amask_ren_type> amask_bin_renderer_type;
306
-
307
299
// Render face
308
300
if (face.first ) {
309
301
theRasterizer.add_path (path);
310
302
311
303
if (gc.isaa ) {
312
304
if (has_clippath) {
313
- pixfmt_amask_type pfa ( pixFmt, alphaMask) ;
314
- amask_ren_type r ( pfa) ;
315
- amask_aa_renderer_type ren (r) ;
305
+ auto pfa = agg::pixfmt_amask_adaptor{ pixFmt, alphaMask} ;
306
+ auto r = agg::renderer_base{ pfa} ;
307
+ auto ren = agg::renderer_scanline_aa_solid{r} ;
316
308
ren.color (face.second );
317
309
agg::render_scanlines (theRasterizer, scanlineAlphaMask, ren);
318
310
} else {
@@ -321,9 +313,9 @@ RendererAgg::_draw_path(path_t &path, bool has_clippath, const facepair_t &face,
321
313
}
322
314
} else {
323
315
if (has_clippath) {
324
- pixfmt_amask_type pfa ( pixFmt, alphaMask) ;
325
- amask_ren_type r ( pfa) ;
326
- amask_bin_renderer_type ren (r) ;
316
+ auto pfa = agg::pixfmt_amask_adaptor{ pixFmt, alphaMask} ;
317
+ auto r = agg::renderer_base{ pfa} ;
318
+ auto ren = agg::renderer_scanline_bin_solid{r} ;
327
319
ren.color (face.second );
328
320
agg::render_scanlines (theRasterizer, scanlineAlphaMask, ren);
329
321
} else {
@@ -341,19 +333,15 @@ RendererAgg::_draw_path(path_t &path, bool has_clippath, const facepair_t &face,
341
333
rendererBase.reset_clipping (true );
342
334
343
335
// Create and transform the path
344
- typedef agg::conv_transform<mpl::PathIterator> hatch_path_trans_t ;
345
- typedef agg::conv_curve<hatch_path_trans_t > hatch_path_curve_t ;
346
- typedef agg::conv_stroke<hatch_path_curve_t > hatch_path_stroke_t ;
347
-
348
336
mpl::PathIterator hatch_path (gc.hatchpath );
349
337
agg::trans_affine hatch_trans;
350
338
hatch_trans *= agg::trans_affine_scaling (1.0 , -1.0 );
351
339
hatch_trans *= agg::trans_affine_translation (0.0 , 1.0 );
352
340
hatch_trans *= agg::trans_affine_scaling (static_cast <double >(hatch_size),
353
341
static_cast <double >(hatch_size));
354
- hatch_path_trans_t hatch_path_trans ( hatch_path, hatch_trans) ;
355
- hatch_path_curve_t hatch_path_curve ( hatch_path_trans) ;
356
- hatch_path_stroke_t hatch_path_stroke ( hatch_path_curve) ;
342
+ auto hatch_path_trans = agg::conv_transform{ hatch_path, hatch_trans} ;
343
+ auto hatch_path_curve = agg::conv_curve{ hatch_path_trans} ;
344
+ auto hatch_path_stroke = agg::conv_stroke{ hatch_path_curve} ;
357
345
hatch_path_stroke.width (points_to_pixels (gc.hatch_linewidth ));
358
346
hatch_path_stroke.line_cap (agg::square_cap);
359
347
@@ -377,18 +365,16 @@ RendererAgg::_draw_path(path_t &path, bool has_clippath, const facepair_t &face,
377
365
}
378
366
379
367
// Transfer the hatch to the main image buffer
380
- typedef agg::image_accessor_wrap<pixfmt,
381
- agg::wrap_mode_repeat_auto_pow2,
382
- agg::wrap_mode_repeat_auto_pow2> img_source_type;
383
- typedef agg::span_pattern_rgba<img_source_type> span_gen_type;
384
368
agg::span_allocator<agg::rgba8> sa;
385
- img_source_type img_src (hatch_img_pixf);
386
- span_gen_type sg (img_src, 0 , 0 );
369
+ auto img_src = agg::image_accessor_wrap<
370
+ pixfmt, agg::wrap_mode_repeat_auto_pow2, agg::wrap_mode_repeat_auto_pow2>{
371
+ hatch_img_pixf};
372
+ auto sg = agg::span_pattern_rgba{img_src, 0 , 0 };
387
373
theRasterizer.add_path (path);
388
374
389
375
if (has_clippath) {
390
- pixfmt_amask_type pfa ( pixFmt, alphaMask) ;
391
- amask_ren_type ren ( pfa) ;
376
+ auto pfa = agg::pixfmt_amask_adaptor{ pixFmt, alphaMask} ;
377
+ auto ren = agg::renderer_base{ pfa} ;
392
378
agg::render_scanlines_aa (theRasterizer, slineP8, ren, sa, sg);
393
379
} else {
394
380
agg::render_scanlines_aa (theRasterizer, slineP8, rendererBase, sa, sg);
@@ -402,16 +388,16 @@ RendererAgg::_draw_path(path_t &path, bool has_clippath, const facepair_t &face,
402
388
linewidth = (linewidth < 0.5 ) ? 0.5 : mpl_round (linewidth);
403
389
}
404
390
if (gc.dashes .size () == 0 ) {
405
- stroke_t stroke ( path) ;
391
+ auto stroke = agg::conv_stroke{ path} ;
406
392
stroke.width (points_to_pixels (gc.linewidth ));
407
393
stroke.line_cap (gc.cap );
408
394
stroke.line_join (gc.join );
409
395
stroke.miter_limit (points_to_pixels (gc.linewidth ));
410
396
theRasterizer.add_path (stroke);
411
397
} else {
412
- dash_t dash ( path) ;
398
+ auto dash = agg::conv_dash{ path} ;
413
399
gc.dashes .dash_to_stroke (dash, dpi, gc.isaa );
414
- stroke_dash_t stroke ( dash) ;
400
+ auto stroke = agg::conv_stroke{ dash} ;
415
401
stroke.line_cap (gc.cap );
416
402
stroke.line_join (gc.join );
417
403
stroke.width (linewidth);
@@ -421,9 +407,9 @@ RendererAgg::_draw_path(path_t &path, bool has_clippath, const facepair_t &face,
421
407
422
408
if (gc.isaa ) {
423
409
if (has_clippath) {
424
- pixfmt_amask_type pfa ( pixFmt, alphaMask) ;
425
- amask_ren_type r ( pfa) ;
426
- amask_aa_renderer_type ren (r) ;
410
+ auto pfa = agg::pixfmt_amask_adaptor{ pixFmt, alphaMask} ;
411
+ auto r = agg::renderer_base{ pfa} ;
412
+ auto ren = agg::renderer_scanline_aa_solid{r} ;
427
413
ren.color (gc.color );
428
414
agg::render_scanlines (theRasterizer, scanlineAlphaMask, ren);
429
415
} else {
@@ -432,9 +418,9 @@ RendererAgg::_draw_path(path_t &path, bool has_clippath, const facepair_t &face,
432
418
}
433
419
} else {
434
420
if (has_clippath) {
435
- pixfmt_amask_type pfa ( pixFmt, alphaMask) ;
436
- amask_ren_type r ( pfa) ;
437
- amask_bin_renderer_type ren (r) ;
421
+ auto pfa = agg::pixfmt_amask_adaptor{ pixFmt, alphaMask} ;
422
+ auto r = agg::renderer_base{ pfa} ;
423
+ auto ren = agg::renderer_scanline_bin_solid{r} ;
438
424
ren.color (gc.color );
439
425
agg::render_scanlines (theRasterizer, scanlineAlphaMask, ren);
440
426
} else {
@@ -449,14 +435,6 @@ template <class PathIterator>
449
435
inline void
450
436
RendererAgg::draw_path (GCAgg &gc, PathIterator &path, agg::trans_affine &trans, agg::rgba &color)
451
437
{
452
- typedef agg::conv_transform<mpl::PathIterator> transformed_path_t ;
453
- typedef PathNanRemover<transformed_path_t > nan_removed_t ;
454
- typedef PathClipper<nan_removed_t > clipped_t ;
455
- typedef PathSnapper<clipped_t > snapped_t ;
456
- typedef PathSimplifier<snapped_t > simplify_t ;
457
- typedef agg::conv_curve<simplify_t > curve_t ;
458
- typedef Sketch<curve_t > sketch_t ;
459
-
460
438
facepair_t face (color.a != 0.0 , color);
461
439
462
440
theRasterizer.reset_clipping ();
@@ -473,13 +451,15 @@ RendererAgg::draw_path(GCAgg &gc, PathIterator &path, agg::trans_affine &trans,
473
451
snapping_linewidth = 0.0 ;
474
452
}
475
453
476
- transformed_path_t tpath (path, trans);
477
- nan_removed_t nan_removed (tpath, true , path.has_codes ());
478
- clipped_t clipped (nan_removed, clip, width, height);
479
- snapped_t snapped (clipped, gc.snap_mode , path.total_vertices (), snapping_linewidth);
480
- simplify_t simplified (snapped, simplify, path.simplify_threshold ());
481
- curve_t curve (simplified);
482
- sketch_t sketch (curve, gc.sketch .scale , gc.sketch .length , gc.sketch .randomness );
454
+ auto tpath = agg::conv_transform{path, trans};
455
+ auto nan_removed = PathNanRemover{tpath, true , path.has_codes ()};
456
+ auto clipped = PathClipper (nan_removed, clip, width, height);
457
+ auto snapped = PathSnapper{
458
+ clipped, gc.snap_mode , path.total_vertices (), snapping_linewidth};
459
+ auto simplified = PathSimplifier{snapped, simplify, path.simplify_threshold ()};
460
+ auto curve = agg::conv_curve{simplified};
461
+ auto sketch = Sketch{
462
+ curve, gc.sketch .scale , gc.sketch .length , gc.sketch .randomness };
483
463
484
464
_draw_path (sketch, has_clippath, face, gc);
485
465
}
@@ -492,28 +472,19 @@ inline void RendererAgg::draw_markers(GCAgg &gc,
492
472
agg::trans_affine &trans,
493
473
agg::rgba color)
494
474
{
495
- typedef agg::conv_transform<mpl::PathIterator> transformed_path_t ;
496
- typedef PathNanRemover<transformed_path_t > nan_removed_t ;
497
- typedef PathSnapper<nan_removed_t > snap_t ;
498
- typedef agg::conv_curve<snap_t > curve_t ;
499
- typedef agg::conv_stroke<curve_t > stroke_t ;
500
- typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type;
501
- typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
502
- typedef agg::renderer_scanline_aa_solid<amask_ren_type> amask_aa_renderer_type;
503
-
504
475
// Deal with the difference in y-axis direction
505
476
marker_trans *= agg::trans_affine_scaling (1.0 , -1.0 );
506
477
507
478
trans *= agg::trans_affine_scaling (1.0 , -1.0 );
508
479
trans *= agg::trans_affine_translation (0.5 , (double )height + 0.5 );
509
480
510
- transformed_path_t marker_path_transformed ( marker_path, marker_trans) ;
511
- nan_removed_t marker_path_nan_removed (marker_path_transformed, true , marker_path. has_codes ());
512
- snap_t marker_path_snapped (marker_path_nan_removed,
513
- gc. snap_mode ,
514
- marker_path. total_vertices () ,
515
- points_to_pixels (gc.linewidth )) ;
516
- curve_t marker_path_curve ( marker_path_snapped) ;
481
+ auto marker_path_transformed = agg::conv_transform{ marker_path, marker_trans} ;
482
+ auto marker_path_nan_removed = PathNanRemover{
483
+ marker_path_transformed, true , marker_path. has_codes ()};
484
+ auto marker_path_snapped = PathSnapper{
485
+ marker_path_nan_removed ,
486
+ gc. snap_mode , marker_path. total_vertices (), points_to_pixels (gc.linewidth )} ;
487
+ auto marker_path_curve = agg::conv_curve{ marker_path_snapped} ;
517
488
518
489
if (!marker_path_snapped.is_snapping ()) {
519
490
// If the path snapper isn't in effect, at least make sure the marker
@@ -522,10 +493,11 @@ inline void RendererAgg::draw_markers(GCAgg &gc,
522
493
marker_trans *= agg::trans_affine_translation (0.5 , 0.5 );
523
494
}
524
495
525
- transformed_path_t path_transformed (path, trans);
526
- nan_removed_t path_nan_removed (path_transformed, false , false );
527
- snap_t path_snapped (path_nan_removed, SNAP_FALSE, path.total_vertices (), 0.0 );
528
- curve_t path_curve (path_snapped);
496
+ auto path_transformed = agg::conv_transform{path, trans};
497
+ auto path_nan_removed = PathNanRemover{path_transformed, false , false };
498
+ auto path_snapped = PathSnapper{
499
+ path_nan_removed, SNAP_FALSE, path.total_vertices (), 0.0 };
500
+ auto path_curve = agg::conv_curve{path_snapped};
529
501
path_curve.rewind (0 );
530
502
531
503
facepair_t face (color.a != 0.0 , color);
@@ -559,7 +531,7 @@ inline void RendererAgg::draw_markers(GCAgg &gc,
559
531
scanlines.max_y ());
560
532
}
561
533
562
- stroke_t stroke ( marker_path_curve) ;
534
+ auto stroke = agg::conv_stroke{ marker_path_curve} ;
563
535
stroke.width (points_to_pixels (gc.linewidth ));
564
536
stroke.line_cap (gc.cap );
565
537
stroke.line_join (gc.join );
@@ -611,9 +583,9 @@ inline void RendererAgg::draw_markers(GCAgg &gc,
611
583
continue ;
612
584
}
613
585
614
- pixfmt_amask_type pfa ( pixFmt, alphaMask) ;
615
- amask_ren_type r ( pfa) ;
616
- amask_aa_renderer_type ren (r) ;
586
+ auto pfa = agg::pixfmt_amask_adaptor{ pixFmt, alphaMask} ;
587
+ auto r = agg::renderer_base{ pfa} ;
588
+ auto ren = agg::renderer_scanline_aa_solid{r} ;
617
589
618
590
if (face.first ) {
619
591
ren.color (face.second );
@@ -721,14 +693,6 @@ class font_to_rgba
721
693
template <class ImageArray >
722
694
inline void RendererAgg::draw_text_image (GCAgg &gc, ImageArray &image, int x, int y, double angle)
723
695
{
724
- typedef agg::span_allocator<agg::rgba8> color_span_alloc_type;
725
- typedef agg::span_interpolator_linear<> interpolator_type;
726
- typedef agg::image_accessor_clip<agg::pixfmt_gray8> image_accessor_type;
727
- typedef agg::span_image_filter_gray<image_accessor_type, interpolator_type> image_span_gen_type;
728
- typedef font_to_rgba<image_span_gen_type> span_gen_type;
729
- typedef agg::renderer_scanline_aa<renderer_base, color_span_alloc_type, span_gen_type>
730
- renderer_type;
731
-
732
696
theRasterizer.reset_clipping ();
733
697
rendererBase.reset_clipping (true );
734
698
if (angle != 0.0 ) {
@@ -760,12 +724,12 @@ inline void RendererAgg::draw_text_image(GCAgg &gc, ImageArray &image, int x, in
760
724
761
725
agg::image_filter_lut filter;
762
726
filter.calculate (agg::image_filter_spline36 ());
763
- interpolator_type interpolator ( inv_mtx) ;
764
- color_span_alloc_type sa;
765
- image_accessor_type ia ( pixf_img, agg::gray8 (0 )) ;
766
- image_span_gen_type image_span_generator ( ia, interpolator, filter) ;
767
- span_gen_type output_span_generator ( &image_span_generator, gc.color ) ;
768
- renderer_type ri ( rendererBase, sa, output_span_generator) ;
727
+ auto interpolator = agg::span_interpolator_linear{ inv_mtx} ;
728
+ auto sa = agg::span_allocator<agg::rgba8>{} ;
729
+ auto ia = agg::image_accessor_clip{ pixf_img, agg::gray8 (0 )} ;
730
+ auto image_span_generator = agg::span_image_filter_gray{ ia, interpolator, filter} ;
731
+ auto output_span_generator = font_to_rgba{ &image_span_generator, gc.color } ;
732
+ auto ri = agg::renderer_scanline_aa{ rendererBase, sa, output_span_generator} ;
769
733
770
734
theRasterizer.add_path (rect2);
771
735
agg::render_scanlines (theRasterizer, slineP8, ri);
@@ -861,28 +825,16 @@ inline void RendererAgg::draw_image(GCAgg &gc,
861
825
agg::trans_affine inv_mtx (mtx);
862
826
inv_mtx.invert ();
863
827
864
- typedef agg::span_allocator<agg::rgba8> color_span_alloc_type;
865
- typedef agg::image_accessor_clip<pixfmt> image_accessor_type;
866
- typedef agg::span_interpolator_linear<> interpolator_type;
867
- typedef agg::span_image_filter_rgba_nn<image_accessor_type, interpolator_type>
868
- image_span_gen_type;
869
- typedef agg::span_converter<image_span_gen_type, span_conv_alpha> span_conv;
870
-
871
- color_span_alloc_type sa;
872
- image_accessor_type ia (pixf, agg::rgba8 (0 , 0 , 0 , 0 ));
873
- interpolator_type interpolator (inv_mtx);
874
- image_span_gen_type image_span_generator (ia, interpolator);
875
- span_conv_alpha conv_alpha (alpha);
876
- span_conv spans (image_span_generator, conv_alpha);
877
-
878
- typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type;
879
- typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
880
- typedef agg::renderer_scanline_aa<amask_ren_type, color_span_alloc_type, span_conv>
881
- renderer_type_alpha;
882
-
883
- pixfmt_amask_type pfa (pixFmt, alphaMask);
884
- amask_ren_type r (pfa);
885
- renderer_type_alpha ri (r, sa, spans);
828
+ auto sa = agg::span_allocator<agg::rgba8>{};
829
+ auto ia = agg::image_accessor_clip{pixf, agg::rgba8 (0 , 0 , 0 , 0 )};
830
+ auto interpolator = agg::span_interpolator_linear{inv_mtx};
831
+ auto image_span_generator = agg::span_image_filter_rgba_nn{ia, interpolator};
832
+ auto conv_alpha = span_conv_alpha{alpha};
833
+ auto spans = agg::span_converter{image_span_generator, conv_alpha};
834
+
835
+ auto pfa = agg::pixfmt_amask_adaptor{pixFmt, alphaMask};
836
+ auto r = agg::renderer_base{pfa};
837
+ auto ri = agg::renderer_scanline_aa{r, sa, spans};
886
838
887
839
theRasterizer.add_path (rect2);
888
840
agg::render_scanlines (theRasterizer, scanlineAlphaMask, ri);
@@ -919,17 +871,6 @@ inline void RendererAgg::_draw_path_collection_generic(GCAgg &gc,
919
871
bool check_snap,
920
872
bool has_codes)
921
873
{
922
- typedef agg::conv_transform<typename PathGenerator::path_iterator> transformed_path_t ;
923
- typedef PathNanRemover<transformed_path_t > nan_removed_t ;
924
- typedef PathClipper<nan_removed_t > clipped_t ;
925
- typedef PathSnapper<clipped_t > snapped_t ;
926
- typedef agg::conv_curve<snapped_t > snapped_curve_t ;
927
- typedef agg::conv_curve<clipped_t > curve_t ;
928
- typedef Sketch<clipped_t > sketch_clipped_t ;
929
- typedef Sketch<curve_t > sketch_curve_t ;
930
- typedef Sketch<snapped_t > sketch_snapped_t ;
931
- typedef Sketch<snapped_curve_t > sketch_snapped_curve_t ;
932
-
933
874
size_t Npaths = path_generator.num_paths ();
934
875
size_t Noffsets = safe_first_shape (offsets);
935
876
size_t N = std::max (Npaths, Noffsets);
@@ -1005,27 +946,31 @@ inline void RendererAgg::_draw_path_collection_generic(GCAgg &gc,
1005
946
}
1006
947
1007
948
gc.isaa = antialiaseds (i % Naa);
1008
- transformed_path_t tpath ( path, trans) ;
1009
- nan_removed_t nan_removed ( tpath, true , has_codes) ;
1010
- clipped_t clipped (nan_removed, do_clip, width, height);
949
+ auto tpath = agg::conv_transform{ path, trans} ;
950
+ auto nan_removed = PathNanRemover{ tpath, true , has_codes} ;
951
+ auto clipped = PathClipper (nan_removed, do_clip, width, height);
1011
952
if (check_snap) {
1012
- snapped_t snapped (
1013
- clipped, gc.snap_mode , path.total_vertices (), points_to_pixels (gc.linewidth )) ;
953
+ auto snapped = PathSnapper{
954
+ clipped, gc.snap_mode , path.total_vertices (), points_to_pixels (gc.linewidth )} ;
1014
955
if (has_codes) {
1015
- snapped_curve_t curve (snapped);
1016
- sketch_snapped_curve_t sketch (curve, gc.sketch .scale , gc.sketch .length , gc.sketch .randomness );
956
+ auto curve = agg::conv_curve{snapped};
957
+ auto sketch = Sketch{
958
+ curve, gc.sketch .scale , gc.sketch .length , gc.sketch .randomness };
1017
959
_draw_path (sketch, has_clippath, face, gc);
1018
960
} else {
1019
- sketch_snapped_t sketch (snapped, gc.sketch .scale , gc.sketch .length , gc.sketch .randomness );
961
+ auto sketch = Sketch{
962
+ snapped, gc.sketch .scale , gc.sketch .length , gc.sketch .randomness };
1020
963
_draw_path (sketch, has_clippath, face, gc);
1021
964
}
1022
965
} else {
1023
966
if (has_codes) {
1024
- curve_t curve (clipped);
1025
- sketch_curve_t sketch (curve, gc.sketch .scale , gc.sketch .length , gc.sketch .randomness );
967
+ auto curve = agg::conv_curve{clipped};
968
+ auto sketch = Sketch{
969
+ curve, gc.sketch .scale , gc.sketch .length , gc.sketch .randomness };
1026
970
_draw_path (sketch, has_clippath, face, gc);
1027
971
} else {
1028
- sketch_clipped_t sketch (clipped, gc.sketch .scale , gc.sketch .length , gc.sketch .randomness );
972
+ auto sketch = Sketch{
973
+ clipped, gc.sketch .scale , gc.sketch .length , gc.sketch .randomness };
1029
974
_draw_path (sketch, has_clippath, face, gc);
1030
975
}
1031
976
}
@@ -1220,14 +1165,9 @@ inline void RendererAgg::_draw_gouraud_triangle(PointArray &points,
1220
1165
theRasterizer.add_path (span_gen);
1221
1166
1222
1167
if (has_clippath) {
1223
- typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type;
1224
- typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
1225
- typedef agg::renderer_scanline_aa<amask_ren_type, span_alloc_t , span_gen_t >
1226
- amask_aa_renderer_type;
1227
-
1228
- pixfmt_amask_type pfa (pixFmt, alphaMask);
1229
- amask_ren_type r (pfa);
1230
- amask_aa_renderer_type ren (r, span_alloc, span_gen);
1168
+ auto pfa = agg::pixfmt_amask_adaptor{pixFmt, alphaMask};
1169
+ auto r = agg::renderer_base{pfa};
1170
+ auto ren = agg::renderer_scanline_aa{r, span_alloc, span_gen};
1231
1171
agg::render_scanlines (theRasterizer, scanlineAlphaMask, ren);
1232
1172
} else {
1233
1173
agg::render_scanlines_aa (theRasterizer, slineP8, rendererBase, span_alloc, span_gen);
0 commit comments