TIFFReader.st
author Claus Gittinger <cg@exept.de>
Fri, 25 Aug 2017 18:14:00 +0200
changeset 3980 209cd9407fe9
parent 3979 5d915912216f
child 3984 e533a09c2c1d
permissions -rw-r--r--
oops: compilability!
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
3f9277473954 Initial revision
claus
parents:
diff changeset
     1
"
6
4ac87e6bf82f *** empty log message ***
claus
parents: 5
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
     3
	      All Rights Reserved
0
3f9277473954 Initial revision
claus
parents:
diff changeset
     4
3f9277473954 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
3f9277473954 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
3f9277473954 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
3f9277473954 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
3f9277473954 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
3f9277473954 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
3f9277473954 Initial revision
claus
parents:
diff changeset
    11
"
1571
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
    12
"{ Package: 'stx:libview2' }"
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
    13
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
    14
"{ NameSpace: Smalltalk }"
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
    15
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    16
ImageReader subclass:#TIFFReader
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
    17
	instanceVariableNames:'planarConfiguration subFileType stripOffsets rowsPerStrip
159
327da5085900 fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    18
		fillOrder compression group3options predictor stripByteCounts
327da5085900 fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    19
		currentOffset stripOffsetsPos stripByteCountsPos bitsPerSamplePos
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
    20
		colorMapPos orientation isBigTiff'
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
    21
	classVariableNames:'Verbose'
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
    22
	poolDictionaries:''
1745
4fa0fad2a463 code cleanup (colorMap handling)
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
    23
	category:'Graphics-Images-Readers'
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    24
!
3f9277473954 Initial revision
claus
parents:
diff changeset
    25
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    26
Dictionary subclass:#TIFFMetaData
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    27
	instanceVariableNames:''
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    28
	classVariableNames:''
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    29
	poolDictionaries:''
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    30
	privateIn:TIFFReader
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    31
!
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    32
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
    33
!TIFFReader class methodsFor:'documentation'!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    34
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    35
copyright
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    36
"
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    37
 COPYRIGHT (c) 1991 by Claus Gittinger
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    38
	      All Rights Reserved
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    39
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    40
 This software is furnished under a license and may be used
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    41
 only in accordance with the terms of that license and with the
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    42
 inclusion of the above copyright notice.   This software may not
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    43
 be provided or otherwise made available to, or used by, any
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    44
 other person.  No title to or ownership of the software is
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    45
 hereby transferred.
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    46
"
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    47
!
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    48
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    49
documentation
3f9277473954 Initial revision
claus
parents:
diff changeset
    50
"
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    51
    This class knows how to read TIFF files and how to write uncompressed TIFF files.
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
    52
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    53
    Implemented & Missing Features:
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
    54
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    55
      - Only single image files are supported.
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    56
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    57
      - Not all formats are implemented, and of those that are, not all are tested.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    58
        It should read with most rgb, palette, mono and greyscale images, 
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    59
        although the alpha channel is currently not supported and ignored.
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    60
        It supports reading of uncompressed, LZW, packbits and CCITT-G3 compressed images
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    61
        JPEG and many other formats are currently not implemented.
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
    62
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    63
      - Only writing of uncompressed images is currently implemented.
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    64
        It should write (at least) mono, 8-bit palette and 24 bit rgb formats.
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    65
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    66
      - bigTiff is supported
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
    67
      - some dng tags are supported
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    68
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    69
    More formats will come... (will they ever be needed?)
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    70
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    71
    TODO (?): 
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    72
        since I don't want to spend all of my life adding more formats here and
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    73
        reinventing the wheel, this code should be changed to use the tiff library.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    74
        That would give us most formats and also writing capabilities for free.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    75
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    76
        Late note: 
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    77
            I hate C and interfacing to C libraries: it almost always leads to trouble
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    78
            w.r.t. memory leaks, non-reentrancy, non-interruptability etc.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    79
            (we recently fixed a malloc-non-reentrant bug for some architecture...)
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
    80
            So its probably better to do it all in a real programming language ;-)
195
7975a2c4a890 commentary
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
    81
220
4106d9ce7e02 documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    82
    [author:]
4106d9ce7e02 documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    83
        Claus Gittinger
4106d9ce7e02 documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    84
195
7975a2c4a890 commentary
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
    85
    [See also:]
234
b6352d13e792 xrefs in documentation
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    86
        Image Form Icon
197
50812e81d86f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 195
diff changeset
    87
        BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader 
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
    88
        ST80FormReader SunRasterReader TargaReader WindowsIconReader 
209
840ddcf12904 commentary
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
    89
        XBMReader XPMReader XWDReader 
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    90
"
3f9277473954 Initial revision
claus
parents:
diff changeset
    91
! !
3f9277473954 Initial revision
claus
parents:
diff changeset
    92
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
    93
!TIFFReader class methodsFor:'initialization'!
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    94
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    95
initialize
198
6d76856aaa80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
    96
    "install myself in the Image classes fileFormat table
398
aef700d15416 new suffix-table
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
    97
     for the `.tiff' and `.tif' extensions."
198
6d76856aaa80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
    98
647
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    99
    MIMETypes defineImageType:'image/tiff' suffix:'tif'  reader:self.
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
   100
    MIMETypes defineImageType:nil          suffix:'tiff' reader:self.
198
6d76856aaa80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   101
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   102
    "
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   103
     self initialize
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   104
    "
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   105
398
aef700d15416 new suffix-table
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   106
    "Modified: 1.2.1997 / 15:00:01 / cg"
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
   107
! !
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
   108
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   109
!TIFFReader class methodsFor:'testing'!
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   110
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   111
canRepresent:anImage
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   112
    "return true, if anImage can be represented in my file format.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   113
     Any image is supported."
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   114
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   115
    ^ true
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   116
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   117
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   118
isValidImageFile:aFileName
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   119
    "return true, if aFileName contains a GIF image"
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   120
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   121
    |inStream char1 char2 version|
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   122
11
1d0df18a7049 *** empty log message ***
claus
parents: 6
diff changeset
   123
    inStream := self streamReadingFile:aFileName.
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   124
    inStream isNil ifTrue:[^ false].
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   125
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   126
    char1 := inStream next.
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   127
    char2 := inStream next.
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   128
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   129
    ((char1 ~~ char2) or:[(char1 ~~ $I) and:[char1 ~~ $M]]) ifTrue:[
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   130
        inStream close.
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   131
        ^ false
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   132
    ].
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   133
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   134
    inStream binary.
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
   135
    version := inStream nextInt16MSB:(char1 == $M).
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   136
    inStream close.
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   137
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   138
    "/ 43 is bigTiff
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   139
    ^ (version == 42) or:[ (version == 43) ]
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   140
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   141
    "Modified: / 25-08-2017 / 08:39:20 / cg"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   142
! !
3f9277473954 Initial revision
claus
parents:
diff changeset
   143
1762
55cf76514c8c method category rename
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
   144
!TIFFReader methodsFor:'private-data reading'!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   145
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   146
readCCITT3RLETiffImageData
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   147
    ^ self fileFormatError:'ccitt G3 mod Huffman (rle) compression not implemented'
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   148
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   149
    "Modified: / 3.2.1998 / 18:03:14 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   150
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   151
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   152
readCCITT3RLEWTiffImageData
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   153
    ^ self fileFormatError:'ccitt G3 mod Huffman (rlew) compression not implemented'.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   154
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   155
    "Modified: / 3.2.1998 / 18:03:30 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   156
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   157
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   158
readCCITTGroup3TiffImageData
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   159
    "not really tested - all I got is a single fax from NeXT step"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   160
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   161
    |bytesPerRow bitsPerRow compressedStrip nPlanes 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   162
     stripNr       "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   163
     offset        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   164
     row           "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   165
     bytesPerStrip "{ Class: SmallInteger }" |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   166
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   167
    nPlanes := samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   168
    (nPlanes ~~ 1) ifTrue:[
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   169
        (nPlanes == 2) ifTrue:[
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   170
            (planarConfiguration ~~ 2) ifTrue:[
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   171
                ^ self fileFormatError:'only separate planes are supported'.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   172
            ].
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   173
            'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   174
            nPlanes := 1
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   175
        ] ifFalse:[
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   176
            ^ self fileFormatError:'only monochrome/greyscale ccitt3supported'.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   177
        ].   
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   178
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   179
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   180
"/    (rowsPerStrip ~~ 1) ifTrue:[
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   181
"/        ^ self fileFormatError:'currently require rowsPerStrip to be 1'.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   182
"/    ].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   183
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   184
    "/ 'TIFFReader: decompressing CCITT-3 ...' infoPrintNL.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   185
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   186
    bitsPerRow := width * (bitsPerSample at:1).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   187
    bytesPerRow := bitsPerRow // 8.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   188
    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   189
        bytesPerRow := bytesPerRow + 1
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   190
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   191
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   192
    data := ByteArray new:(bytesPerRow * height).
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   193
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   194
    "/ if the number of rows per strip is unknown (-1),
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   195
    "/ make it one big strip and decompress that
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   196
    rowsPerStrip = 16rFFFFFFFF ifTrue:[
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   197
        compressedStrip := ByteArray uninitializedNew:(stripByteCounts sum).
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   198
        self positionToStrip:1.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   199
        inStream nextBytes:(compressedStrip size) into:compressedStrip.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   200
        self class 
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   201
            decompressCCITT3From:compressedStrip
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   202
            into:data
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   203
            startingAt:1
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   204
            count:compressedStrip size.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   205
        ^ self 
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   206
    ].
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   207
    
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   208
    compressedStrip := ByteArray uninitializedNew:bytesPerRow.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   209
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   210
    offset := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   211
    stripNr := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   212
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   213
    row := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   214
    bytesPerStrip := bytesPerRow * rowsPerStrip.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   215
    [row <= height] whileTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   216
        stripNr := stripNr + 1.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
   217
        self positionToStrip:stripNr.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   218
        inStream nextBytes:(stripByteCounts at:stripNr) into:compressedStrip.
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   219
        self class 
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   220
            decompressCCITT3From:compressedStrip
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   221
            into:data
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   222
            startingAt:offset
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   223
            count:width.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   224
        offset := offset + bytesPerStrip.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   225
        row := row + rowsPerStrip
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   226
    ]
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   227
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   228
    "Modified: / 25-08-2017 / 11:09:02 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   229
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   230
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   231
readCCITTGroup4TiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   232
    ^ self fileFormatError:'ccitt group4 fax compression not implemented'.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   233
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   234
    "Modified: / 3.2.1998 / 18:04:34 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   235
!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   236
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   237
readCCITTRLEWTiffImageData
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   238
    ^ self fileFormatError:'ccitt mod Huffman (rlew) compression not implemented'
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   239
!
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   240
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   241
readDCSTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   242
    ^ self fileFormatError:'dcs compression not implemented'.
329
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   243
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   244
    "Modified: / 3.2.1998 / 18:04:44 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   245
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   246
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   247
readDeflateTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   248
    ^ self fileFormatError:'deflate compression not implemented'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   249
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   250
    "Modified: / 3.2.1998 / 18:04:54 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   251
