/[escript]/trunk/pyvisi/py_src/image.py
ViewVC logotype

Contents of /trunk/pyvisi/py_src/image.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 600 - (show annotations)
Fri Mar 17 05:53:59 2006 UTC (13 years, 8 months ago) by gross
File MIME type: text/x-python
File size: 11356 byte(s)
some renaming
1 # Copyright (C) 2004-2005 Paul Cochrane
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # $Id: image.py,v 1.22 2005/03/07 07:45:48 paultcochrane Exp $
18
19 ## @file image.py
20
21 """
22 Class and functions associated with a pyvisi Image objects
23
24 Base implementation.
25 """
26
27 # generic import
28 from pyvisi.common import debugMsg, overrideWarning, unsupportedError, fileCheck
29
30 from pyvisi.item import Item
31
32 __revision__ = '$Revision: 1.22 $'
33
34 class Image(Item):
35 """
36 Image class. Generic class to handle image data.
37 """
38 def __init__(self, scene=None):
39 """
40 Initialises the Image class object
41
42 @param scene: The Scene object to add to
43 @type scene: Scene object
44 """
45 Item.__init__(self)
46 debugMsg("Called Image.__init__()")
47
48 if scene is not None:
49 self.renderer = scene.renderer
50
51 def load(self, fname):
52 """
53 Loads image data from file.
54
55 @param fname: The filename from which to load image data
56 @type fname: string
57 """
58 debugMsg("Called Image.load()")
59
60 # do a check to see if the file exists
61 fileCheck(fname)
62
63 # print a warning message if get to here
64 overrideWarning("Image.load")
65
66 return
67
68 class JpegImage(Image):
69 """
70 Subclass of Image class to explicitly handle jpeg images
71 """
72 def __init__(self, scene=None):
73 """
74 Initialises the JpegImage class object
75
76 @param scene: The Scene object to add to
77 @type scene: Scene object
78 """
79 Image.__init__(self)
80 debugMsg("Called JpegImage.__init__()")
81
82 if scene is not None:
83 self.renderer = scene.renderer
84
85 self.format = "jpeg"
86
87 def load(self, fname):
88 """
89 Loads jpeg image data from file.
90
91 @param fname: The filename from which to load jpeg image data
92 @type fname: string
93 """
94 debugMsg("Called JpegImage.load()")
95
96 # do a check to see if the file exists
97 fileCheck(fname)
98
99 # print a warning message if get to here
100 overrideWarning("JpegImage.load")
101
102 return
103
104 def render(self):
105 """
106 Does JpegImage object specific (pre)rendering stuff
107 """
108 debugMsg("Called JpegImage.render()")
109
110 # print a warning message if get to here
111 overrideWarning("JpegImage.render")
112
113 return
114
115 class PngImage(Image):
116 """
117 Subclass of Image class to explicitly handle png images
118 """
119 def __init__(self, scene=None):
120 """
121 Initialises the PngImage class object
122
123 @param scene: The Scene object to add to
124 @type scene: Scene object
125 """
126 Image.__init__(self)
127 debugMsg("Called PngImage.__init__()")
128
129 if scene is not None:
130 self.renderer = scene.renderer
131
132 self.format = "png"
133
134 def load(self, fname):
135 """
136 Loads png image data from file.
137
138 @param fname: The filename from which to load png image data
139 @type fname: string
140 """
141 debugMsg("Called PngImage.load()")
142
143 # do a check to see if the file exists
144 fileCheck(fname)
145
146 # print a warning message if get to here
147 overrideWarning("PngImage.load")
148
149 return
150
151 def render(self):
152 """
153 Does PngImage object specific (pre)rendering stuff
154 """
155 debugMsg("Called PngImage.render()")
156
157 # print a warning message if get to here
158 overrideWarning("PngImage.render")
159
160 return
161
162 class BmpImage(Image):
163 """
164 Subclass of Image class to explicitly handle bmp images
165 """
166 def __init__(self, scene=None):
167 """
168 Initialises the BmpImage class object
169
170 @param scene: The Scene object to add to
171 @type scene: Scene object
172 """
173 Image.__init__(self)
174 debugMsg("Called BmpImage.__init__()")
175
176 if scene is not None:
177 self.renderer = scene.renderer
178
179 self.format = "bmp"
180
181 def load(self, fname):
182 """
183 Loads bmp image data from file.
184
185 @param fname: The filename from which to load bmp image data
186 @type fname: string
187 """
188 debugMsg("Called BmpImage.load()")
189
190 # do a check to see if the file exists
191 fileCheck(fname)
192
193 # print a warning message if get to here
194 overrideWarning("BmpImage.load")
195
196 return
197
198 def render(self):
199 """
200 Does BmpImage object specific (pre)rendering stuff
201 """
202 debugMsg("Called BmpImage.render()")
203
204 # print a warning message if get to here
205 overrideWarning("BmpImage.render")
206
207 return
208
209 class TiffImage(Image):
210 """
211 Subclass of Image class to explicitly handle tiff images
212 """
213 def __init__(self, scene=None):
214 """
215 Initialises the TiffImage class object
216
217 @param scene: The Scene object to add to
218 @type scene: Scene object
219 """
220 Image.__init__(self)
221 debugMsg("Called TiffImage.__init__()")
222
223 if scene is not None:
224 self.renderer = scene.renderer
225
226 self.format = "tiff"
227
228 def load(self, fname):
229 """
230 Loads tiff image data from file.
231
232 @param fname: The filename from which to load tiff image data
233 @type fname: string
234 """
235 debugMsg("Called TiffImage.load()")
236
237 # do a check to see if the file exists
238 fileCheck(fname)
239
240 # print a warning message if get to here
241 overrideWarning("TiffImage.load")
242
243 return
244
245 def render(self):
246 """
247 Does TiffImage object specific (pre)rendering stuff
248 """
249 debugMsg("Called TiffImage.render()")
250
251 # print a warning message if get to here
252 overrideWarning("TiffImage.render")
253
254 return
255
256 class PnmImage(Image):
257 """
258 Subclass of Image class to explicitly handle pnm images
259 """
260 def __init__(self, scene=None):
261 """
262 Initialises the PnmImage class object
263
264 @param scene: The Scene object to add to
265 @type scene: Scene object
266 """
267 Image.__init__(self)
268 debugMsg("Called PnmImage.__init__()")
269
270 if scene is not None:
271 self.renderer = scene.renderer
272
273 self.format = "pnm"
274
275 def load(self, fname):
276 """
277 Loads pnm image data from file.
278
279 @param fname: The filename from which to load pnm image data
280 @type fname: string
281 """
282 debugMsg("Called PnmImage.load()")
283
284 # do a check to see if the file exists
285 fileCheck(fname)
286
287 # print a warning message if get to here
288 overrideWarning("PnmImage.load")
289
290 return
291
292 def render(self):
293 """
294 Does PnmImage object specific (pre)rendering stuff
295 """
296 debugMsg("Called PnmImage.render()")
297
298 # print a warning message if get to here
299 overrideWarning("PnmImage.render")
300
301 return
302
303 class PbmImage(Image):
304 """
305 Subclass of Image class to explicitly handle pbm images
306 """
307 def __init__(self, scene=None):
308 """
309 Initialises the PbmImage class object
310
311 @param scene: The Scene object to add to
312 @type scene: Scene object
313 """
314 Image.__init__(self)
315 debugMsg("Called PbmImage.__init__()")
316
317 if scene is not None:
318 self.renderer = scene.renderer
319
320 self.format = "pbm"
321
322 def load(self, fname):
323 """
324 Loads pbm image data from file.
325
326 @param fname: The filename from which to load pbm image data
327 @type fname: string
328 """
329 debugMsg("Called PbmImage.load()")
330
331 # do a check to see if the file exists
332 fileCheck(fname)
333
334 # print a warning message if get to here
335 overrideWarning("PbmImage.load")
336
337 return
338
339 def render(self):
340 """
341 Does PbmImage object specific (pre)rendering stuff
342 """
343 debugMsg("Called PbmImage.render()")
344
345 # print a warning message if get to here
346 overrideWarning("PbmImage.render")
347
348 return
349
350 class PsImage(Image):
351 """
352 Subclass of Image class to explicitly handle ps images
353 """
354 def __init__(self, scene=None):
355 """
356 Initialises the PsImage class object
357
358 This object is B{only} used for generating postscript output
359
360 @param scene: The Scene object to add to
361 @type scene: Scene object
362 """
363 Image.__init__(self)
364 debugMsg("Called PsImage.__init__()")
365
366 if scene is not None:
367 self.renderer = scene.renderer
368
369 self.format = "ps"
370
371 def load(self, fname):
372 """
373 Loads ps image data from file.
374
375 B{NOT} supported by this renderer module
376
377 @param fname: The filename from which to load ps image data
378 @type fname: string
379 """
380 debugMsg("Called PsImage.load()")
381
382 # this ability not handled by this renderer module
383 unsupportedError("BASE")
384
385 # do a check to see if the file exists
386 fileCheck(fname)
387
388 return
389
390 def render(self):
391 """
392 Does PsImage object specific (pre)rendering stuff
393 """
394 debugMsg("Called PsImage.render()")
395
396 return
397
398 class PdfImage(Image):
399 """
400 Subclass of Image class to explicitly handle pdf images
401 """
402 def __init__(self, scene=None):
403 """
404 Initialises the PdfImage class object
405
406 This object is B{only} used for generating pdf output
407
408 @param scene: The Scene object to add to
409 @type scene: Scene object
410 """
411 Image.__init__(self)
412 debugMsg("Called PdfImage.__init__()")
413
414 if scene is not None:
415 self.renderer = scene.renderer
416
417 self.format = "pdf"
418
419 def load(self, fname):
420 """
421 Loads pdf image data from file.
422
423 B{NOT} supported by this renderer module
424
425 @param fname: The filename from which to load pdf image data
426 @type fname: string
427 """
428 debugMsg("Called PdfImage.load()")
429
430 # need to check that the file exists and is readable etc here
431 # *before* we add to the evalString, better to get the feedback
432 # now rather than at the end of the script
433
434 # this ability not handled by this renderer module
435 unsupportedError("BASE")
436
437 # do a check to see if the file exists
438 fileCheck(fname)
439
440 return
441
442 def render(self):
443 """
444 Does PdfImage object specific (pre)rendering stuff
445 """
446 debugMsg("Called PdfImage.render()")
447
448 return
449
450 # vim: expandtab shiftwidth=4:

  ViewVC Help
Powered by ViewVC 1.1.26