123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /languagelevel where {pop languagelevel 2 lt}{true} ifelse {
- (JPEG needs PostScript Level 2!\n) print flush stop
- } if
-
- /JPEGdict 20 dict def
- JPEGdict begin
-
- /NoParamMarkers [
- 16#D0 16#D1 16#D2 16#D3 16#D4 16#D5 16#D6 16#D7 16#D8 16#01
- ] def
-
- /NotSupportedMarkers [
- 16#C3 16#C5 16#C6 16#C7 16#C8 16#C9 16#CA 16#CB 16#CD 16#CE 16#CF
- ] def
-
-
- /ColorSpaceNames << /1 /DeviceGray /3 /DeviceRGB /4 /DeviceCMYK >> def
-
-
-
- /NextByte {
- F read not { (Read error in ViewJPEG!\n) print flush stop } if
- } bind def
-
- /SkipSegment {
- NextByte 8 bitshift NextByte add 2 sub { NextByte pop } repeat
- } bind def
-
-
-
- /readJPEGmarkers {
- 5 dict begin
-
- {
- NextByte
- 16#FF eq {
- /markertype NextByte def
-
- markertype dup 16#C0 ge exch 16#C2 le and {
- NextByte pop NextByte pop
-
- NextByte 8 ne {
- (Error: not 8 bits per component!\n) print flush stop
- } if
-
-
- /height NextByte 8 bitshift NextByte add def
- /width NextByte 8 bitshift NextByte add def
- /colors NextByte def
-
- VJPGDEBUG { currentdict { exch == == } forall flush } if
- exit
- } if
-
-
- NotSupportedMarkers {
- markertype eq {
- (Marker ) print markertype ==
- (not supported!\n) print flush stop
- } if
- } forall
-
-
- true NoParamMarkers { markertype eq {pop false exit} if } forall
- { SkipSegment } if
- } if
- } loop
-
- currentdict dup /markertype undef
- end
- } bind def
-
- end
-
-
- /viewJPEG {
- save
- JPEGdict begin
- /saved exch def
- /scratch 1 string def
- dup type /stringtype eq { (r) file } if
- /F exch def
-
- readJPEGmarkers begin
- F 0 setfileposition
-
-
- gsave clippath pathbbox grestore
- /ury exch def /urx exch def
- /lly exch def /llx exch def
-
- llx lly translate
- width height scale
-
-
- urx llx sub width div ury lly sub height div
- 2 copy gt { exch } if pop
- dup scale
- ColorSpaceNames colors scratch cvs get setcolorspace
-
-
- << /ImageType 1
- /Width width
- /Height height
- /ImageMatrix [ width 0 0 height neg 0 height ]
- /BitsPerComponent 8
-
- colors 4 eq {
- /Decode [ colors { 1 0 } repeat ]
- } {
- /Decode [ colors { 0 1 } repeat ]
- } ifelse
- /DataSource F /DCTDecode filter
- >> image
-
- end
-
- saved end restore
- } bind def
|