On 04.04.08, Maximilian Schultz wrote:
> I am trying to do some ugly pyx hacks in order to insert Postscript 3
Ugly hacks are not supported, only elegant ones :-)
> So there is some path, p and a filling style. What the processPS method
> of the filling style needs is the bounding box of the path. But I have
> not found any way to tell it the method.
> Ok, where am I?
In Berlin? ;-)
> I realised that the style is written to the EPS file in the _writestyles
> methos in processPS of the decoratedpath module. So far so good.
Note that these methods are really just an implementation detail of the
> The decorated path is a normpath whose bounding box I can easily
No, not really. The decoratedpath is the path or normpath "adapated" to
a canvasitem instance. In other words, it is a class wrapping a path /
normpath such that it be inserted into a canvas.
> But what is transfered as a parameter to the _writingstyle method is
> not the bounding box of the decorated path but, most often a
> bbox.empty instance, namely the argument of the processPS method.
The processPS method gets the current bounding box when the PS or EPS
file is being written. For the first canvasitems, this bounding box will
be empty, but later on that's no longer the case. As a rule of thumb,
you should not need to actually look at bbox at all, but just update it,
i.e. enlarge it to comprise the thing you are drawing.
> And this is, for my eyes, not actually related to the bounding box of
> the path itself.
As just explained, there's indeed no relation between the two, at least
when entering the method. When returning from it, the bounding box of
the path should be contained in the bbox which has been updated
> I also do not see, where the argument of the processPS method is set
> that is, which method/object actually calls the method.
It is the pswriter which initially calls the processPS method of a page,
which in turn calls the processPS method of the canvas...
> I'd appreciate it very much, if someone could point out where and how
> I can give my little decorator the bounding box of the path it's got
> to decorate.
The bottom line is: Just use
bbox += path.bbox()
I agree that these things can be confusing when you're seeing them for
the first time. I hope, the general idea is a bit clear now.