Hi René,

multilineto_pt is just an performance (and memory optimization), but does not 
bring any new features technically. Also, we provided it in postscript points 
only (hence the _pt suffix), so it is not the usual api to be used by end 
users. (Instead it is used to improve performance for certain graph plottings.)

Now, consider we want to construct a square of 100pt x 100 pt with 
multilineto_pt, it'll look like:

    p = path.path()
    p.append(path.moveto_pt(0, 0))
    p.append(path.multilineto_pt([(100, 0), (100, 100), (0, 100)]))
    p.append(path.closepath())

We can achieve the same by using simple path elements like this:

    p = path.path()
    p.append(path.moveto_pt(0, 0))
    p.append(path.lineto_pt(100, 0))
    p.append(path.lineto_pt(100, 100))
    p.append(path.lineto_pt(0, 100))
    p.append(path.closepath())

It's just a few more objects being created, but the output is identical.

Now we can transfer it to use relative coordinates:

    p = path.path()
    p.append(path.moveto_pt(0, 0))
    p.append(path.rlineto_pt(100, 0))
    p.append(path.rlineto_pt(0, 100))
    p.append(path.rlineto_pt(-100, 0))
    p.append(path.closepath())

and also create the path using a list of points like this:

    p = path.path()
    p.append(path.moveto_pt(0, 0))
    for x_pt, y_pt in [(100, 0), (0, 100), (-100, 0)]:
        p.append(path.rlineto_pt(x_pt, y_pt))
    p.append(path.closepath())

When you compare it to the starting point, you'll notice that instead of 
appending the (non-existing) path.multirlineto_pt to a path, you need to insert 
a number of rlineto_pt elements:

    p.append(path.multirlineto_pt([(100, 0), (0, 100), (-100, 0)])) # does not 
exist in PyX

is equivalent to

    for x_pt, y_pt in [(100, 0), (0, 100), (-100, 0)]:
        p.append(path.rlineto_pt(x_pt, y_pt))

Note that all this has nothing to do with gsave and grestore, which is only 
related to the Postscript graphics state. You can translate the path and insert 
it multiple times as you wish:

    c.fill(p, [trafo.translate(1, 1)])
    c.fill(p, [trafo.translate(2, 2)])

PyX does not optimize the output by storing such paths once on the stack and 
reuse it multiple times, nor does it make use of "use"-tags in svg. This could 
be done, but it just an output optimization.

Best,


André

Am 29.01.2016 um 16:25 schrieb [email protected]:

> 
> Please, use https://translate.google.de or https://translate.google.fr
> 
> 2016.01.28
> 
> Guten Abend,
> 
> ich habe eine Sammlung von Musikzeichen (Alterationen, Dynamik usw) in
> PostScript (ursprünglich von Daniel Taupin); ich habe einige nach SVG
> übersetzt. 
> 
> Die Übersetzung nach PyX geht fehl, weil 'multilineto_pt'
> absolute (x, y) erwartet.
> 
> Wäre eine Klasse 'multirlineto_pt' möglich? 
> 
> In den EPS-files: Abkapselung durch gsave ... grestore.
> 
> In den SVG-file,  Anwendung der Symbole mit '<use .../>':
> z.B.:
> <use xlink:href="#diese" x="2800" y="-1500" transform="scale(0.1,-0.1)" />
> 
> Oder gibt's das schon irgendwo in PyX ?
> (Ellipsen gibt es auch, nur nicht im Manual :)
> 
> 
> René Bastian
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> _______________________________________________
> PyX-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyx-user

-- 
by  _ _      _    Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
   / \ \    / )   [email protected], http://www.wobsta.de/
  / _ \ \/\/ /    PyX - High quality PostScript and PDF figures
 (_/ \_)_/\_/     with Python & TeX: visit http://pyx.sourceforge.net/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to