1 # -*- encoding: utf-8 -*-
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
27 """Base class for everything which can be inserted into a canvas"""
30 """return bounding box of canvasitem"""
31 raise NotImplementedError()
33 def requiretextregion(self
):
34 """indicates whether a canvasitem needs to be part of a PDF text
38 def processPS(self
, file, writer
, context
, registry
, bbox
):
39 """process canvasitem by writing the corresponding PS code to file and
40 by updating context, registry as well as bbox
42 - the PS code corresponding to the canvasitem has to be written in the
43 stream file, which provides a write(string) method
44 - writer is the PSwriter used for the output
45 - context is an instance of pswriter.context which is used for keeping
46 track of the graphics state (current linewidth, colorspace and font,
48 - registry is used for tracking resources needed by the canvasitem
49 - bbox has to be updated to include the bounding box of the canvasitem
51 raise NotImplementedError()
53 def processPDF(self
, file, writer
, context
, registry
, bbox
):
54 """process canvasitem by writing the corresponding PDF code to file and
55 by updating context, registry as well as bbox
57 - the PDF code corresponding to the canvasitem has to be written in the
58 stream file, which provides a write(string) method
59 - writer is the PDFwriter used for the output, which contains properties
60 like whether streamcompression is used
61 - context is an instance of pdfwriter.context which is used for keeping
62 track of the graphics state, in particular for the emulation of PS
63 behaviour regarding fill and stroke styles, for keeping track of the
64 currently selected font as well as of text regions.
65 - registry is used for tracking resources needed by the canvasitem
66 - bbox has to be updated to include the bounding box of the canvasitem
68 raise NotImplementedError()
71 class deformer(attr
.attr
):
73 def deform(self
, basepath
):
74 raise NotImplementedError()