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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.26