!
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   252
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   253
readJBIGTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   254
    ^ self fileFormatError:'jbig compression not implemented'.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   255
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   256
    "Modified: / 3.2.1998 / 18:05:04 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   257
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   258
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   259
readJPEGTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   260
    ^ self fileFormatError:'jpeg compression not implemented'.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   261
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   262
    "Modified: / 3.2.1998 / 18:05:12 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   263
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   264
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   265
readLZWTiffImageData
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   266
    "read LZW compressed tiff data; 
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   267
     this method only handles 8+8+8 and 8+8+8+8 rgb 
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   268
     and 2bit or 2+2bit greyscale images.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   269
     For 2+2bit greyscale images, the alpha plane is ignored.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   270
     (maybe other formats work also - but simply not tested)"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   271
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   272
    |bytesPerRow compressedStrip nPlanes overAllBytes
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   273
     bytesPerStrip "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   274
     nBytes        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   275
     prevSize      "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   276
     stripNr       "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   277
     offset        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   278
     row           "{ Class: SmallInteger }" |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   279
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   280
    nPlanes := samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   281
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   282
    (nPlanes >= 3) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   283
        (bitsPerSample conform:[:each | each == 8]) ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   284
            ^ self fileFormatError:'only 8/8/8(/8) bits/sample are supported'.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   285
        ].
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   286
        bytesPerRow := width * samplesPerPixel.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   287
    ] ifFalse:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   288
        (nPlanes == 2) ifTrue:[
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   289
            (planarConfiguration ~~ 2) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   290
                ^ self fileFormatError:'only separate planes are supported'.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   291
            ].
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   292
            'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   293
            nPlanes := 1
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   294
        ].
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   295
        (nPlanes == 1) ifFalse:[
1830
8b04109affc1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
   296
            ^ self fileFormatError:'unsupported nPlanes: ' , nPlanes printString, '; only 3-sample rgb / monochrome supported'.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   297
        ].
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   298
        bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   299
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   300
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   301
    "/ 'TIFFReader: decompressing LZW ...' infoPrintNL.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   302
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   303
    overAllBytes := bytesPerRow * height.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   304
    bytesPerRow == width ifTrue:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   305
        data := ByteArray uninitializedNew:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   306
    ] ifFalse:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   307
        data := ByteArray new:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   308
    ].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   309
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   310
    offset := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   311
    stripNr := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   312
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   313
    row := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   314
    bytesPerStrip := bytesPerRow * rowsPerStrip.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   315
    prevSize := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   316
    [row <= height] whileTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   317
        stripNr := stripNr + 1.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
   318
        self positionToStrip:stripNr.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   319
        nBytes := stripByteCounts at:stripNr.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   320
        (nBytes > prevSize) ifTrue:[
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   321
            compressedStrip := ByteArray uninitializedNew:nBytes.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   322
            prevSize := nBytes
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   323
        ].
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   324
        inStream nextBytes:nBytes into:compressedStrip.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   325
        self class 
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   326
            decompressLZWFrom:compressedStrip count:nBytes
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   327
            into:data startingAt:offset.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   328
        offset := offset + bytesPerStrip.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   329
        row := row + rowsPerStrip
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   330
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   331
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   332
    (predictor == 2) ifTrue:[
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   333
        self class decodeDelta:nPlanes in:data width:width height:height
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   334
    ]
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   335
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   336
    "Modified: / 25-08-2017 / 10:09:03 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   337
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   338
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   339
readNeXTJPEGTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   340
    ^ self fileFormatError:'next jpeg compression not implemented'.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   341
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   342
    "Modified: / 3.2.1998 / 18:10:45 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   343
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   344
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   345
readNeXTRLE2TiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   346
    ^ self fileFormatError:'next 2bit rle compression not implemented'.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   347
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   348
    "Modified: / 3.2.1998 / 18:10:54 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   349
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   350
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   351
readNewJPEGTiffImageData
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   352
    ^ self fileFormatError:'new jpeg compression not implemented'.
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   353
!
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   354
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   355
readPackbitsTiffImageData
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   356
    "this has only been tested with monochrome images"
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   357
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   358
    |bytesPerRow bitsPerRow nPlanes 
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   359
     stripNr       "{ Class: SmallInteger }"
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   360
     offset        "{ Class: SmallInteger }"
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   361
     row           "{ Class: SmallInteger }" 
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   362
     nBytes        "{ Class: SmallInteger }"
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   363
     nDecompressedBytes  "{ Class: SmallInteger }"
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   364
     bitsPerPixel overAllBytes buffer|
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   365
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   366
    nPlanes := samplesPerPixel.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   367
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   368
    "only support 1-sample/pixel,
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   369
     with alpha - if separate planes,
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   370
     or rgb - if non separate planes and no alpha"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   371
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   372
    (nPlanes == 2) ifTrue:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   373
        (planarConfiguration ~~ 2) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   374
            ^ self fileFormatError:'with alpha, only separate planes supported'.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   375
        ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   376
        'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   377
        nPlanes := 1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   378
        bitsPerPixel := bitsPerSample at:1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   379
        bitsPerSample := Array with:bitsPerPixel.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   380
        samplesPerPixel := 1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   381
    ] ifFalse:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   382
        (nPlanes == 3) ifTrue:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   383
            (planarConfiguration ~~ 1) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   384
                ^ self fileFormatError:'only non separate planes supported'.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   385
            ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   386
            bitsPerSample ~= #(8 8 8) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   387
                ^ self fileFormatError:'only 8/8/8 rgb images supported'.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   388
            ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   389
            bitsPerPixel := 24
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   390
        ] ifFalse:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   391
            (nPlanes ~~ 1) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   392
                ^ self fileFormatError:'format not supported'.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   393
            ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   394
            bitsPerPixel := bitsPerSample at:1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   395
        ]
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   396
    ].
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   397
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   398
    bitsPerRow := width * bitsPerPixel.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   399
    bytesPerRow := bitsPerRow // 8.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   400
    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   401
        bytesPerRow := bytesPerRow + 1
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   402
    ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   403
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   404
    overAllBytes := bytesPerRow * height.
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   405
    bytesPerRow == width ifTrue:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   406
        data := ByteArray uninitializedNew:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   407
    ] ifFalse:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   408
        data := ByteArray new:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   409
    ].
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   410
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   411
    offset := 1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   412
    stripNr := 0.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   413
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   414
    buffer := nil.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   415
    row := 1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   416
    [row <= height] whileTrue:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   417
        stripNr := stripNr + 1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   418
        nBytes := stripByteCounts at:stripNr.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
   419
        self positionToStrip:stripNr.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   420
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   421
        nBytes > buffer size ifTrue:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   422
            "/ realloc
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   423
            buffer := ByteArray uninitializedNew:nBytes.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   424
        ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   425
        inStream nextBytes:nBytes into:buffer.
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   426
        nDecompressedBytes := self class decompressPackBitsFrom:buffer at:1 to:data at:offset count:nBytes.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   427
        "/ nDecompressedBytes := self class decompressPackBits:nBytes from:buffer to:data startingAt:offset.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   428
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   429
        offset := offset + nDecompressedBytes.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   430
        row := row + rowsPerStrip
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   431
    ]
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
   432
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   433
    "Modified: / 25-08-2017 / 02:02:20 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   434
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   435
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   436
readPixarFilmTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   437
    ^ self fileFormatError:'pixar film compression not implemented'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   438
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   439
    "Modified: / 3.2.1998 / 18:11:45 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   440
!
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   441
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   442
readPixarLogTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   443
    ^ self fileFormatError:'pixar log compression not implemented'.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   444
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   445
    "Modified: / 3.2.1998 / 18:11:53 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   446
!
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   447
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   448
readSGI24TiffImageData
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   449
    ^ self fileFormatError:'SGI 24-bit Log Luminance encoding not implemented' .
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   450
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   451
    "Created: / 25-08-2017 / 11:17:25 / cg"
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   452
!
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   453
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   454
readSGI32TiffImageData
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   455
    ^ self fileFormatError:'SGI 32-bit Log Luminance encoding not implemented' .
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   456
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   457
    "Created: / 25-08-2017 / 11:17:21 / cg"
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   458
!
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   459
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   460
readThunderScanTiffImageData
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   461
    |bytesPerRow compressedStrip nPlanes overAllBytes
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   462
     bytesPerStrip "{ Class: SmallInteger }"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   463
     nBytes        "{ Class: SmallInteger }"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   464
     prevSize      "{ Class: SmallInteger }"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   465
     stripNr       "{ Class: SmallInteger }"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   466
     offset        "{ Class: SmallInteger }"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   467
     row           "{ Class: SmallInteger }"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   468
     pixelIndex
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   469
     i even gen highNibble lastPixel d1 d2 d3|
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   470
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   471
    nPlanes := samplesPerPixel.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   472
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   473
    (nPlanes == 2) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   474
        (planarConfiguration ~~ 2) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   475
            ^ self fileFormatError:'only separate planes are supported'.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   476
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   477
        'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   478
        nPlanes := 1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   479
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   480
    (nPlanes == 1) ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   481
        ^ self fileFormatError:'unsupported nPlanes: ' , nPlanes printString.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   482
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   483
    (bitsPerSample at:1) == 4 ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   484
        ^ self fileFormatError:('unsupported bitsPerSample: %1 (only 4 supported)' bindWith:(bitsPerSample at:1)).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   485
    ].    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   486
    bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   487
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   488
    "/ 'TIFFReader: decompressing ThunderScan ...' infoPrintNL.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   489
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   490
    overAllBytes := bytesPerRow * height.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   491
    bytesPerRow == width ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   492
        data := ByteArray uninitializedNew:overAllBytes.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   493
    ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   494
        data := ByteArray new:overAllBytes.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   495
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   496
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   497
    offset := 1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   498
    stripNr := 0.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   499
    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   500
    gen := [:pixel | 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   501
                even ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   502
                    highNibble := pixel. 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   503
                    even := false.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   504
                ] ifFalse:[    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   505
                    data at:pixelIndex put:((highNibble bitShift:4) bitOr:pixel).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   506
                    pixelIndex := pixelIndex + 1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   507
                    even := true.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   508
                ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   509
            ].    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   510
    even := true.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   511
    lastPixel := 0.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   512
    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   513
    row := 1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   514
    bytesPerStrip := bytesPerRow * rowsPerStrip.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   515
    prevSize := 0.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   516
    [row <= height] whileTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   517
        stripNr := stripNr + 1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   518
        self positionToStrip:stripNr.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   519
        nBytes := stripByteCounts at:stripNr.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   520
        (nBytes > prevSize) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   521
            compressedStrip := ByteArray uninitializedNew:nBytes.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   522
            prevSize := nBytes
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   523
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   524
        (inStream nextBytes:nBytes into:compressedStrip) == nBytes ifFalse:[ self error:'short read' ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   525
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   526
        "/ RLE decode... (see http://fileformats.archiveteam.org/wiki/ThunderScan_compression)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   527
        i := 1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   528
        pixelIndex := offset.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   529
        
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   530
        [i <= nBytes] whileTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   531
            |code|
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   532
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   533
            code := compressedStrip at:i.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   534
            i := i + 1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   535
            code >= 2r11000000 ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   536
                "/ a single pixel
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   537
                lastPixel := code bitAnd:2r00111111.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   538
                self assert:(lastPixel <= 2r1111).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   539
                
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   540
                gen value:lastPixel.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   541
            ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   542
                code >= 2r10000000 ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   543
                    "/ three bit deltas (2 pixels)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   544
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   545
                    d1 := (code rightShift:3) bitAnd:2r111.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   546
                    d2 := code bitAnd:2r111.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   547
                    d1 ~~ 4 ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   548
                        lastPixel := lastPixel + (#(0 1 2 3 0 -3 -2 -1) at:d1+1).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   549
                        gen value:lastPixel.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   550
                    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   551
                    d2 ~~ 4 ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   552
                        lastPixel := lastPixel + (#(0 1 2 3 0 -3 -2 -1) at:d2+1).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   553
                        gen value:lastPixel.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   554
                    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   555
                ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   556
                    code >= 2r01000000 ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   557
                        "/ two bit deltas (3 pixels)    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   558
                        d1 := (code rightShift:4) bitAnd:2r11.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   559
                        d2 := (code rightShift:2) bitAnd:2r11.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   560
                        d3 := code bitAnd:2r11.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   561
                        d1 ~~ 2 ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   562
                            lastPixel := lastPixel + (#(0 1 0 -1) at:d1+1).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   563
                            gen value:lastPixel.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   564
                        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   565
                        d2 ~~ 2 ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   566
                            lastPixel := lastPixel + (#(0 1 0 -1) at:d2+1).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   567
                            gen value:lastPixel.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   568
                        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   569
                        d3 ~~ 2 ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   570
                            lastPixel := lastPixel + (#(0 1 0 -1) at:d3+1).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   571
                            gen value:lastPixel.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   572
                        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   573
                    ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   574
                        code timesRepeat:[ gen value:lastPixel ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   575
                    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   576
                ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   577
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   578
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   579
        "/ self assert:(pixelIndex == (offset + bytesPerStrip)).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   580
        
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   581
        offset := offset + bytesPerStrip.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   582
        row := row + rowsPerStrip
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   583
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   584
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   585
    (predictor ~~ 1) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   586
        ^ self fileFormatError:('unsupported predictor: %1' bindWith:predictor).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   587
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   588
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   589
    "Modified: / 25-08-2017 / 17:43:00 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   590
!
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   591
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   592
readTiffImageData
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   593
    (compression == 1) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   594
        ^ self readUncompressedTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   595
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   596
    (compression == 2) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   597
        ^ self readCCITT3RLETiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   598
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   599
    (compression == 3) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   600
        ^ self readCCITTGroup3TiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   601
    ]. 
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   602
    (compression == 4) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   603
        ^ self readCCITTGroup4TiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   604
    ]. 
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   605
    (compression == 5) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   606
        ^ self readLZWTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   607
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   608
    (compression == 6) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   609
        ^ self readJPEGTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   610
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   611
    (compression == 7) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   612
        ^ self readNewJPEGTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   613
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   614
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   615
    (compression == 32766) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   616
        ^ self readNeXTRLE2TiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   617
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   618
    (compression == 32771) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   619
        ^ self readCCITTRLEWTiffImageData.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   620
    ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   621
    (compression == 32773) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   622
        ^ self readPackbitsTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   623
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   624
    (compression == 32809) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   625
        ^ self readThunderScanTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   626
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   627
    (compression == 32908) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   628
        ^ self readPixarFilmTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   629
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   630
    (compression == 32909) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   631
        ^ self readPixarLogTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   632
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   633
    (compression == 32946) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   634
        ^ self readDeflateTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   635
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   636
    (compression == 32947) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   637
        ^ self readDCSTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   638
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   639
    (compression == 32865) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   640
        ^ self readNeXTJPEGTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   641
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   642
    (compression == 34661) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   643
        ^ self readJBIGTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   644
    ].
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   645
    (compression == 34676) ifTrue:[
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   646
        ^ self readSGI32TiffImageData.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   647
    ].
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   648
    (compression == 34677) ifTrue:[
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   649
        ^ self readSGI24TiffImageData.
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   650
    ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   651
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   652
    ^ self fileFormatError:('compression type ' , compression printString , ' not known').
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   653
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   654
    "Created: / 11-04-1997 / 00:19:44 / cg"
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
   655
    "Modified: / 25-08-2017 / 11:17:25 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   656
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   657
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   658
readTiledJPEGTiffImageData
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   659
    ^ self fileFormatError:'jpeg compression not implemented (in tile mode)'.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   660
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   661
    "Created: / 25-08-2017 / 16:27:28 / cg"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   662
!
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   663
3976
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   664
readTiledLZWTiffImageData
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   665
    ^ self fileFormatError:'tiled LZW data not implemented' .
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   666
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   667
    "Created: / 25-08-2017 / 01:05:13 / cg"
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   668
!
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   669
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   670
readTiledTiffImageData
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   671
    (compression == 1) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   672
        ^ self readTiledUncompressedTiffImageData.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   673
    ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   674
    (compression == 5) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   675
        ^ self readTiledLZWTiffImageData.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   676
    ].
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   677
    (compression == 6) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   678
        ^ self readTiledJPEGTiffImageData.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   679
    ].
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   680
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   681
    ^ self fileFormatError:('compression type ' , compression printString , ' not supported (in tile mode)').
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   682
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   683
    "Created: / 25-08-2017 / 00:19:14 / cg"
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   684
    "Modified: / 25-08-2017 / 16:27:40 / cg"
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   685
!
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   686
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   687
readTiledUncompressedTiffImageData
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   688
    |bytesPerRow   "{ Class: SmallInteger }"
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   689
     bitsPerRow    "{ Class: SmallInteger }"
3976
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   690
     bytesPerTileRow   "{ Class: SmallInteger }"
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   691
     bitsPerTileRow    "{ Class: SmallInteger }" 
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   692
     nPlanes 
3976
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   693
     tileNr        "{ Class: SmallInteger }"
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   694
     offset        "{ Class: SmallInteger }"
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   695
     row           "{ Class: SmallInteger }" 
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   696
     nBytes        "{ Class: SmallInteger }"
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   697
     bitsPerPixel 
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   698
     overAllBytes  "{ Class: SmallInteger }"
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   699
     where         "{ Class: SmallInteger }"
3976
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   700
     x             "{ Class: SmallInteger }"       
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   701
     y             "{ Class: SmallInteger }" 
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   702
     imageRowOffset  "{ Class: SmallInteger }" 
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   703
     imageOffset     "{ Class: SmallInteger }" 
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   704
     tileOffset      "{ Class: SmallInteger }"   
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   705
     dataOffset      "{ Class: SmallInteger }"   
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   706
     tilePos tile     
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   707
     tileWidth tileLength tileOffsets tileByteCounts|
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   708
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   709
    tileWidth := metaData at:#TileWidth.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   710
    tileLength := metaData at:#TileLength.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   711
    tileOffsets := metaData at:#TileOffsets.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   712
    tileByteCounts := metaData at:#TileByteCounts.
3976
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   713
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   714
    nPlanes := samplesPerPixel.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   715
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   716
    "/ not all formats are supported here,
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   717
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   718
    (nPlanes == 2) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   719
        (planarConfiguration ~~ 2) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   720
            ^ self fileFormatError:'with alpha, only separate planes supported'.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   721
        ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   722
        'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   723
        nPlanes := 1.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   724
        bitsPerPixel := bitsPerSample at:1.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   725
        bitsPerSample := Array with:bitsPerPixel.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   726
        samplesPerPixel := 1.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   727
    ] ifFalse:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   728
        (nPlanes == 4) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   729
            (planarConfiguration ~~ 1) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   730
                ^ self fileFormatError:'only non separate planes supported'.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   731
            ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   732
            bitsPerSample ~= #(8 8 8 8) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   733
                ^ self fileFormatError:'only 8/8/8/8 cmyk images supported'.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   734
            ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   735
            bitsPerPixel := 32.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   736
        ] ifFalse:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   737
            (nPlanes == 3) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   738
                (planarConfiguration ~~ 1) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   739
                    ^ self fileFormatError:'only non separate planes supported'.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   740
                ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   741
                bitsPerSample ~= #(8 8 8) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   742
                    ^ self fileFormatError:'only 8/8/8 rgb images supported (is: ' , bitsPerSample printString , ')'.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   743
                ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   744
                bitsPerPixel := 24
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   745
            ] ifFalse:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   746
                (nPlanes ~~ 1) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   747
                    ^ self fileFormatError:('unsupported format: nplanes=' , nPlanes printString).
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   748
                ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   749
                bitsPerPixel := bitsPerSample at:1.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   750
            ]
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   751
        ]
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   752
    ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   753
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   754
    bitsPerRow := width * bitsPerPixel.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   755
    bytesPerRow := bitsPerRow // 8.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   756
    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   757
        bytesPerRow := bytesPerRow + 1
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   758
    ].
