equal
deleted
inserted
replaced
12 |
12 |
13 ImageReader subclass:#JPEGReader |
13 ImageReader subclass:#JPEGReader |
14 instanceVariableNames:'' |
14 instanceVariableNames:'' |
15 classVariableNames:'' |
15 classVariableNames:'' |
16 poolDictionaries:'' |
16 poolDictionaries:'' |
17 category:'Graphics-Support' |
17 category:'Graphics-Images support' |
18 ! |
18 ! |
19 |
19 |
20 JPEGReader comment:' |
20 JPEGReader comment:' |
21 COPYRIGHT (c) 1993 by Claus Gittinger |
21 COPYRIGHT (c) 1993 by Claus Gittinger |
22 All Rights Reserved |
22 All Rights Reserved |
23 |
23 |
24 $Header: /cvs/stx/stx/libview2/JPEGReader.st,v 1.6 1994-10-10 02:32:33 claus Exp $ |
24 $Header: /cvs/stx/stx/libview2/JPEGReader.st,v 1.7 1994-11-17 14:29:35 claus Exp $ |
25 '! |
25 '! |
26 |
26 |
27 !JPEGReader class methodsFor:'documentation'! |
27 !JPEGReader class methodsFor:'documentation'! |
28 |
28 |
29 copyright |
29 copyright |
40 " |
40 " |
41 ! |
41 ! |
42 |
42 |
43 version |
43 version |
44 " |
44 " |
45 $Header: /cvs/stx/stx/libview2/JPEGReader.st,v 1.6 1994-10-10 02:32:33 claus Exp $ |
45 $Header: /cvs/stx/stx/libview2/JPEGReader.st,v 1.7 1994-11-17 14:29:35 claus Exp $ |
46 " |
46 " |
47 ! |
47 ! |
48 |
48 |
49 documentation |
49 documentation |
50 " |
50 " |
51 Reader for JPEG images. |
51 Reader for JPEG images. |
52 uses PD djpeg tool to convert JPG image to gif first, |
52 This is a quick&dirty hack, using the PD djpeg tool to convert |
53 then read GIF image using GIFReader. |
53 the JPG image to GIF first, then reads the GIF image using GIFReader. |
|
54 Of course, this is slower than it should be. If lots of JPG reading |
|
55 is done, this class should be rewritten, to directly call the (C) JPG |
|
56 decoding functions. |
54 " |
57 " |
55 ! ! |
58 ! ! |
56 |
59 |
57 !JPEGReader class methodsFor:'initialization'! |
60 !JPEGReader class methodsFor:'initialization'! |
58 |
61 |
69 then let GIFReader read the file" |
72 then let GIFReader read the file" |
70 |
73 |
71 |tempFileName reader| |
74 |tempFileName reader| |
72 |
75 |
73 tempFileName := '/tmp/img' , (OperatingSystem getProcessId printString). |
76 tempFileName := '/tmp/img' , (OperatingSystem getProcessId printString). |
74 Transcript showCr:'converting to gif ..'. |
77 'JPEGREADER: converting to gif ..' errorPrintNL. |
75 (OperatingSystem executeCommand:'djpeg -gif ' , aFileName , ' > ' , tempFileName) |
78 (OperatingSystem executeCommand:'djpeg -gif ' , aFileName , ' > ' , tempFileName) |
76 ifTrue:[ |
79 ifTrue:[ |
77 reader := GIFReader fromFile:tempFileName. |
80 reader := GIFReader fromFile:tempFileName. |
78 OperatingSystem executeCommand:'rm ' , tempFileName. |
81 OperatingSystem executeCommand:'rm ' , tempFileName. |
79 ^ reader |
82 ^ reader |
80 ]. |
83 ]. |
81 Transcript showCr:'conversion failed ..'. |
84 'JPEGREADER: conversion failed ..' errorPrintNL. |
82 self warn:'cannot execute jpeg converter: djpeg'. |
85 self warn:'cannot execute jpeg converter: djpeg'. |
83 ^ nil |
86 ^ nil |
84 |
87 |
85 "JPEGReader fromFile:'bitmaps/testimg.jpg'" |
88 " |
|
89 JPEGReader fromFile:'bitmaps/testimg.jpg' |
|
90 " |
86 ! ! |
91 ! ! |