[metapost] reverse clip operation

lfinsto1 at gwdg.de lfinsto1 at gwdg.de
Wed Sep 20 13:59:38 CEST 2006


> lfinsto1 at gwdg.de wrote:
>

> My aim would be to:
>    1) draw the red ellipse
>    2) draw (and clip) the black line
>
> That should be all. A third operation like:
>    3) repaint red ellipse
> should be unnecessary.

The point I'm trying to make involves a distinction between placing items
onto a `picture' and drawing, i.e., placing items onto `currentpicture'
for output in a figure.  You can place the red ellipse on a picture, and
in general, perform operations on and with pictures and other objects,
without outputting the image.  I find it very useful to create pictures
this way and then combine them in figures.  If it's a matter of minimizing
the amount of PostScript that's output, I don't know what actually
happens, so you may not be gaining anything this way.  On the other hand,
this has never been a practical consideration for me.  Sometimes I just
draw on `currentpicture' and then set it to `nullpicture', if I don't want
the image, simply because it's more convenient to use `draw', `fill',
etc., instead of `addto ... also'.  I'll even reuse figure numbers.

It seems to me that you could get the result you want by creating your
pictures without putting them onto `currentpicture', calculating your
points, drawing your lines, and then adding your pictures to
`currentpicture'.  The latter step will cover the unwanted parts of the
lines.  I'd have to test this, since I'm a bit hazy about what `pictures'
are in MP.  If it got too complicated, I would just use MP in combination
with ImageMagick, as I mentioned before.

Of course, I suppose trying to minimize the amount of PostScript code
generated might be useful and/or necessary in some situations.  It could
even just be an interesting puzzle, and there's nothing wrong with that.

Laurence



More information about the metapost mailing list