@@ -391,12 +391,6 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
391
391
// segments, trans, clipbox, colors, linewidths, antialiaseds
392
392
Py::SeqBase<Py::Object> segments = args[0 ];
393
393
394
- /* this line is broken, mysteriously
395
- if (!Transformation::check(args[1]))
396
- throw Py::TypeError("RendererAgg::draw_line_collection(segments, transform, ...) expected a Transformation instance for transform");
397
-
398
- */
399
-
400
394
Transformation* transform = static_cast <Transformation*>(args[1 ].ptr ());
401
395
402
396
set_clip_from_bbox (args[2 ]);
@@ -420,8 +414,9 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
420
414
size_t Naa = antialiaseds.length ();
421
415
size_t Noffsets = 0 ;
422
416
size_t N = Nsegments;
417
+ size_t Ndash = 0 ;
423
418
424
- Py::Tuple dashtup (linestyle);
419
+ Py::SeqBase<Py::Object> dashtup (linestyle);
425
420
bool useDashes = dashtup[0 ].ptr () != Py_None;
426
421
427
422
double offset = 0 ;
@@ -435,14 +430,14 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
435
430
offset = points_to_pixels_snapto (dashtup[0 ]);
436
431
dashSeq = dashtup[1 ];
437
432
438
- size_t N = dashSeq.length ();
439
- if (N %2 != 0 )
433
+ Ndash = dashSeq.length ();
434
+ if (Ndash %2 != 0 )
440
435
throw Py::ValueError (Printf (" dashes must be an even length sequence; found %d" , N).str ());
441
436
442
- dasha = new double [N ];
437
+ dasha = new double [Ndash ];
443
438
444
- for (size_t i=0 ; i<N ; i++)
445
- dasha[i] = points_to_pixels_snapto (dashSeq[i]);
439
+ for (size_t i=0 ; i<Ndash ; i++)
440
+ dasha[i] = points_to_pixels (dashSeq[i]);
446
441
}
447
442
448
443
@@ -453,11 +448,11 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
453
448
454
449
double xo (0.0 ), yo (0.0 ), thisx (0.0 ), thisy (0.0 );
455
450
std::pair<double , double > xy;
456
- Py::Tuple xyo;
451
+ Py::SeqBase<Py::Object> xyo;
457
452
Py::SeqBase<Py::Object> xys;
458
453
for (size_t i=0 ; i<N; ++i) {
459
454
if (usingOffsets) {
460
- xyo = Py::Tuple (offsets[i%Noffsets]);
455
+ xyo = Py::SeqBase<Py::Object> (offsets[i%Noffsets]);
461
456
xo = Py::Float (xyo[0 ]);
462
457
yo = Py::Float (xyo[1 ]);
463
458
try {
@@ -516,32 +511,9 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
516
511
}
517
512
else {
518
513
519
- /*
520
- size_t N = dashSeq.length();
521
- if (N%2 != 0 )
522
- throw Py::ValueError(Printf("dashes must be an even length sequence; found %d", N).str());
523
-
524
- typedef agg::conv_dash<agg::path_storage> dash_t;
525
- dash_t dash(path);
526
-
527
- double on, off;
528
-
529
- //dash.dash_start(offset);
530
- for (size_t i=0; i<N/2; i+=1) {
531
- on = points_to_pixels_snapto(dashSeq[2*i]);
532
- off = points_to_pixels_snapto(dashSeq[2*i+1]);
533
- dash.add_dash(on, off);
534
- }
535
- agg::conv_stroke<dash_t> stroke(dash);
536
- stroke.line_cap(cap);
537
- stroke.line_join(join);
538
- stroke.width(lw);
539
- theRasterizer->add_path(stroke);
540
-
541
- */
542
514
dash_t dash (path);
543
515
// dash.dash_start(offset);
544
- for (size_t idash=0 ; idash<N /2 ; idash++)
516
+ for (size_t idash=0 ; idash<Ndash /2 ; idash++)
545
517
dash.add_dash (dasha[2 *idash], dasha[2 *idash+1 ]);
546
518
547
519
agg::conv_stroke<dash_t > stroke (dash);
@@ -552,7 +524,7 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
552
524
}
553
525
554
526
// get the color and render
555
- Py::Tuple rgba = Py::Tuple (colors[ i%Nc]);
527
+ Py::SeqBase< Py::Object> rgba (colors[ i%Nc]);
556
528
double r = Py::Float (rgba[0 ]);
557
529
double g = Py::Float (rgba[1 ]);
558
530
double b = Py::Float (rgba[2 ]);
@@ -650,13 +622,13 @@ RendererAgg::draw_poly_collection(const Py::Tuple& args) {
650
622
size_t N = (Noffsets>Nverts) ? Noffsets : Nverts;
651
623
652
624
std::pair<double , double > xyo, xy;
653
- Py::Tuple thisverts;
625
+ Py::SeqBase<Py::Object> thisverts;
654
626
for (size_t i=0 ; i<N; ++i) {
655
627
656
628
thisverts = verts[i % Nverts];
657
629
658
630
if (usingOffsets) {
659
- Py::Tuple pos = Py::Tuple (offsets[i]);
631
+ Py::SeqBase<Py::Object> pos = Py::SeqBase<Py::Object> (offsets[i]);
660
632
double xo = Py::Float (pos[0 ]);
661
633
double yo = Py::Float (pos[1 ]);
662
634
try {
@@ -671,14 +643,14 @@ RendererAgg::draw_poly_collection(const Py::Tuple& args) {
671
643
size_t Nverts = thisverts.length ();
672
644
agg::path_storage path;
673
645
674
- Py::Tuple thisvert;
646
+ Py::SeqBase<Py::Object> thisvert;
675
647
676
648
677
649
// dump the verts to double arrays so we can do more efficient
678
650
// look aheads and behinds when doing snapto pixels
679
651
double xs[Nverts], ys[Nverts];
680
652
for (size_t j=0 ; j<Nverts; ++j) {
681
- thisvert = Py::Tuple ( thisverts[j]) ;
653
+ thisvert = thisverts[j];
682
654
double x = Py::Float (thisvert[0 ]);
683
655
double y = Py::Float (thisvert[1 ]);
684
656
try {
@@ -730,7 +702,7 @@ RendererAgg::draw_poly_collection(const Py::Tuple& args) {
730
702
path.close_polygon ();
731
703
int isaa = Py::Int (antialiaseds[i%Naa]);
732
704
// get the facecolor and render
733
- Py::Tuple rgba = Py::Tuple (facecolors[ i%Nface]);
705
+ Py::SeqBase<Py::Object> rgba = Py::SeqBase<Py::Object> (facecolors[ i%Nface]);
734
706
double r = Py::Float (rgba[0 ]);
735
707
double g = Py::Float (rgba[1 ]);
736
708
double b = Py::Float (rgba[2 ]);
@@ -751,7 +723,7 @@ RendererAgg::draw_poly_collection(const Py::Tuple& args) {
751
723
} // renderer face
752
724
753
725
// get the edgecolor and render
754
- rgba = Py::Tuple (edgecolors[ i%Nedge]);
726
+ rgba = Py::SeqBase<Py::Object> (edgecolors[ i%Nedge]);
755
727
r = Py::Float (rgba[0 ]);
756
728
g = Py::Float (rgba[1 ]);
757
729
b = Py::Float (rgba[2 ]);
@@ -829,16 +801,16 @@ RendererAgg::draw_regpoly_collection(const Py::Tuple& args) {
829
801
// dump the x.y vertices into a double array for faster access
830
802
double xverts[Nverts];
831
803
double yverts[Nverts];
832
- Py::Tuple xy;
804
+ Py::SeqBase<Py::Object> xy;
833
805
for (size_t i=0 ; i<Nverts; ++i) {
834
- xy = Py::Tuple (verts[i]);
806
+ xy = Py::SeqBase<Py::Object> (verts[i]);
835
807
xverts[i] = Py::Float (xy[0 ]);
836
808
yverts[i] = Py::Float (xy[1 ]);
837
809
}
838
810
839
811
std::pair<double , double > offsetPair;
840
812
for (size_t i=0 ; i<Noffsets; ++i) {
841
- Py::Tuple pos = Py::Tuple (offsets[i]);
813
+ Py::SeqBase<Py::Object> pos = Py::SeqBase<Py::Object> (offsets[i]);
842
814
double xo = Py::Float (pos[0 ]);
843
815
double yo = Py::Float (pos[1 ]);
844
816
try {
@@ -867,7 +839,7 @@ RendererAgg::draw_regpoly_collection(const Py::Tuple& args) {
867
839
path.close_polygon ();
868
840
int isaa = Py::Int (antialiaseds[i%Naa]);
869
841
// get the facecolor and render
870
- Py::Tuple rgba = Py::Tuple (facecolors[ i%Nface]);
842
+ Py::SeqBase<Py::Object> rgba = Py::SeqBase<Py::Object> (facecolors[ i%Nface]);
871
843
double r = Py::Float (rgba[0 ]);
872
844
double g = Py::Float (rgba[1 ]);
873
845
double b = Py::Float (rgba[2 ]);
@@ -888,7 +860,7 @@ RendererAgg::draw_regpoly_collection(const Py::Tuple& args) {
888
860
} // renderer face
889
861
890
862
// get the edgecolor and render
891
- rgba = Py::Tuple (edgecolors[ i%Nedge]);
863
+ rgba = Py::SeqBase<Py::Object> (edgecolors[ i%Nedge]);
892
864
r = Py::Float (rgba[0 ]);
893
865
g = Py::Float (rgba[1 ]);
894
866
b = Py::Float (rgba[2 ]);
0 commit comments