3976
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   759
    
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   760
    bitsPerTileRow := tileWidth * bitsPerPixel.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   761
    bytesPerTileRow := bitsPerTileRow // 8.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   762
    ((bitsPerTileRow \\ 8) ~~ 0) ifTrue:[
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   763
        bytesPerTileRow := bytesPerTileRow + 1
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   764
    ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   765
3976
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   766
    overAllBytes := bytesPerRow * height.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   767
    data := ByteArray new:overAllBytes.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   768
    
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   769
    tileNr := 1.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   770
    where := -1.
3976
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   771
    y := 0.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   772
    imageRowOffset := 1.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   773
    [ y < height ] whileTrue:[
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   774
        x := 0.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   775
        imageOffset := imageRowOffset.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   776
        [ x < width ] whileTrue:[
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   777
            nBytes := tileByteCounts at:tileNr.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   778
            tilePos := tileOffsets at:tileNr.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   779
            tileNr := tileNr + 1.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   780
            
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   781
            where ~~ tilePos ifTrue:[
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   782
                inStream position:tilePos.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   783
                where := tilePos.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   784
            ].
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   785
            tile := ByteArray new:nBytes.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   786
            inStream nextBytes:nBytes into:tile startingAt:1 blockSize:4096.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   787
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   788
            "/ copy the tile.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   789
            tileOffset := 1.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   790
            dataOffset := imageOffset. 
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   791
            1 to:tileLength do:[:yT |
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   792
                data replaceFrom:dataOffset to:dataOffset+bytesPerTileRow-1 with:tile startingAt:tileOffset.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   793
                dataOffset := dataOffset + bytesPerRow.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   794
                tileOffset := tileOffset + bytesPerTileRow.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   795
            ].
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   796
            
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   797
            "/ offset := offset + nBytes.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   798
            "/ row := row + rowsPerStrip.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   799
            where := where + nBytes.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   800
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   801
            x := x + tileWidth.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   802
            imageOffset := imageOffset + bytesPerTileRow.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   803
        ].
3976
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   804
        y := y + tileLength.
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
   805
        imageRowOffset := imageRowOffset + (bytesPerRow*tileLength).
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   806
    ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   807
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   808
    "Created: / 25-08-2017 / 00:22:31 / cg"
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   809
!
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
   810
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   811
readUncompressedTiffImageData
3610
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   812
    |bytesPerRow   "{ Class: SmallInteger }"
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   813
     bitsPerRow    "{ Class: SmallInteger }"
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   814
     nPlanes 
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   815
     stripNr       "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   816
     offset        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   817
     row           "{ Class: SmallInteger }" 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   818
     nBytes        "{ Class: SmallInteger }"
3610
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   819
     bitsPerPixel 
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   820
     overAllBytes  "{ Class: SmallInteger }"
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   821
     where         "{ Class: SmallInteger }"
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   822
     stripPos      |
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   823
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   824
    nPlanes := samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   825
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   826
    "/ not all formats are supported here,
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   827
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   828
    (nPlanes == 2) ifTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   829
        (planarConfiguration ~~ 2) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   830
            ^ self fileFormatError:'with alpha, only separate planes supported'.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   831
        ].
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   832
        'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   833
        nPlanes := 1.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   834
        bitsPerPixel := bitsPerSample at:1.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   835
        bitsPerSample := Array with:bitsPerPixel.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   836
        samplesPerPixel := 1.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   837
    ] ifFalse:[
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   838
        (nPlanes == 4) ifTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   839
            (planarConfiguration ~~ 1) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   840
                ^ self fileFormatError:'only non separate planes supported'.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   841
            ].
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   842
            bitsPerSample ~= #(8 8 8 8) ifTrue:[
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   843
                ^ self fileFormatError:'only 8/8/8/8 cmyk images supported'.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   844
            ].
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   845
            bitsPerPixel := 32.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   846
        ] ifFalse:[
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   847
            (nPlanes == 3) ifTrue:[
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   848
                (planarConfiguration ~~ 1) ifTrue:[
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   849
                    ^ self fileFormatError:'only non separate planes supported'.
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   850
                ].
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   851
                bitsPerSample ~= #(8 8 8) ifTrue:[
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
   852
                    ^ self fileFormatError:'only 8/8/8 rgb images supported (is: ' , bitsPerSample printString , ')'.
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   853
                ].
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   854
                bitsPerPixel := 24
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   855
            ] ifFalse:[
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   856
                (nPlanes ~~ 1) ifTrue:[
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   857
                    ^ self fileFormatError:('unsupported format: nplanes=' , nPlanes printString).
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   858
                ].
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   859
                bitsPerPixel := bitsPerSample at:1.
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   860
            ]
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   861
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   862
    ].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   863
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   864
    bitsPerRow := width * bitsPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   865
    bytesPerRow := bitsPerRow // 8.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   866
    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   867
        bytesPerRow := bytesPerRow + 1
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   868
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   869
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   870
    overAllBytes := bytesPerRow * height.
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   871
    bytesPerRow == width ifTrue:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   872
        data := ByteArray uninitializedNew:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   873
    ] ifFalse:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   874
        data := ByteArray new:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   875
    ].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   876
336
9789b02d95bf oops - the very last pixel was not read (in readUncompressed ...)
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   877
    offset := 0.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   878
    stripNr := 0.
3610
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   879
    where := -1.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   880
    row := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   881
    [row <= height] whileTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   882
        stripNr := stripNr + 1.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   883
        nBytes := stripByteCounts at:stripNr.
3610
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   884
        stripPos := stripOffsets at:stripNr.
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   885
        where ~~ stripPos ifTrue:[
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   886
            inStream position:stripPos.
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   887
            where := stripPos.
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   888
        ].
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   889
        
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   890
        offset + nBytes > overAllBytes ifTrue:[
336
9789b02d95bf oops - the very last pixel was not read (in readUncompressed ...)
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   891
            nBytes := overAllBytes - offset.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   892
        ].
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   893
563
38cbee875bfa read data in blocks - better if images are read from a CD
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   894
        "/ read it 4k-wise; this leads to a better behavior,
1748
0ad7db36c871 comment
Claus Gittinger <cg@exept.de>
parents: 1745
diff changeset
   895
        "/ when reading big images from a slow device (such as a cdrom)
563
38cbee875bfa read data in blocks - better if images are read from a CD
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   896
        inStream nextBytes:nBytes into:data startingAt:offset+1 blockSize:4096.
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   897
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   898
        offset := offset + nBytes.
3610
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   899
        row := row + rowsPerStrip.
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   900
        where := where + nBytes.
1748
0ad7db36c871 comment
Claus Gittinger <cg@exept.de>
parents: 1745
diff changeset
   901
    ].
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   902
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   903
    "Modified: / 12.8.1998 / 13:57:14 / cg"
440
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   904
! !
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   905
1762
55cf76514c8c method category rename
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
   906
