author | Claus Gittinger <cg@exept.de> |
Sat, 11 Nov 1995 17:05:49 +0100 | |
changeset 114 | e577a2f332d0 |
parent 99 | a656b0c9dd21 |
child 199 | d80a247e0cfe |
permissions | -rw-r--r-- |
6 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
28 | 3 |
All Rights Reserved |
6 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
2 | 13 |
ImageReader subclass:#JPEGReader |
28 | 14 |
instanceVariableNames:'' |
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
32 | 17 |
category:'Graphics-Images support' |
2 | 18 |
! |
19 |
||
21 | 20 |
!JPEGReader class methodsFor:'documentation'! |
21 |
||
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
28 | 25 |
All Rights Reserved |
16 | 26 |
|
21 | 27 |
This software is furnished under a license and may be used |
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
16 | 35 |
|
21 | 36 |
version |
114
e577a2f332d0
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
99
diff
changeset
|
37 |
^ '$Header: /cvs/stx/stx/libview2/JPEGReader.st,v 1.11 1995-11-11 16:04:36 cg Exp $' |
21 | 38 |
! |
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
Reader for JPEG images. |
|
32 | 43 |
This is a quick&dirty hack, using the PD djpeg tool to convert |
44 |
the JPG image to GIF first, then reads the GIF image using GIFReader. |
|
45 |
Of course, this is slower than it should be. If lots of JPG reading |
|
46 |
is done, this class should be rewritten, to directly call the (C) JPG |
|
47 |
decoding functions. |
|
21 | 48 |
" |
49 |
! ! |
|
16 | 50 |
|
28 | 51 |
!JPEGReader class methodsFor:'initialization'! |
52 |
||
53 |
initialize |
|
54 |
Image fileFormats at:'.jpg' put:self. |
|
55 |
Image fileFormats at:'.jpeg' put:self. |
|
56 |
Image fileFormats at:'.JPG' put:self. |
|
57 |
! ! |
|
58 |
||
43 | 59 |
!JPEGReader class methodsFor:'reading from file'! |
2 | 60 |
|
61 |
fromFile:aFileName |
|
62 |
"make it the easy way: let djpeg convert it to gif, |
|
63 |
then let GIFReader read the file" |
|
64 |
||
65 |
|tempFileName reader| |
|
66 |
||
67 |
tempFileName := '/tmp/img' , (OperatingSystem getProcessId printString). |
|
32 | 68 |
'JPEGREADER: converting to gif ..' errorPrintNL. |
2 | 69 |
(OperatingSystem executeCommand:'djpeg -gif ' , aFileName , ' > ' , tempFileName) |
70 |
ifTrue:[ |
|
28 | 71 |
reader := GIFReader fromFile:tempFileName. |
72 |
OperatingSystem executeCommand:'rm ' , tempFileName. |
|
73 |
^ reader |
|
2 | 74 |
]. |
32 | 75 |
'JPEGREADER: conversion failed ..' errorPrintNL. |
16 | 76 |
self warn:'cannot execute jpeg converter: djpeg'. |
2 | 77 |
^ nil |
78 |
||
32 | 79 |
" |
80 |
JPEGReader fromFile:'bitmaps/testimg.jpg' |
|
81 |
" |
|
2 | 82 |
! ! |