|
From: Michael J G. <mic...@us...> - 2011-07-22 12:09:47
|
Highlighting bbox issues.
---
I failed to install whatever I need from zope, I hope the example builds.
---
examples/drawing2/INDEX | 1 +
examples/drawing2/epsbbox.py | 23 +++++++++++++++++++++++
examples/drawing2/epsbbox.txt | 14 ++++++++++++++
3 files changed, 38 insertions(+), 0 deletions(-)
create mode 100644 examples/drawing2/epsbbox.py
create mode 100644 examples/drawing2/epsbbox.txt
diff --git a/examples/drawing2/INDEX b/examples/drawing2/INDEX
index e547b1b..e2f9ae5 100644
--- a/examples/drawing2/INDEX
+++ b/examples/drawing2/INDEX
@@ -3,3 +3,4 @@ insert
smoothed
parallel
clipping
+epsbbox
diff --git a/examples/drawing2/epsbbox.py b/examples/drawing2/epsbbox.py
new file mode 100644
index 0000000..408183f
--- /dev/null
+++ b/examples/drawing2/epsbbox.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# -*- coding: ISO-8859-1 -*-
+from pyx import *
+
+r = canvas.canvas()
+r.stroke(path.line(0, 0, 0.15, 0.15))
+r.writeEPSfile("epsbbox-inc", bboxenlarge=0)
+
+s = canvas.canvas()
+s.insert(r, [trafo.scale(10)])
+elow = epsfile.epsfile(0, 0, "epsbbox-inc.eps", scale=10)
+ehigh = epsfile.epsfile(0, 0, "epsbbox-inc.eps", scale=10, hiresbbox=1)
+
+c = canvas.canvas()
+x = 0
+
+for cc in [s, elow, ehigh]:
+ c.stroke(cc.bbox().rect(), [color.rgb.red, trafo.translate(x,0)])
+ c.insert(cc, [trafo.translate(x,0)])
+ x += cc.bbox().width()*1.2
+
+c.writeEPSfile("epsbbox")
+c.writePDFfile("epsbbox")
diff --git a/examples/drawing2/epsbbox.txt b/examples/drawing2/epsbbox.txt
new file mode 100644
index 0000000..7b82c60
--- /dev/null
+++ b/examples/drawing2/epsbbox.txt
@@ -0,0 +1,14 @@
+EPS-file inclusion and bounding boxes
+
+In this example we first generate an EPS-file and write it out.
+Reading an EPS-file with `epsfile.epsfile()` gives you a canvas which can be
+inserted just like other canvases. Note how you can scale the EPS when it is read.
+
+Like many others, PyX writes out high resolution bounding boxes.
+By default it reads the normal bounding boxes, but using `hiresbbox=1` you can
+instruct PyX to use the high resolution version. Note the difference between the
+middle (low res bbox) and right (high res bbox) boxes.
+
+!The difference between left (canvas bbox) and right (high res eps bbox) is due to
+fact that PyX can take into account the width of the line only for the bounding
+box calculation during the output of the EPS.
--
1.7.6.336.gdf067
|