!TIFFReader methodsFor:'private-reading'!
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   907
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   908
decodeTiffTag:tagType numberType:numberType length:length
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   909
    |offset value valueArray 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   910
     val scaleFactor rV gV bV
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   911
     n  "{ Class: SmallInteger }"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   912
     i2 "{ Class: SmallInteger }"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   913
     i3 "{ Class: SmallInteger }" |
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   914
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   915
    Verbose == true ifTrue:[ Logger info:'tiffTag: %1' with:tagType ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   916
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   917
    (numberType == 3 "TIFF_SHORT") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   918
        "16 bit ushort"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   919
        valueArray := self readShorts:length signed:false.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   920
        value := valueArray at:1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   921
    ] ifFalse:[(numberType == 4 "TIFF_LONG") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   922
        "32 bit uinteger"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   923
        valueArray := self readLongs:length signed:false.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   924
        value := valueArray at:1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   925
    ] ifFalse:[(numberType == 2 "TIFF_ASCII") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   926
        "ascii characters"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   927
        value := self readChars:length
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   928
    ] ifFalse:[(numberType == 5 "TIFF_RATIONAL") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   929
        "64 (32+32) bit ufraction"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   930
        valueArray := self readFracts:length signed:false.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   931
        value := valueArray at:1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   932
    ] ifFalse:[(numberType == 1 "TIFF_BYTE") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   933
        "8bit uinteger"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   934
        value := self readBytes:length signed:false
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   935
    ] ifFalse:[(numberType == 6 "TIFF_SBYTE") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   936
        "TIFF6: 8bit signed integer"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   937
        value := self readBytes:length  signed:true
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   938
    ] ifFalse:[(numberType == 8 "TIFF_SSHORT") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   939
        "TIFF6: 16bit signed integer"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   940
        valueArray := self readShorts:length signed:true.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   941
        value := valueArray at:1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   942
    ] ifFalse:[(numberType == 9 "TIFF_SLONG") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   943
        "TIFF6: 32bit signed integer"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   944
        valueArray := self readLongs:length signed:true.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   945
        value := valueArray at:1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   946
    ] ifFalse:[(numberType == 10 "TIFF_SRATIONAL") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   947
        "TIFF6: 64 (32+32) bit signed fraction"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   948
        valueArray := self readFracts:length signed:true.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   949
        value := valueArray at:1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   950
    ] ifFalse:[(numberType == 11 "TIFF_FLOAT") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   951
        "TIFF6: 32 bit IEEE float"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   952
        valueArray := self readFloats:length.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   953
        value := valueArray at:1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   954
    ] ifFalse:[(numberType == 12 "TIFF_DOUBLE") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   955
        "TIFF6: 64 bit IEEE double"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   956
        valueArray := self readDoubles:length.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   957
        value := valueArray at:1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   958
        
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   959
    ] ifFalse:[(numberType == 7 "TIFF_UNDEFINED") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   960
        "8bit anything"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   961
        value := self readBytes:length signed:false
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   962
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   963
    "/ the following are preps for the propsed bigTiff format    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   964
    ] ifFalse:[(numberType == 16 "TIFF_LONG8") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   965
        "BIGTIFF: 8-byte unsigned integer"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   966
        valueArray := self readLong8s:length signed:false.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   967
        value := valueArray at:1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   968
    ] ifFalse:[(numberType == 17 "TIFF_SLONG8") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   969
        "BIGTIFF: 8-byte signed integer"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   970
        valueArray := self readLong8s:length signed:true.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   971
        value := valueArray at:1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   972
    ] ifFalse:[(numberType == 18 "TIFF_IFD8") ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   973
        "BIGTIFF: 8-byte unsigned IFD offset"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   974
        valueArray := self readLong8s:length signed:false.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   975
        value := valueArray at:1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   976
    ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   977
        isBigTiff ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   978
            offset := (inStream nextInt64MSB:(byteOrder ~~ #lsb))
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   979
        ] ifFalse:[    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   980
            offset := (inStream nextInt32MSB:(byteOrder ~~ #lsb))
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   981
        ]
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   982
    ]]]]]]]]]]]]]]].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   983
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   984
    (tagType between:200 and:299) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   985
        (tagType == 254) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   986
            "/ New SubfileType
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   987
            "/      REDUCEDIMAGE    -> 1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   988
            "/      PAGE            -> 2
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   989
            "/      MASK            -> 4
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   990
            "newSubFileType := value."
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   991
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   992
            "/ 'newSubfiletype ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   993
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   994
                Logger info:'      newSubfiletype: %1' with:value
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   995
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   996
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   997
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   998
        (tagType == 255) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
   999
            "/ Old SubfileType
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1000
            "/      IMAGE           -> 1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1001
            "/      REDUCEDIMAGE    -> 2
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1002
            "/      PAGE            -> 3
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1003
            subFileType := value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1004
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1005
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1006
                Logger info:'      oldSubfiletype: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1007
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1008
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1009
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1010
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1011
        (tagType == 256) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1012
            "ImageWidth"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1013
            width := value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1014
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1015
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1016
                Logger info:'      width: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1017
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1018
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1019
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1020
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1021
        (tagType == 257) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1022
            "ImageHeight"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1023
            height := value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1024
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1025
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1026
                Logger info:'      height: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1027
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1028
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1029
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1030
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1031
        (tagType == 258) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1032
            "bitspersample"  
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1033
             bitsPerSample := valueArray.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1034
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1035
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1036
                Logger info:'      bitspersample: %1' with:valueArray 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1037
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1038
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1039
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1040
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1041
        (tagType == 259) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1042
            "/ compression
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1043
            "/      NONE            -> 1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1044
            "/      CCITTRLE        -> 2
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1045
            "/      CCITTFAX3       -> 3
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1046
            "/      CCITTFAX4       -> 4
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1047
            "/      LZW             -> 5
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1048
            "/      OJPEG           -> 6 (old style jpeg)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1049
            "/      JPEG            -> 7 (new style jpeg)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1050
            "/      ADOBE_DEFLATE   -> 8
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1051
            "/      JBIG            -> 9 (ITU-T T85)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1052
            "/      JBIG            -> 10 (ITU-T T43)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1053
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1054
            "/      NEXT            -> 32766 (NeXT 2-bit encoding)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1055
            "/      CCITTRLEW       -> 32771
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1056
            "/      PACKBITS        -> 32773
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1057
            "/      THUNDERSCAN     -> 32809 (ThunderScan 4-bit encoding)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1058
            "/      IT8CTPAD        -> 32895  
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1059
            "/      IT8LW           -> 32896  
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1060
            "/      IT8MP           -> 32897  
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1061
            "/      IT8BL           -> 32898  
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1062
            "/      PIXARFILM       -> 32908
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1063
            "/      PIXARLOG        -> 32909 (Pixar companded 11-bit ZIP encoding)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1064
            "/      DEFLATE         -> 32946 (PKZIP-style Deflate encoding)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1065
            "/      DCS             -> 32947 (kodac)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1066
            "/      JBIG            -> 34661
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1067
            "/      SGI32           -> 34676 (SGI 32-bit Log Luminance encoding)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1068
            "/      SGI24           -> 34677 (SGI 24-bit Log Luminance encoding)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1069
            "/      JPEG2000        -> 34712 JPEG2000
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1070
            "/      NIKON_NEF       -> 34713 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1071
            "/      JBIG2           -> 34715 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1072
            compression := value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1073
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1074
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1075
                Logger info:'      compression: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1076
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1077
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1078
        ].
3980
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1079
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1080
        (tagType == 262) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1081
            "photometric"
