fix race condition by Michael J Gruber
[PyX/mjg.git] / pyx / canvasitem.py
blob75088239052e395faf3687177fcf61c7fdc9a1fe
1 # -*- coding: ISO-8859-1 -*-
4 # Copyright (C) 2002-2007 Jörg Lehmann <joergl@users.sourceforge.net>
5 # Copyright (C) 2002-2007 André Wobst <wobsta@users.sourceforge.net>
7 # This file is part of PyX (http://pyx.sourceforge.net/).
9 # PyX is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # PyX is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with PyX; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 class canvasitem:
25 """Base class for everything which can be inserted into a canvas"""
27 def bbox(self):
28 """return bounding box of canvasitem"""
29 pass
31 def processPS(self, file, writer, context, registry, bbox):
32 """process canvasitem by writing the corresponding PS code to file and
33 by updating context, registry as well as bbox
35 - the PS code corresponding to the canvasitem has to be written in the
36 stream file, which provides a write(string) method
37 - writer is the PSwriter used for the output
38 - context is an instance of pswriter.context which is used for keeping
39 track of the graphics state (current linewidth, colorspace and font))
40 - registry is used for tracking resources needed by the canvasitem
41 - bbox has to be updated to include the bounding box of the canvasitem
42 """
43 raise NotImplementedError()
45 def processPDF(self, file, writer, context, registry, bbox):
46 """process canvasitem by writing the corresponding PDF code to file and
47 by updating context, registry as well as bbox
49 - the PDF code corresponding to the canvasitem has to be written in the
50 stream file, which provides a write(string) method
51 - writer is the PDFwriter used for the output, which contains properties
52 like whether streamcompression is used
53 - context is an instance of pdfwriter.context which is used for keeping
54 track of the graphics state, in particular for the emulation of PS
55 behaviour regarding fill and stroke styles, for keeping track of the
56 currently selected font as well as of text regions.
57 - registry is used for tracking resources needed by the canvasitem
58 - bbox has to be updated to include the bounding box of the canvasitem
59 """
60 raise NotImplementedError()