bernhard: thuban/Extensions/svgexport/test test_svgmapwriter.py, 1.9, 1.10

Bernhard Herzog bh at intevation.de
Tue Dec 7 12:37:52 CET 2004


cvs at intevation.de writes:

> +    def test_drawbezier(self):
> +        '''Test DrawSpline (which actually draws bezier curves).'''
> +        data = ('<path style="stroke-linejoin:round; stroke:#ff00ff; '
> +                'stroke-width:3; stroke-linecap:round; fill:none" ' 
> +                'meta="Object:test; Label:nothing" d="M 10 10 '
> +                'C 15 12 15 8.0 20 10"/>')
> +        file = StringIO.StringIO()
> +        dc = VirtualDC(file)
> +        dc.SetPen(self.solid_pen)
> +        dc.SetMeta(self.meta)
> +        dc.SetBrush(self.trans_brush)
> +        dc.DrawSpline([ Point(10, 10),
> +                        Point(15, 12),
> +                        Point(15,  8.0),
> +                        Point(20, 10) ])

Looking at the DrawSpline code in wxWidgets, it seems that the
coordinates of the spline do not translate directly to the coordinates
of the control points of a cubic bezier curve as you assume here.
Rather a cubic bezier curve derived in some other fashion from the
parameters to DrawSpline.  The docs say that the algorithm was taken
from XFig, so I'd assume it's what XFig <= 3.1 calls interpolated
splines.  I have no time to analyse this further, though.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                           http://skencil.org/
Thuban                                  http://thuban.intevation.org/




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)