3980
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1082
	    |p|
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1083
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1084
            (value between:0 and:10) ifTrue:[
3980
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1085
                p := 
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1086
		    #(
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1087
                        whiteIs0            "/  0 - grayscale or monochrome; faxes
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1088
                        blackIs0            "/  1 - grayscale or monochrome; faxes
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1089
                        rgb                 "/  2
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1090
                        palette             "/  3
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1091
                        transparencyMask    "/  4
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1092
                        cmyk                "/  5 - color separations
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1093
                        YCbCr               "/  6 - CCIR 601
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1094
                        nil                 "/  7
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1095
                        CIElab              "/  8 - 1976 CIE L*a*b*
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1096
                        ICClab              "/  9 - ICC L*a*b*
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1097
                        ITUlab              "/ 10 - see ITO-T- Rec T42 (RFC 2301)
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1098
                    ) at:(value + 1)    
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1099
            ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1100
                (value == 32803) ifTrue:[
3980
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1101
                    p := #ColorFilterArray    "/ camera rw format
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1102
                ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1103
                (value == 32844) ifTrue:[
3980
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1104
                    p := #PixarLogL   
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1105
                ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1106
                (value == 32845) ifTrue:[
3980
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1107
                    p := #PixarLogLuv    
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1108
                ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1109
                (value == 34892) ifTrue:[
3980
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1110
                    p := #LinearRaw           "/ camera rw format
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1111
                ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1112
            ].
3980
209cd9407fe9 oops: compilability!
Claus Gittinger <cg@exept.de>
parents: 3979
diff changeset
  1113
	    photometric := p.
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1114
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1115
                Logger info:'      photometric: %1 (%2)' with:photometric with:value
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1116
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1117
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1118
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1119
        (tagType == 263) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1120
            "/ Thresholding
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1121
            "/      BILEVEL         -> 1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1122
            "/      HALFTONE        -> 2
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1123
            "/      ERRORDIFFUSE    -> 3
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1124
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1125
            "thresholding := value."
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1126
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1127
            "/ 'thresholding ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1128
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1129
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1130
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1131
        (tagType == 264) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1132
            "CellWidth"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1133
            "/ 'cellWidth ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1134
            metaData at:#CellWidth put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1135
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1136
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1137
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1138
        (tagType == 265) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1139
            "CellLength"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1140
            "/ 'cellLength ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1141
            metaData at:#CellLength put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1142
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1143
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1144
        (tagType == 266) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1145
            "fillOrder"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1146
            (value == 1) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1147
              fillOrder := #msb
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1148
            ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1149
              (value == 2) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1150
                fillOrder := #lsb
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1151
              ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1152
                fillOrder := nil
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1153
              ]
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1154
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1155
            "/ 'fillorder ' print. fillOrder printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1156
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1157
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1158
        (tagType == 269) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1159
            "documentName - info only"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1160
            "/ 'documentName ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1161
            metaData at:#DocumentName put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1162
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1163
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1164
        (tagType == 270) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1165
            "imageDescription - info only"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1166
            "/ 'imageDescription ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1167
            metaData at:#ImageDescription put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1168
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1169
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1170
        (tagType == 271) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1171
            "make - info only"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1172
            metaData at:#Make put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1173
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1174
                Logger info:'      make: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1175
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1176
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1177
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1178
        (tagType == 272) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1179
            "model - info only"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1180
            metaData at:#Model put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1181
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1182
                Logger info:'      model: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1183
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1184
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1185
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1186
        (tagType == 273) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1187
            "stripOffsets"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1188
            stripOffsets := valueArray.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1189
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1190
                Logger info:'      stripOffsets: %1' with:valueArray 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1191
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1192
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1193
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1194
        (tagType == 274) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1195
            "Orientation"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1196
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1197
            orientation :=
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1198
                            #( nil          "/ 1 normal (topLeft)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1199
                               unsupported  "/ 2 horizontal flip
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1200
                               unsupported  "/ 3 horizontal & vertical flip
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1201
                               vFlip        "/ 4 vertical flip
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1202
                               unsupported  "/ 5 rot 90' counter clock-wise
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1203
                               unsupported  "/ 6 rot 90' clock-wise
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1204
                               unsupported  "/ 7 rot 90' & flip
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1205
                               unsupported  "/ 8 rot 90' ccw & flip
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1206
                             ) at:value ifAbsent:#unsupported.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1207
            metaData at:#Orientation put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1208
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1209
                Logger info:'      orientation: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1210
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1211
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1212
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1213
        (tagType == 277) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1214
            samplesPerPixel := value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1215
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1216
                Logger info:'      samplesperpixel: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1217
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1218
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1219
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1220
        (tagType == 278) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1221
            rowsPerStrip := value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1222
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1223
                Logger info:'      rowsPerStrip: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1224
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1225
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1226
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1227
        (tagType == 279) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1228
            "stripbytecount"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1229
            stripByteCounts := valueArray.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1230
            "/        'stripByteCounts Array(' print. 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1231
            "/        stripByteCounts size print.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1232
            "/        ')' printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1233
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1234
                Logger info:'      stripByteCounts: %1' with:valueArray 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1235
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1236
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1237
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1238
        (tagType == 280) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1239
            "/ 'minSampleValue ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1240
            metaData at:#MinSampleValue put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1241
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1242
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1243
        (tagType == 281) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1244
            "/ 'maxSampleValue ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1245
            metaData at:#MaxSampleValue put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1246
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1247
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1248
        (tagType == 282) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1249
            "/ xResolution
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1250
            metaData at:#ResolutionX put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1251
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1252
                Logger info:'      xResolution: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1253
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1254
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1255
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1256
        (tagType == 283) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1257
            "/ yResolution
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1258
            metaData at:#ResolutionY put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1259
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1260
                Logger info:'      yResolution: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1261
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1262
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1263
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1264
        (tagType == 284) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1265
            (value == 1) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1266
                planarConfiguration := 1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1267
            ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1268
                (value == 2) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1269
                    planarConfiguration := 2
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1270
                ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1271
                    planarConfiguration := nil
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1272
                ]
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1273
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1274
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1275
                Logger info:'      planarConfiguration: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1276
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1277
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1278
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1279
        (tagType == 285) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1280
            "/ 'pageName ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1281
            metaData at:#PageName put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1282
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1283
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1284
        (tagType == 286) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1285
            "/ 'xPosition ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1286
            metaData at:#PositionX put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1287
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1288
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1289
        (tagType == 287) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1290
            "/ 'yPosition ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1291
            metaData at:#PositionY put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1292
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1293
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1294
        (tagType == 288) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1295
            "/ 'freeOffsets ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1296
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1297
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1298
        (tagType == 289) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1299
            "/ 'freeByteCounts ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1300
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1301
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1302
        (tagType == 290) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1303
            "/ 'grayResponceUnit' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1304
            metaData at:#GrayResponceUnit put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1305
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1306
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1307
        (tagType == 291) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1308
            "/ 'grayResponceCurve' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1309
            metaData at:#GrayResponceCurve put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1310
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1311
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1312
        (tagType == 292) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1313
            "/ group3options (now called T4Options)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1314
            "/      2DENCODING      -> 1
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1315
            "/      UNCOMPRESSED    -> 2
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1316
            "/      FILLBITS        -> 4
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1317
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1318
            group3options := value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1319
            "/ 'group3options ' print. group3options printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1320
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1321
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1322
        (tagType == 293) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1323
            "/ group4options (now called T6Options)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1324
            "/      UNCOMPRESSED    -> 2
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1325
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1326
            "group4options := value."
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1327
            "/ 'group4options ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1328
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1329
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1330
        (tagType == 296) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1331
            "resolutionunit"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1332
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1333
            "/        (value == 1) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1334
            "/            'res-unit pixel' printNewline
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1335
            "/        ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1336
            "/            (value == 2) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1337
            "/                'res-unit inch' printNewline
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1338
            "/            ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1339
            "/                (value == 3) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1340
            "/                    'res-unit mm' printNewline
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1341
            "/                ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1342
            "/                    'res-unit invalid' printNewline
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1343
            "/                ]
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1344
            "/            ]
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1345
            "/        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1346
            metaData at:#ResolutionUnit put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1347
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1348
                Logger info:'      resolutionUnit: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1349
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1350
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1351
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1352
        (tagType == 297) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1353
            "/ 'pageNumber ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1354
            metaData at:#PageNumber put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1355
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1356
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1357
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1358
    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1359
    (tagType between:300 and:399) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1360
        (tagType == 300) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1361
            "/ 'colorResponceUnit' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1362
            metaData at:#ColorResponceUnit put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1363
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1364
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1365
        (tagType == 301) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1366
            "/ 'colorResponceCurve' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1367
            metaData at:#ColorResponceCurve put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1368
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1369
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1370
        (tagType == 305) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1371
            "software - info only"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1372
            metaData at:#Software put:value asString.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1373
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1374
                Logger info:'      software: %1' with:value asString
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1375
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1376
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1377
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1378
        (tagType == 306) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1379
            "dateTime - info only"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1380
            metaData at:#DateTime put:value asString.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1381
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1382
                Logger info:'      dateTime: %1' with:value asString
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1383
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1384
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1385
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1386
        (tagType == 315) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1387
            "artist - info only"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1388
            metaData at:#Artist put:value asString.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1389
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1390
                Logger info:'      artist: %1' with:value asString
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1391
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1392
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1393
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1394
        (tagType == 316) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1395
            "host computer - info only"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1396
            metaData at:#HostComputer put:value asString.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1397
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1398
                Logger info:'      host: %1' with:value asString
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1399
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1400
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1401
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1402
        (tagType == 317) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1403
            "/ 'predictor ' print. predictor printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1404
            "/ 1 -> no predictor
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1405
            "/ 2 -> horiz. difference (see tiff spec 6.0)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1406
            "/ 3 -> flt pnt (see adobe tech notes)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1407
            "/ 34892 -> horiz difference x2
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1408
            "/ 34893 -> horiz difference x4
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1409
            "/ 34894 -> flt pnt x2
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1410
            "/ 34895 -> flt pnt x4
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1411
            predictor := value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1412
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1413
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1414
        (tagType == 318) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1415
            "/ 'whitePoint ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1416
            metaData at:#WhitePoint put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1417
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1418
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1419
        (tagType == 319) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1420
            "/ 'primaryChromatics ' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1421
            metaData at:#PrimaryChromatics put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1422
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1423
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1424
        (tagType == 320) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1425
            "/ 'colorMap (size=' print. valueArray size print. ')' printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1426
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1427
            "
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1428
             the tiff colormap contains 16bit values;
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1429
             our colormap expects 8bit values
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1430
            "
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1431
            n := valueArray size // 3.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1432
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1433
            rV := ByteArray uninitializedNew:n.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1434
            gV := ByteArray uninitializedNew:n.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1435
            bV := ByteArray uninitializedNew:n.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1436
            scaleFactor := 255.0 / 16rFFFF.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1437
            i2 := n+1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1438
            i3 := 2*n+1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1439
            1 to:n do:[:vi |
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1440
                val := ((valueArray at:vi) * scaleFactor) rounded.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1441
                rV at:vi put:val.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1442
                val := ((valueArray at:i2) * scaleFactor) rounded.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1443
                gV at:vi put:val.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1444
                val := ((valueArray at:i3) * scaleFactor) rounded.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1445
                bV at:vi put:val.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1446
                i2 := i2 + 1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1447
                i3 := i3 + 1.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1448
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1449
            colorMap := MappedPalette redVector:rV greenVector:gV blueVector:bV.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1450
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1451
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1452
        (tagType == 321) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1453
            "/ 'halftonehints' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1454
            metaData at:#HalftoneHints put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1455
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1456
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1457
        (tagType == 322) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1458
            "/ 'tilewidth' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1459
            metaData at:#TileWidth put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1460
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1461
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1462
        (tagType == 323) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1463
            "/ 'tilelength' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1464
            metaData at:#TileLength put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1465
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1466
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1467
        (tagType == 324) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1468
            "/ 'tileoffsets' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1469
            metaData at:#TileOffsets put:valueArray.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1470
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1471
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1472
        (tagType == 325) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1473
            "/ 'tilebytecounts' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1474
            metaData at:#TileByteCounts put:valueArray.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1475
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1476
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1477
        (tagType == 326) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1478
            "/ 'badFaxLines' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1479
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1480
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1481
        (tagType == 327) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1482
            "CleanFaxData"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1483
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1484
            "/        'cleanfaxdata' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1485
            "/        (value == 0) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1486
            "/            'no lines with incorrect pixel counts' printNewline
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1487
            "/        ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1488
            "/            (value == 1) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1489
            "/                'incorrect lines were regenerated' printNewline
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1490
            "/            ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1491
            "/                (value == 2) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1492
            "/                    'incorrect lines were not regenerated' printNewline
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1493
            "/                ] ifFalse:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1494
            "/                    'cleanfaxdata invalid' printNewline
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1495
            "/                ]
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1496
            "/            ]
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1497
            "/        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1498
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1499
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1500
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1501
        (tagType == 328) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1502
            "/ 'consecutiveBadFaxLines' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1503
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1504
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1505
        (tagType == 330) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1506
            "/ subifd
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1507
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1508
                Logger info:'      subifd: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1509
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1510
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1511
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1512
        (tagType == 332) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1513
            "/ 'ink set' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1514
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1515
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1516
        (tagType == 333) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1517
            "/ 'ink names' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1518
            metaData at:#IncNames put:value.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1519
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1520
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1521
        (tagType == 334) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1522
            "/ 'numinks' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1523
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1524
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1525
        (tagType == 336) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1526
            "/ 'dot range' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1527
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1528
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1529
        (tagType == 337) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1530
            "/ 'target printer' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1531
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1532
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1533
        (tagType == 338) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1534
            "/ 'extrasamples' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1535
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1536
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1537
        (tagType == 339) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1538
            "/ 'sample format' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1539
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1540
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1541
        (tagType == 340) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1542
            "/ 'min sample value' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1543
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1544
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1545
        (tagType == 341) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1546
            "/ 'max sample value' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1547
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1548
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1549
        (tagType == 342) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1550
            "/ 'transfer range' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1551
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1552
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1553
        (tagType == 343) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1554
            "/ 'clip path' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1555
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1556
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1557
        (tagType == 344) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1558
            "/ 'xclip path units' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1559
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1560
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1561
        (tagType == 345) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1562
            "/ 'yclip path units' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1563
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1564
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1565
        (tagType == 347) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1566
            "/ 'jpegtables' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1567
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1568
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1569
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1570
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1571
    (tagType between:400 and:499) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1572
        (tagType == 400) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1573
            "/ 'GlobalParametersIFD' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1574
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1575
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1576
        (tagType == 401) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1577
            "/ 'ProfileType' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1578
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1579
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1580
        (tagType == 402) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1581
            "/ 'FaxProfile' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1582
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1583
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1584
        (tagType == 403) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1585
            "/ 'CodingMethods' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1586
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1587
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1588
        (tagType == 404) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1589
            "/ 'VersionYear' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1590
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1591
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1592
        (tagType == 405) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1593
            "/ 'ModeNumber' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1594
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1595
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1596
        (tagType == 433) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1597
            "/ 'Decode' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1598
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1599
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1600
        (tagType == 434) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1601
            "/ 'DefaultImageColor' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1602
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1603
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1604
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1605
    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1606
    (tagType between:500 and:599) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1607
        "/ obsolete JPEG tags
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1608
        (tagType == 512) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1609
            "/ 'jpeg proc' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1610
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1611
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1612
        (tagType == 513) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1613
            "/ 'jpeg proc' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1614
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1615
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1616
        (tagType == 514) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1617
            "/ 'jpeg ifByteCount' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1618
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1619
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1620
        (tagType == 515) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1621
            "/ 'jpeg restartInterval' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1622
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1623
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1624
        (tagType == 517) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1625
            "/ 'jpeg glossLessPredictors' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1626
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1627
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1628
        (tagType == 518) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1629
            "/ 'jpeg pointTransform' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1630
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1631
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1632
        (tagType == 519) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1633
            "/ 'jpeg qTables' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1634
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1635
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1636
        (tagType == 520) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1637
            "/ 'jpeg dcTables' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1638
             ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1639
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1640
        (tagType == 521) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1641
            "/ 'jpeg acTables' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1642
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1643
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1644
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1645
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1646
        (tagType == 529) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1647
            "/ ycbr coeff
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1648
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1649
                Logger info:'      ycbr coeff: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1650
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1651
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1652
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1653
        (tagType == 530) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1654
            "/ ycbr subsampling
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1655
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1656
                Logger info:'      ycbr subsampling: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1657
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1658
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1659
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1660
        (tagType == 531) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1661
            "/ ycbr positioning
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1662
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1663
                Logger info:'      ycbr positioning: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1664
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1665
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1666
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1667
        (tagType == 532) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1668
            "/ referenceBlackWhite
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1669
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1670
                Logger info:'      referenceBlackWhite: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1671
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1672
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1673
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1674
        (tagType == 559) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1675
            "/ 'stripRowCounts' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1676
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1677
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1678
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1679
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1680
    (tagType between:700 and:799) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1681
        (tagType == 700) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1682
            "XMLPACKET"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1683
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1684
            "/ In TIFF files, the XML Packet containing XMP metadata is pointed to
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1685
            "/ by an entry in the Image File Directory (IFD). That entry has a Tag
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1686
            "/ value of 700, as shown in Table 1.1, "TIFF IFD Directory Entry for
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1687
            "/ XML Packets
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1688
            
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1689
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1690
                Logger info:'      XMLPACKET: %1' with:value asString
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1691
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1692
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1693
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1694
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1695
    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1696
    (tagType between:32000 and:32999) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1697
        (tagType == 32781) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1698
            "/'imageid' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1699
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1700
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1701
        (tagType == 32932) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1702
            "/'wang annotation' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1703
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1704
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1705
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1706
        "/ Private Island graphics tags
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1707
        (tagType == 32953) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1708
            "/'ref points' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1709
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1710
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1711
        (tagType == 32954) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1712
            "/ 'regionTagPoint' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1713
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1714
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1715
        (tagType == 32955) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1716
            "/ 'regionWarpCorners' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1717
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1718
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1719
        (tagType == 32956) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1720
            "/ 'regionAffine' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1721
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1722
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1723
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1724
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1725
        "/ Private SGI tags
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1726
        (tagType == 32995) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1727
            "/ 'matteing' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1728
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1729
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1730
        (tagType == 32996) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1731
            "/ 'datatype' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1732
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1733
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1734
        (tagType == 32997) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1735
            "/ 'imagedepth' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1736
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1737
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1738
        (tagType == 32998) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1739
            "/ 'tiledepth' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1740
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1741
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1742
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1743
    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1744
    (tagType between:33000 and:33999) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1745
        "/ Private Pixar tags
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1746
        (tagType == 33300) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1747
            "/ 'image full width' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1748
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1749
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1750
        (tagType == 33301) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1751
            "/ 'image full length' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1752
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1753
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1754
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1755
        "/ Private Eastman Kodak tags
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1756
        (tagType == 33405) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1757
            "/ 'write serial number' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1758
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1759
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1760
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1761
        "/ unknown
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1762
        (tagType == 33432) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1763
            "/ 'copyright' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1764
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1765
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1766
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1767
        (tagType == 33550) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1768
            "/ 'geotiff modelpixelscaletag' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1769
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1770
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1771
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1772
        (tagType == 33723) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1773
            "/ 'RICHTIFFIPTC' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1774
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1775
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1776
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1777
    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1778
    (tagType between:34000 and:34999) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1779
        "/ Private Texas instruments
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1780
        (tagType == 34232) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1781
            "/ 'sequence frame count' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1782
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1783
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1784
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1785
        "/ Private Pixel magic
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1786
        (tagType == 34232) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1787
            "/ 'jbig options' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1788
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1789
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1790
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1791
        "/ private Photoshop
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1792
        (tagType == 34377) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1793
            "/ 'photoshop RICHTIFFIPTC' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1794
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1795
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1796
        (tagType == 34665) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1797
            "/ EXIFIFD
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1798
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1799
                Logger info:'      EXIFIFD: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1800
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1801
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1802
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1803
        (tagType == 34675) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1804
            "/ 'ICCPROFILE' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1805
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1806
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1807
        
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1808
        (tagType == 34732) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1809
            "/ 'ImageLayer' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1810
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1811
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1812
        (tagType == 34859) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1813
            "/ '???' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1814
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1815
                Logger info:'      ?: %1' with:value 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1816
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1817
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1818
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1819
        
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1820
        "/ More Private SGI
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1821
        (tagType == 34908) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1822
            "/ 'fax recv params' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1823
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1824
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1825
        (tagType == 34909) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1826
            "/ 'fax subaddress' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1827
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1828
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1829
        (tagType == 34910) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1830
            "/ 'fax recv time' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1831
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1832
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1833
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1834
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1835
    (tagType between:36000 and:36999) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1836
        (tagType == 36867) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1837
            "/ '???' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1838
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1839
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1840
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1841
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1842
    (tagType between:37000 and:37999) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1843
        (tagType == 37390) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1844
            "/ '???' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1845
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1846
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1847
        (tagType == 37391) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1848
            "/ '???' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1849
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1850
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1851
        (tagType == 37392) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1852
            "/ '???' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1853
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1854
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1855
        (tagType == 37398) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1856
            "/ '???' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1857
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1858
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1859
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1860
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1861
    (tagType between:42000 and:42999) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1862
        (tagType == 42112) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1863
            "/ 'GDAL_METADATA' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1864
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1865
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1866
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1867
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1868
    "/ dng tags (see http://wwwimages.adobe.com/content/dam/Adobe/en/products/photoshop/pdfs/dng_spec_1.4.0.0.pdf)
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1869
    (tagType between:50000 and:50999) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1870
        (tagType == 50706) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1871
            "/ DNGVersion
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1872
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1873
                Logger info:'      DNGVersion: %1' with:value
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1874
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1875
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1876
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1877
        (tagType == 50707) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1878
            "/ DNGBackwardVersion
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1879
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1880
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1881
        (tagType == 50708) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1882
            "/ UniqueCameraModel
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1883
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1884
                Logger info:'      UniqueCameraModel: %1' with:value asString
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1885
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1886
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1887
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1888
        (tagType == 50709) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1889
            "/ LocalizedCameraModel
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1890
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1891
                Logger info:'      LocalizedCameraModel: %1' with:value asString
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1892
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1893
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1894
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1895
        (tagType == 50710) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1896
            "/ 'CFAPlaneColor' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1897
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1898
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1899
        (tagType == 50711) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1900
            "/ 'CFALayout' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1901
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1902
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1903
        (tagType == 50712) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1904
            "/ 'LinearizationTable' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1905
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1906
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1907
        (tagType == 50713) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1908
            "/ 'BlackLevelRepeatDim' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1909
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1910
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1911
        (tagType == 50714) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1912
            "/ 'BlackLevel' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1913
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1914
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1915
        (tagType == 50715) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1916
            "/ 'BlackLevelDeltaH' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1917
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1918
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1919
        (tagType == 50716) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1920
            "/ 'BlackLevelDeltaV' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1921
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1922
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1923
        (tagType == 50717) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1924
            "/ 'WhiteLevel' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1925
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1926
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1927
        (tagType == 50718) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1928
            "/ 'DefaultScale' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1929
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1930
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1931
        (tagType == 50719) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1932
            "/ 'DefaultCropOrigin' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1933
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1934
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1935
        (tagType == 50720) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1936
            "/ 'DefaultCropSize' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1937
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1938
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1939
        (tagType == 50721) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1940
            "/ 'ColorMatrix1' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1941
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1942
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1943
        (tagType == 50722) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1944
            "/ 'ColorMatrix2' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1945
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1946
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1947
        (tagType == 50723) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1948
            "/ 'CameraCalibrarion1' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1949
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1950
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1951
        (tagType == 50724) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1952
            "/ 'CameraCalibrarion2' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1953
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1954
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1955
        (tagType == 50725) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1956
            "/ 'ReductionMatrix1' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1957
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1958
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1959
        (tagType == 50726) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1960
            "/ 'ReductionMatrix2' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1961
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1962
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1963
        (tagType == 50727) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1964
            "/ 'AnalogBalance' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1965
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1966
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1967
        (tagType == 50728) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1968
            "/ 'AsShotNeutral' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1969
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1970
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1971
        (tagType == 50729) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1972
            "/ 'AsShotWhiteXY' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1973
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1974
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1975
        (tagType == 50730) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1976
            "/ 'BaselineExposure' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1977
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1978
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1979
        (tagType == 50731) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1980
            "/ 'BaselineNoise' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1981
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1982
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1983
        (tagType == 50732) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1984
            "/ 'BaselineSharpness' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1985
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1986
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1987
        (tagType == 50733) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1988
            "/ 'ByerGreenSplit' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1989
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1990
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1991
        (tagType == 50734) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1992
            "/ 'LinearResponseLimit' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1993
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1994
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1995
        (tagType == 50735) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1996
            "/ 'CameraSerialNumber' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1997
            Verbose == true ifTrue:[ 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1998
                Logger info:'      CameraSerialNumber: %1' with:value asString
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  1999
            ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2000
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2001
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2002
        (tagType == 50736) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2003
            "/ 'LensInfo' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2004
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2005
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2006
        (tagType == 50737) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2007
            "/ 'ChromaBlurRadius' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2008
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2009
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2010
        (tagType == 50738) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2011
            "/ 'AntiAliasStrength' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2012
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2013
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2014
        (tagType == 50739) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2015
            "/ 'ShadowScale' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2016
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2017
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2018
        (tagType == 50740) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2019
            "/ 'DNGPrivateData' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2020
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2021
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2022
        (tagType == 50741) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2023
            "/ 'MakerNoteSafety' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2024
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2025
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2026
        (tagType == 50778) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2027
            "/ 'CalibrationIlluminant1' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2028
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2029
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2030
        (tagType == 50779) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2031
            "/ 'CalibrationIlluminant2' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2032
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2033
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2034
        (tagType == 50780) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2035
            "/ 'BestQualityScale' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2036
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2037
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2038
        (tagType == 50781) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2039
            "/ 'RawDataUniqueID' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2040
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2041
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2042
        (tagType == 50827) ifTrue:[
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2043
            "/ 'OriginalRawFileName' print. value printNewline.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2044
            ^ self
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2045
        ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2046
    ].
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2047
    
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2048
"/
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2049
"/ 'TIFFReader: tag:' print. tagType print. ' typ:' print. numberType print.
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2050
"/ ' len:' print. length print. ' offs:' print. offset print. 
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2051
"/ ' val:' print. value print. ' valArr:' print. valueArray printNewline.  
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2052
"/
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2053
    'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2054
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2055
    "Modified (format): / 23-05-2017 / 16:12:58 / mawalch"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2056
    "Modified (format): / 25-08-2017 / 17:02:57 / cg"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2057
!
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2058
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  2059
positionToStrip:stripNr
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2060
    inStream position:(stripOffsets at:stripNr).
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  2061
!
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  2062
3979
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2063
positionToTile:tileNr
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2064
    inStream position:((metaData at:#'TileOffsets') at:tileNr).
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2065
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2066
    "Created: / 25-08-2017 / 13:43:30 / cg"
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2067
!
5d915912216f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  2068
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  2069
readBytes:n signed:isSigned
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2070
    "read n 8bit signed or unsigned integers and return them in an array or byteArray"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2071
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2072
    |oldPos offset bytes nInline|
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2073
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2074
    n == 0 ifTrue:[^ ''].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2075
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2076
    nInline := isBigTiff ifTrue:[8] ifFalse:[4].
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  2077
    bytes := (isSigned ifTrue:[Array] ifFalse:[ByteArray]) new:n.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2078
    (n <= nInline) ifTrue:[
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  2079
        isSigned ifTrue:[
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2080
            1 to:n do:[:i | bytes at:i put:(inStream nextSignedByte) ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2081
        ] ifFalse:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2082
            inStream nextBytes:n into:bytes.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2083
        ].
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2084
        (n < nInline) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2085
            inStream skip:(nInline - n).
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2086
        ]
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2087
    ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2088
        offset := inStream nextInt32MSB:(byteOrder ~~ #lsb).
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2089
        oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2090
        inStream position:offset.
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  2091
        isSigned ifTrue:[
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2092
            1 to:n do:[:i | bytes at:i put:(inStream nextSignedByte) ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2093
        ] ifFalse:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2094
            inStream nextBytes:n into:bytes.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2095
        ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2096
        inStream position:oldPos
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2097
    ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2098
    ^ bytes
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2099
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2100
    "Modified: / 24-08-2017 / 23:25:30 / cg"
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2101
!
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2102
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2103
readChars:n
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2104
    "read n characters and return them in a string"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2105
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2106
    |oldPos offset string nInline|
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2107
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2108
    n == 0 ifTrue:[^ ''].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2109
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2110
    nInline := isBigTiff ifTrue:[8] ifFalse:[4].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2111
    
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2112
    string := String new:(n - 1).
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2113
    (n <= nInline) ifTrue:[
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2114
        inStream nextBytes:(n - 1) into:string.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2115
        (n < nInline) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2116
            inStream skip:(nInline - n).
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2117
        ]
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2118
    ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2119
        offset := inStream nextInt32MSB:(byteOrder ~~ #lsb).
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2120
        oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2121
        inStream position:offset.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2122
        inStream nextBytes:(n - 1) into:string.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2123
        inStream position:oldPos
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2124
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2125
    ^ string
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2126
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2127
    "Modified: / 24-08-2017 / 23:25:03 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2128
!
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2129
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2130
readDoubles:nFloats
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2131
    "read nFloats IEEE 64bit doubles and return them in an array"
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2132
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2133
    |oldPos offset values val msb 
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2134
     n "{ Class: SmallInteger }" |
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2135
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2136
    n := nFloats.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2137
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2138
    msb := byteOrder ~~ #lsb.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2139
    values := DoubleArray basicNew:n.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2140
    (n == 1) ifTrue:[
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2141
        val := Float readBinaryIEEEDoubleFrom:inStream MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2142
        values at:1 put:val.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2143
    ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2144
        offset := inStream nextInt32MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2145
        oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2146
        inStream position:offset.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2147
        1 to:n do:[:index |
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2148
            val := Float readBinaryIEEEDoubleFrom:inStream MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2149
            values at:index put:val
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2150
        ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2151
        inStream position:oldPos
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2152
    ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2153
    ^ values
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2154
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2155
    "Modified: / 24-08-2017 / 23:28:22 / cg"
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2156
!
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2157
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2158
readFloats:nFloats
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2159
    "read nFloats IEEE 32bit floats and return them in an array"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2160
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2161
    |oldPos offset values val val1 val2 msb 
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2162
     n "{ Class: SmallInteger }" |
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2163
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2164
    n := nFloats.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2165
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2166
    msb := byteOrder ~~ #lsb.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2167
    values := FloatArray basicNew:n.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2168
    (isBigTiff and:[ n == 2 ]) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2169
        val1 := ShortFloat readBinaryIEEESingleFrom:inStream MSB:msb.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2170
        val2 := ShortFloat readBinaryIEEESingleFrom:inStream MSB:msb.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2171
        values at:1 put:val1.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2172
        n == 2 ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2173
            values at:2 put:val2.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2174
        ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2175
    ] ifFalse:[    
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2176
        (n == 1) ifTrue:[
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2177
            val := ShortFloat readBinaryIEEESingleFrom:inStream MSB:msb.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2178
            values at:1 put:val.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2179
        ] ifFalse:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2180
            offset := inStream nextInt32MSB:msb.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2181
            oldPos := inStream position.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2182
            inStream position:offset.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2183
            1 to:n do:[:index |
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2184
                val := ShortFloat readBinaryIEEESingleFrom:inStream MSB:msb.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2185
                values at:index put:val
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2186
            ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2187
            inStream position:oldPos
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2188
        ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2189
    ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2190
    ^ values
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2191
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2192
    "Modified: / 24-08-2017 / 23:36:39 / cg"
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2193
!
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2194
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  2195
readFracts:nFracts signed:isSigned
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2196
    "read nFracts fractions (2 32bit words) and return them in an array"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2197
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2198
    |oldPos offset values numerator denominator msb
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2199
     n "{ Class: SmallInteger }" |
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2200
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2201
    n := nFracts.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2202
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2203
    msb := byteOrder ~~ #lsb.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2204
    values := Array basicNew:n.
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2205
    offset := inStream nextInt32MSB:msb.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2206
    oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2207
    inStream position:offset.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2208
    1 to:n do:[:index |
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2209
        numerator := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb].
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2210
        denominator := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb].
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  2211
        values at:index put:(Fraction numerator:numerator denominator:denominator)
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2212
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2213
    inStream position:oldPos.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2214
    ^ values
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2215
!
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2216
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2217
readLong8s:nLongs signed:isSigned
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2218
    "read nLongs signed or unsigned long8 numbers (64bit) and return them in an array"
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2219
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2220
    |oldPos offset values val msb 
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2221
     n "{ Class: SmallInteger }" |
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2222
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2223
    n := nLongs.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2224
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2225
    msb := byteOrder ~~ #lsb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2226
    values := Array basicNew:n.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2227
    (n == 1) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2228
        val := isSigned ifTrue:[inStream nextInt64MSB:msb] ifFalse:[inStream nextUnsignedInt64MSB:msb].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2229
        values at:1 put:val.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2230
    ] ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2231
        offset := inStream nextInt64MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2232
        oldPos := inStream position.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2233
        inStream position:offset.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2234
        1 to:n do:[:index |
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2235
            val := isSigned ifTrue:[inStream nextInt64MSB:msb] ifFalse:[inStream nextUnsignedInt64MSB:msb].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2236
            values at:index put:val
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2237
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2238
        inStream position:oldPos
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2239
    ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2240
    ^ values
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2241
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2242
    "Created: / 24-08-2017 / 22:01:26 / cg"
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2243
!
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2244
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  2245
readLongs:nLongs signed:isSigned
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2246
    "read nLongs signed or unsigned long numbers (32bit) and return them in an array"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2247
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2248
    |oldPos offset values val val1 val2 msb 
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2249
     n "{ Class: SmallInteger }" |
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2250
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2251
    n := nLongs.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2252
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2253
    msb := byteOrder ~~ #lsb.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2254
    values := Array basicNew:n.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2255
    (isBigTiff and:[ n <= 2 ]) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2256
        val1 := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2257
        val2 := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2258
        values at:1 put:val1.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2259
        n == 2 ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2260
            values at:2 put:val2.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2261
        ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2262
    ] ifFalse:[
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2263
        (n == 1) ifTrue:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2264
            val := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb].
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2265
            values at:1 put:val.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2266
        ] ifFalse:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2267
            offset := inStream nextInt32MSB:msb.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2268
            oldPos := inStream position.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2269
            inStream position:offset.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2270
            1 to:n do:[:index |
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2271
                val := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2272
                values at:index put:val
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2273
            ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2274
            inStream position:oldPos
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  2275
        ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2276
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2277
    ^ values
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2278
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2279
    "Modified: / 24-08-2017 / 23:35:38 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2280
!
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2281
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  2282
readShorts:nShorts signed:isSigned
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2283
    "read nShorts signed or unsigned short numbers (16bit) and return them in an array"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2284
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2285
    |oldPos offset values msb val1 val2 val3 val4
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2286
     n "{ Class: SmallInteger }" |
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2287
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2288
    n := nShorts.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2289
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2290
    msb := (byteOrder ~~ #lsb).
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2291
    values := Array basicNew:n.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2292
    (isBigTiff and:[ (n <= 4) ]) ifTrue:[ 
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  2293
        isSigned ifTrue:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2294
            val1 := inStream nextInt16MSB:msb.
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2295
            val2 := inStream nextInt16MSB:msb.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2296
            val3 := inStream nextInt16MSB:msb.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2297
            val4 := inStream nextInt16MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2298
        ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2299
            val1 := inStream nextUnsignedInt16MSB:msb.
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2300
            val2 := inStream nextUnsignedInt16MSB:msb.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2301
            val3 := inStream nextUnsignedInt16MSB:msb.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2302
            val4 := inStream nextUnsignedInt16MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2303
        ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2304
        values at:1 put:val1.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2305
        (n >= 2) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2306
            values at:2 put:val2.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2307
            (n >= 3) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2308
                values at:3 put:val3.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2309
                (n == 4) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2310
                    values at:4 put:val4.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2311
                ]
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2312
            ]
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  2313
        ]
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2314
    ] ifFalse:[
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2315
        (n <= 2) ifTrue:[
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  2316
            isSigned ifTrue:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2317
                val1 := inStream nextInt16MSB:msb.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2318
                val2 := inStream nextInt16MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2319
            ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2320
                val1 := inStream nextUnsignedInt16MSB:msb.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2321
                val2 := inStream nextUnsignedInt16MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  2322
            ].
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2323
            values at:1 put:val1.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2324
            (n == 2) ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2325
                values at:2 put:val2
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2326
            ]
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2327
        ] ifFalse:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2328
            offset := inStream nextInt32MSB:msb.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2329
            oldPos := inStream position.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2330
            inStream position:offset.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2331
            1 to:n do:[:index |
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2332
                isSigned ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2333
                    val1 := inStream nextInt16MSB:msb.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2334
                ] ifFalse:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2335
                    val1 := inStream nextUnsignedInt16MSB:msb.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2336
                ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2337
                values at:index put:val1
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2338
            ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2339
            inStream position:oldPos
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  2340
        ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2341
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2342
    ^ values
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2343
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2344
    "Modified: / 24-08-2017 / 23:33:09 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2345
! !
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2346
1762
55cf76514c8c method category rename
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  2347
!TIFFReader methodsFor:'private-writing'!
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2348
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2349
writeBitsPerSample
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  2350
"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2351
'bitsPerSample: ' print. bitsPerSample printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2352
'store bitspersample at: ' print. outStream position printNewline.
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  2353
"
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2354
    bitsPerSamplePos := outStream position.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2355
    bitsPerSample do:[:n |
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2356
        self writeShort:n
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2357
    ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2358
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  2359
3f9277473954 Initial revision
claus
parents:
diff changeset
  2360
writeColorMap
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  2361
    |n|
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  2362
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2363
    colorMapPos := outStream position.
35
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  2364
    #(red green blue) do:[:component |
440
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2365
        n := 0.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2366
        colorMap do:[:clr |
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2367
            |entry|
35
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  2368
440
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2369
            clr isNil ifTrue:[
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2370
                entry := 0
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2371
            ] ifFalse:[
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2372
                entry := clr perform:component.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2373
                "
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2374
                 tiff map is 16 bit - scale from percent to 0..16rFFFF
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2375
                "
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2376
                entry := (entry * 16rFFFF / 100) rounded.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2377
            ].
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2378
            self writeShort:entry.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2379
            n := n + 1
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2380
        ].
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2381
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2382
        "
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2383
         fill to 256 entries
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2384
        "
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2385
        [n < 256] whileTrue:[
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2386
            self writeShort:0.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2387
            n := n + 1.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2388
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2389
    ]
440
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2390
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  2391
    "Modified: 20.2.1997 / 18:06:10 / cg"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2392
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  2393
3f9277473954 Initial revision
claus
parents:
diff changeset
  2394
writeStripByteCounts
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  2395
"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2396
'stripByteCounts: ' print. stripByteCounts printNewline.
3f9277473954 Initial revision
claus
parents:
diff changeset
  2397
'store stripbytecounts at: ' print. outStream position printNewline.
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  2398
"
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2399
    stripByteCountsPos := outStream position.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2400
    stripByteCounts do:[:c |
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2401
        self writeShort:c
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2402
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
  2403
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  2404
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2405
writeStripOffsets
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  2406
"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2407
'stripOffsets: ' print. stripOffsets printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2408
'store stripoffsets at: ' print. outStream position printNewline.
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  2409
"
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2410
    stripOffsetsPos := outStream position.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2411
    stripOffsets do:[:o |
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2412
        self writeLong:o
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2413
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
  2414
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  2415
3f9277473954 Initial revision
claus
parents:
diff changeset
  2416
writeTag:tagType
3f9277473954 Initial revision
claus
parents:
diff changeset
  2417
    self writeTiffTag:tagType.
3f9277473954 Initial revision
claus
parents:
diff changeset
  2418
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  2419
3f9277473954 Initial revision
claus
parents:
diff changeset
  2420
writeTiffTag:tagType
3f9277473954 Initial revision
claus
parents:
diff changeset
  2421
    |value valueArray numberType count address|
3f9277473954 Initial revision
claus
parents:
diff changeset
  2422
3f9277473954 Initial revision
claus
parents:
diff changeset
  2423
    count := 1.
3f9277473954 Initial revision
claus
parents:
diff changeset
  2424
    address := nil.
3f9277473954 Initial revision
claus
parents:
diff changeset
  2425
    (tagType == 253) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2426
        "tiff class"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2427
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2428
    (tagType == 254) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  2429
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2430
    (tagType == 255) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2431
        "SubfileType"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2432
        value := subFileType.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2433
        numberType := #long.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2434
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2435
    (tagType == 256) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2436
        "ImageWidth"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2437
        value := width.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2438
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2439
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2440
    (tagType == 257) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2441
        "ImageHeight"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2442
        value := height.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2443
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2444
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2445
    (tagType == 258) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2446
        "bitspersample"
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2447
        address := bitsPerSamplePos.
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2448
        numberType := #short.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2449
        count := bitsPerSample size.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2450
        valueArray := bitsPerSample
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2451
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2452
    (tagType == 259) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2453
        "compression"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2454
        value := compression.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2455
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2456
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2457
    (tagType == 262) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2458
        "photometric"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2459
        (photometric == #whiteIs0) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2460
            value := 0
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2461
        ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2462
            (photometric == #blackIs0) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2463
                value := 1
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2464
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2465
                (photometric == #rgb) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2466
                    value := 2
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2467
                ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2468
                    (photometric == #palette) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2469
                        value := 3
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2470
                    ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2471
                        (photometric == #transparency) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2472
                            value := 4
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2473
                        ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2474
                            self error:'bad photometric' mayProceed:true.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2475
                        ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2476
                    ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2477
                ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2478
            ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2479
        ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2480
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2481
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2482
    (tagType == 263) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  2483
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2484
    (tagType == 264) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  2485
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2486
    (tagType == 265) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  2487
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2488
    (tagType == 266) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2489
        "fillOrder"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2490
        (fillOrder == #msb) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2491
            value := 1
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2492
        ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2493
            (fillOrder == #lsb) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2494
                value := 2
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2495
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2496
                self error:'bad fillOrder' mayProceed:true
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2497
            ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2498
        ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2499
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2500
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2501
    (tagType == 269) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  2502
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2503
    (tagType == 270) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  2504
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2505
    (tagType == 271) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  2506
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2507
    (tagType == 272) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  2508
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2509
    (tagType == 273) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2510
        "stripoffsets"
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2511
        address := stripOffsetsPos.
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2512
        numberType := #long.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2513
        count := stripOffsets size.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2514
        valueArray := stripOffsets
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2515
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2516
    (tagType == 274) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  2517
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2518
    (tagType == 277) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2519
        "samplesPerPixel"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2520
        value := samplesPerPixel.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2521
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2522
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2523
    (tagType == 278) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2524
        "rowsperstrip"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2525
        value := rowsPerStrip.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2526
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2527
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2528
    (tagType == 279) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2529
        "stripbytecount"
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2530
        address := stripByteCountsPos.
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2531
        numberType := #short.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2532
        count := stripByteCounts size.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2533
        valueArray := stripByteCounts
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2534
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2535
    (tagType == 280) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2536
        "min sample value"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2537
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2538
    (tagType == 281) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2539
        "max sample value"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2540
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2541
    (tagType == 282) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2542
        "x resolution"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2543
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2544
    (tagType == 283) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2545
        "y resolution"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2546
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2547
    (tagType == 284) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2548
        "planarconfig"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2549
        value := planarConfiguration.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2550
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2551
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2552
    (tagType == 285) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2553
        "pageName"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2554
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2555
    (tagType == 286) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2556
        "xPosition"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2557
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2558
    (tagType == 287) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2559
        "yPosition"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2560
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2561
    (tagType == 288) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2562
        "freeOffsets"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2563
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2564
    (tagType == 289) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2565
        "freeByteCounts"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2566
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2567
    (tagType == 290) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2568
        "grayResponceUnit"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2569
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2570
    (tagType == 291) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2571
        "grayResponceCurve"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2572
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2573
    (tagType == 292) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2574
        "group3options"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2575
        value := group3options.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2576
        numberType := #long.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2577
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2578
    (tagType == 293) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2579
        "group4options"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2580
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2581
    (tagType == 296) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2582
        "resolutionunit"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2583
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2584
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2585
    (tagType == 297) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2586
        "pageNumber"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2587
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2588
    (tagType == 300) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2589
        "colorResponceUnit"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2590
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2591
    (tagType == 301) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2592
        "colorResponceCurve"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2593
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2594
    (tagType == 306) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2595
        "dateTime"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2596
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2597
    (tagType == 315) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2598
        "artist"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2599
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2600
    (tagType == 317) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2601
        "predictor"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2602
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2603
    (tagType == 320) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2604
        "colormap"
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2605
        address := colorMapPos.
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2606
        numberType := #short.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2607
        count := 256 "(colorMap at:1) size" * 3.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2608
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2609
3f9277473954 Initial revision
claus
parents:
diff changeset
  2610
    (value isNil and:[address isNil]) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2611
        self error:'unhandled tag' mayProceed:true.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2612
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2613
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2614
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  2615
"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2616
'tag:' print. tagType print. ' typ:' print. numberType print.
3f9277473954 Initial revision
claus
parents:
diff changeset
  2617
' len:' print. count print.
3f9277473954 Initial revision
claus
parents:
diff changeset
  2618
' val:' print. value printNewline.  
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  2619
"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2620
3f9277473954 Initial revision
claus
parents:
diff changeset
  2621
    self writeShort:tagType.
3f9277473954 Initial revision
claus
parents:
diff changeset
  2622
    numberType == #short ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2623
        self writeShort:3.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2624
        self writeLong:count.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2625
    ] ifFalse:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2626
        numberType == #long ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2627
            self writeShort:4.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2628
            self writeLong:count.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2629
        ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2630
            numberType == #byte ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2631
                self writeShort:1.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2632
                self writeLong:count.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2633
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2634
                self error:'bad numbertype'
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2635
            ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2636
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2637
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2638
    address notNil ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2639
        (numberType == #long and:[count == 1]) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2640
            self writeLong:(valueArray at:1).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2641
            ^ self
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2642
        ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2643
        (numberType == #short and:[count <= 2]) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2644
            self writeShort:(valueArray at:1).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2645
            count == 2 ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2646
                self writeShort:(valueArray at:2).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2647
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2648
                self writeShort:0
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2649
            ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2650
            ^ self
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2651
        ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2652
        (numberType == #byte and:[count <= 4]) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2653
            outStream nextPut:(valueArray at:1).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2654
            count > 1 ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2655
                outStream nextPut:(valueArray at:2).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2656
                count > 2 ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2657
                    outStream nextPut:(valueArray at:3).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2658
                    count > 3 ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2659
                        outStream nextPut:(valueArray at:4).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2660
                    ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2661
                        outStream nextPut:0
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2662
                    ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2663
                ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2664
                    outStream nextPut:0
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2665
                ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2666
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2667
                outStream nextPut:0
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2668
            ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2669
            ^ self
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2670
        ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2671
        self writeLong:address.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2672
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2673
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2674
    numberType == #short ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2675
        self writeShort:value.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2676
        self writeShort:0
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2677
    ] ifFalse:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2678
        numberType == #long ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2679
            self writeLong:value
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2680
        ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2681
            numberType == #byte ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2682
                outStream nextPut:value.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2683
                outStream nextPut:0.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2684
                outStream nextPut:0.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2685
                outStream nextPut:0.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2686
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2687
                self error:'bad numbertype'
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2688
            ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  2689
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2690
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2691
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  2692
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2693
writeUncompressedBits
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2694
    "write bits as one or multiple strips"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2695
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2696
    |offs bytesPerRow nBytes
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2697
     h "{ Class: SmallInteger }"|
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2698
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2699
    nBytes := data size.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2700
    nBytes < 16rFFFF ifTrue:[
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2701
        stripOffsets := Array with:(outStream position).
1703
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2702
        stripByteCounts := Array with:nBytes.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2703
        outStream nextPutBytes:nBytes from:data.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2704
        rowsPerStrip := height
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2705
    ] ifFalse:[
1703
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2706
        stripOffsets := Array basicNew:height.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2707
        bytesPerRow := nBytes // height.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2708
        stripByteCounts := (Array basicNew:height) atAllPut:bytesPerRow.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2709
1703
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2710
        offs := 1.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2711
        h := height.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2712
        1 to:h do:[:row |
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2713
            stripOffsets at:row put:(outStream position).
1703
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2714
            outStream nextPutBytes:bytesPerRow from:data startingAt:offs.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2715
            offs := offs + bytesPerRow
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2716
        ].
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2717
        rowsPerStrip := 1
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2718
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2719
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2720
    'stripOffsets: ' print. stripOffsets printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2721
    'stripByteCounts: ' print. stripByteCounts printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2722
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2723
! !
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2724
1805
93f557cbe600 category changes
Claus Gittinger <cg@exept.de>
parents: 1785
diff changeset
  2725
!TIFFReader methodsFor:'reading'!
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2726
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2727
fromStream:aStream
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2728
    "read a stream containing a TIFF image.
3899
fd43372bf11d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3777
diff changeset
  2729
     Leave image description in instance variables.
fd43372bf11d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3777
diff changeset
  2730
     (i.e. to get the image, ask with image)."
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2731
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2732
    |char1 char2 version 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2733
     numberOfTags "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2734
     tagType      "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2735
     numberType   "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2736
     length       "{ Class: SmallInteger }"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2737
     result offset msb
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2738
     bytesPerRow offset1 offset2 tmp
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2739
     pos1|
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2740
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2741
    inStream := aStream.
331
304f9c439efa allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
  2742
    aStream binary.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2743
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2744
    char1 := aStream next.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2745
    char2 := aStream next.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2746
    
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2747
    "/ first two chars are either II (intel byte order) 
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2748
    "/ or MM (motorola byte orrder)
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2749
    (char1 ~~ char2) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2750
        ^ self fileFormatError:'not a tiff file'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2751
    ].
1953
90f3c42ef3c1 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1846
diff changeset
  2752
    (char1 == $I codePoint) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2753
        byteOrder := #lsb.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2754
        msb := false.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2755
    ] ifFalse:[
1953
90f3c42ef3c1 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1846
diff changeset
  2756
        (char1 == $M codePoint) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2757
            byteOrder := #msb.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2758
            msb := true.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2759
        ] ifFalse:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2760
            ^ self fileFormatError:'not a tiff file'.
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2761
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2762
    ].
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2763
    isBigTiff := false.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2764
    
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2765
    version := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2766
    (version == 42) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2767
        offset := aStream nextUnsignedInt32MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2768
        aStream position:offset.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2769
    ] ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2770
       (version == 43) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2771
            |byteSizeOfOffsets always0|
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2772
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2773
            "/ 43 is the proposed bigtiff format
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2774
            isBigTiff := true.
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2775
            byteSizeOfOffsets := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2776
            byteSizeOfOffsets == 8 ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2777
                ^ self fileFormatError:'version of bigtiff-file not supported'.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2778
            ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2779
            always0 := aStream nextUnsignedInt16MSB:msb.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2780
            always0 == 0 ifFalse:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2781
                ^ self fileFormatError:'version of bigtiff-file not supported'.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2782
            ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2783
            offset := aStream nextUnsignedInt64MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2784
            aStream position:offset.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2785
        ] ifFalse:[    
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2786
            ^ self fileFormatError:'version of tiff-file not supported'.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2787
        ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2788
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2789
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2790
    "setup default values"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
  2791
    metaData := TIFFMetaData new.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
  2792
    
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2793
    compression := 1. "none"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2794
    fillOrder := #msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2795
    planarConfiguration := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2796
    photometric := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2797
    bitsPerSample := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2798
    samplesPerPixel := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2799
    width := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2800
    height := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2801
    stripOffsets := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2802
    rowsPerStrip := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2803
    "resolutionUnit := 2."
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2804
    predictor := 1.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  2805
    orientation := nil.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2806
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2807
    (version == 42) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2808
        numberOfTags := aStream nextUnsignedInt16MSB:msb.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2809
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2810
        1 to:numberOfTags do:[:index |
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2811
            tagType := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2812
            numberType := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2813
            length := aStream nextInt32MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2814
            self decodeTiffTag:tagType numberType:numberType length:length
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2815
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2816
        offset := aStream nextInt32MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2817
    ] ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2818
        numberOfTags := aStream nextUnsignedInt64MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2819
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2820
        1 to:numberOfTags do:[:index |
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2821
            tagType := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2822
            numberType := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2823
            length := aStream nextInt64MSB:msb.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2824
            pos1 := aStream position.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2825
            self decodeTiffTag:tagType numberType:numberType length:length.
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2826
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2827
        offset := aStream nextInt32MSB:msb.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2828
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2829
    (offset ~~ 0) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2830
        'TIFFReader [info]: more tags ignored' infoPrintCR
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2831
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2832
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2833
    "check for required tags"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2834
    width isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2835
        ^ self fileFormatError:'missing width tag'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2836
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2837
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2838
    height isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2839
        ^ self fileFormatError:'missing length tag'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2840
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2841
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2842
    photometric isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2843
        ^ self fileFormatError:'missing photometric tag'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2844
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2845
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2846
    "given all the information, read the bits"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2847
    stripOffsets isNil ifTrue:[
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2848
        (metaData notNil 
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2849
            and:[(metaData includesKey:#TileWidth) 
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2850
            and:[(metaData includesKey:#TileLength)
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2851
            and:[(metaData includesKey:#TileOffsets)
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2852
            and:[(metaData includesKey:#TileByteCounts) ]]]]
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2853
        ) ifFalse:[    
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  2854
            ^ self fileFormatError:'missing stripOffsets or tileOffsets tag'.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2855
        ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2856
        self reportDimension.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2857
        result := self readTiledTiffImageData.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2858
    ] ifFalse:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2859
        stripByteCounts isNil ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2860
            stripOffsets size == 1 ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2861
                stripByteCounts := Array with:(self bitsPerPixel // 8) * width * height
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2862
            ] ifFalse:[
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  2863
                ^ self fileFormatError:'missing stripByteCounts'.
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2864
            ].    
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2865
        ].
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2866
        self reportDimension.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2867
        rowsPerStrip isNil ifTrue:[
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2868
            rowsPerStrip := height
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2869
        ].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2870
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2871
        result := self readTiffImageData.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2872
    ].
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2873
    
743
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2874
    result isNil ifTrue:[
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2875
        "/ unsupported format.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2876
        ^ nil
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2877
    ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2878
743
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2879
    orientation == #vFlip ifTrue:[
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2880
        "/ reverse rows to top-to bottom
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  2881
743
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2882
        bytesPerRow := self bytesPerRow.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2883
        tmp := ByteArray new:bytesPerRow.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2884
        offset1 := 1.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2885
        offset2 := (height-1)*bytesPerRow + 1.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
  2886
        0 to:((height-1)//2) do:[:row |
3975
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2887
            tmp replaceFrom:1 to:bytesPerRow with:data startingAt:offset1.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2888
            data replaceFrom:offset1 to:(offset1+bytesPerRow-1) with:data startingAt:offset2.
1315fd14851b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  2889
            data replaceFrom:offset2 to:(offset2+bytesPerRow-1) with:tmp startingAt:1.
743
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2890
            offset1 := offset1 + bytesPerRow.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2891
            offset2 := offset2 - bytesPerRow.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  2892
        ].
743
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2893
    ].
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2894
    orientation == #unsupported ifTrue:[
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2895
        'TIFFReader [warning]: unsupported orientation' errorPrintCR
393
9e9f2272b524 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2896
    ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  2897
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2898
    ^ result
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2899
3977
c78bab5f36f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  2900
    "Modified: / 25-08-2017 / 10:08:30 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2901
! !
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2902
1805
93f557cbe600 category changes
Claus Gittinger <cg@exept.de>
parents: 1785
diff changeset
  2903
!TIFFReader methodsFor:'writing'!
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2904
1571
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2905
save:image onStream:aStream
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2906
    "save image as (uncompressed) TIFF file on aFileName"
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2907
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2908
    |pos1 pos indicator|
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2909
1078
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2910
    image mask notNil ifTrue:[
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2911
        Image informationLostQuerySignal
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2912
            raiseWith:image
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2913
            errorString:('TIFF writer does not (yet) support an imageMask').
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2914
    ].
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2915
1571
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2916
    outStream := aStream.
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2917
    outStream binary.
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2918
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2919
    "save as msb"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2920
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2921
    byteOrder := #msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2922
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2923
    byteOrder := #lsb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2924
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2925
    fillOrder := #msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2926
    width := image width.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2927
    height := image height.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2928
    photometric := image photometric.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2929
    samplesPerPixel := image samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2930
    bitsPerSample := image bitsPerSample.
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2931
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2932
    colorMap := image colorMap.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2933
    planarConfiguration := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2934
    compression := 1.   "none"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2935
    data := image bits.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2936
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2937
    currentOffset := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2938
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2939
    (byteOrder == #msb) ifTrue:[
1953
90f3c42ef3c1 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1846
diff changeset
  2940
        indicator := $M codePoint.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2941
    ] ifFalse:[
1953
90f3c42ef3c1 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1846
diff changeset
  2942
        indicator := $I codePoint.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2943
    ].
1571
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2944
    outStream nextPut:indicator; nextPut:indicator.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2945
    currentOffset := currentOffset + 2.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2946
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2947
    self writeShort:42.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2948
    currentOffset := currentOffset + 2.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2949
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2950
    pos1 := outStream position.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2951
    self writeLong:0.           "start of tags - filled in later"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2952
    currentOffset := currentOffset + 4.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2953
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2954
    "output strips"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2955
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2956
    self writeUncompressedBits. "this outputs bits as strips, sets stripOffsets and stripByteCounts"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2957
    self writeStripOffsets.     "this outputs strip offsets, sets stripOffsetsPos"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2958
    self writeStripByteCounts.  "this outputs strip bytecounts, sets stripByteCountPos"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2959
    self writeBitsPerSample.    "this outputs bitsPerSample, sets bitsPerSamplePos"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2960
    photometric == #palette ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2961
        self writeColorMap      "this outputs colorMap, sets colorMapPos"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2962
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2963
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2964
    pos := outStream position.        "backpatch tag offset"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2965
    outStream position:pos1.
1704
1526c7b84920 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1703
diff changeset
  2966
    self writeLong:pos.                     "fill in tag offset"
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2967
    outStream position:pos.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2968
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2969
('patch tag offset at: ', (pos1 printStringRadix:16) , ' to ',
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2970
                         (pos printStringRadix:16)) printNewline.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2971
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2972
    "output tag data"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2973
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2974
    photometric == #palette ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2975
        self writeShort:11.  "11 tags"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2976
    ] ifFalse:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2977
        self writeShort:10.  "10 tags"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2978
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2979
    self writeTag:256.               "image width"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2980
    self writeTag:257.               "image height"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2981
    self writeTag:258.               "bits per sample"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2982
    self writeTag:259.               "compression"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2983
    self writeTag:262.               "photometric"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2984
    self writeTag:273.               "strip offsets"
159
327da5085900 fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2985
    self writeTag:277.               "samplesPerPixel"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2986
    self writeTag:278.               "rowsPerStrip"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2987
    self writeTag:279.               "strip byte counts"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2988
    self writeTag:284.               "planarconfig"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2989
    photometric == #palette ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2990
        self writeTag:320            "colorMap"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2991
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2992
    self writeLong:0.                "end of tags mark"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2993
! !
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
  2994
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2995
!TIFFReader class methodsFor:'documentation'!
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
  2996
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2997
version
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2998
    ^ '$Header$'
3976
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  2999
!
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  3000
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  3001
version_CVS
5eda7dd4846b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  3002
    ^ '$Header$'
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  3003
! !
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  3004
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  3005
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  3006
TIFFReader initialize!