TIFFReader.st
author Claus Gittinger <cg@exept.de>
Fri, 31 Jan 1997 10:40:39 +0100
changeset 392 7729a280960c
parent 359 6fdd7d3119a8
child 393 9e9f2272b524
permissions -rw-r--r--
handle bottom-to-top images (orientation==4)
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
"
3f9277473954 Initial revision
claus
parents:
diff changeset
    12
3f9277473954 Initial revision
claus
parents:
diff changeset
    13
ImageReader subclass:#TIFFReader
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
    14
	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
    15
		fillOrder compression group3options predictor stripByteCounts
327da5085900 fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    16
		currentOffset stripOffsetsPos stripByteCountsPos bitsPerSamplePos
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
    17
		colorMapPos orientation'
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
    18
	classVariableNames:''
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
    19
	poolDictionaries:''
259
62b1bbafd9ba category change
Claus Gittinger <cg@exept.de>
parents: 234
diff changeset
    20
	category:'Graphics-Images-Support'
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    21
!
3f9277473954 Initial revision
claus
parents:
diff changeset
    22
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
    23
!TIFFReader class methodsFor:'documentation'!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    24
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    25
copyright
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    26
"
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    27
 COPYRIGHT (c) 1991 by Claus Gittinger
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    28
	      All Rights Reserved
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    29
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    30
 This software is furnished under a license and may be used
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    31
 only in accordance with the terms of that license and with the
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    33
 be provided or otherwise made available to, or used by, any
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    34
 other person.  No title to or ownership of the software is
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    35
 hereby transferred.
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    36
"
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    37
!
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    38
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    39
documentation
3f9277473954 Initial revision
claus
parents:
diff changeset
    40
"
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    41
    This class knows how to read TIFF files and how to
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    42
    write uncompressed TIFF files.
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
    43
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    44
    Only single image files are supported.
38
201df32d2377 *** empty log message ***
claus
parents: 35
diff changeset
    45
    Not all formats are implemented, and of those that are, not all are tested.
159
327da5085900 fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    46
    It should read with most rgb, mono and 2-plane greyscale
38
201df32d2377 *** empty log message ***
claus
parents: 35
diff changeset
    47
    images, since this is what I have as test material on the NeXT.
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    48
    It supports reading of uncompressed, LZW and G3 compressed 
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    49
    images; JPEG and packbits are currently not implemented.
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
    50
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    51
    Only writing of uncompressed images is currently implemented.
159
327da5085900 fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    52
    It should write (at least) mono, 8-bit palette and 24 bit rgb formats.
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    53
    More formats will come ...
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
    54
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
    55
    TODO: since I dont want to spend all of my life adding more formats here and
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
    56
    reinventing the wheel, this code should be changed to use the tiff library.
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
    57
    That would give us most formats and also writing capabilities for free.
195
7975a2c4a890 commentary
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
    58
220
4106d9ce7e02 documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    59
    [author:]
4106d9ce7e02 documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    60
        Claus Gittinger
4106d9ce7e02 documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    61
195
7975a2c4a890 commentary
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
    62
    [See also:]
234
b6352d13e792 xrefs in documentation
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    63
        Image Form Icon
197
50812e81d86f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 195
diff changeset
    64
        BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader 
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
    65
        ST80FormReader SunRasterReader TargaReader WindowsIconReader 
209
840ddcf12904 commentary
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
    66
        XBMReader XPMReader XWDReader 
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    67
"
3f9277473954 Initial revision
claus
parents:
diff changeset
    68
! !
3f9277473954 Initial revision
claus
parents:
diff changeset
    69
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
    70
!TIFFReader class methodsFor:'initialization'!
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    71
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    72
initialize
198
6d76856aaa80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
    73
    "install myself in the Image classes fileFormat table
6d76856aaa80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
    74
     for the `.tiff', `.tif' and '.TIF' extensions."
6d76856aaa80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
    75
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
    76
    Image fileFormats at:'.tiff' put:self.
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    77
    Image fileFormats at:'.tif'  put:self.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    78
    Image fileFormats at:'.TIF'  put:self.
198
6d76856aaa80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
    79
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
    80
    "
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
    81
     self initialize
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
    82
    "
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
    83
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
    84
    "Modified: 31.1.1997 / 10:18:16 / cg"
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    85
! !
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    86
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
    87
!TIFFReader class methodsFor:'testing'!
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
    88
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
    89
canRepresent:anImage
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
    90
    "return true, if anImage can be represented in my file format.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
    91
     Any image is supported."
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
    92
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
    93
    ^ true
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
    94
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
    95
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
    96
isValidImageFile:aFileName
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
    97
    "return true, if aFileName contains a GIF image"
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
    98
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
    99
    |inStream char1 char2 version|
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   100
11
1d0df18a7049 *** empty log message ***
claus
parents: 6
diff changeset
   101
    inStream := self streamReadingFile:aFileName.
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   102
    inStream isNil ifTrue:[^ false].
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   103
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   104
    char1 := inStream next.
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   105
    char2 := inStream next.
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   106
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   107
    ((char1 ~~ char2) or:[(char1 ~~ $I) and:[char1 ~~ $M]]) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
   108
	inStream close.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
   109
	^ false
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   110
    ].
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   111
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   112
    inStream binary.
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   113
    version := inStream nextShortMSB:(char1 == $M).
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   114
    inStream close.
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   115
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   116
    (version ~~ 42) ifTrue:[^ false].
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   117
    ^ true
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   118
! !
3f9277473954 Initial revision
claus
parents:
diff changeset
   119
3f9277473954 Initial revision
claus
parents:
diff changeset
   120
!TIFFReader methodsFor:'private'!
3f9277473954 Initial revision
claus
parents:
diff changeset
   121
3f9277473954 Initial revision
claus
parents:
diff changeset
   122
decodeTiffTag:tagType numberType:numberType length:length
3f9277473954 Initial revision
claus
parents:
diff changeset
   123
    |offset value valueArray 
40
c2e206361c7b *** empty log message ***
claus
parents: 38
diff changeset
   124
     val scaleFactor rV gV bV
c2e206361c7b *** empty log message ***
claus
parents: 38
diff changeset
   125
     n  "{ Class: SmallInteger }"
35
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
   126
     i2 "{ Class: SmallInteger }"
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
   127
     i3 "{ Class: SmallInteger }" |
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   128
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   129
"/ 'tiffTag: ' print. tagType printCR.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   130
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   131
    (numberType == 3) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   132
        "short"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   133
        valueArray := self readShorts:length.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   134
        value := valueArray at:1
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   135
    ] ifFalse:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   136
        (numberType == 4) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   137
            "integer"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   138
            valueArray := self readLongs:length.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   139
            value := valueArray at:1
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   140
        ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   141
            (numberType == 2) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   142
                "character"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   143
                value := self readChars:length
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   144
            ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   145
                (numberType == 5) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   146
                    "fraction"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   147
                    valueArray := self readFracts:length.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   148
                    value := valueArray at:1
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   149
                ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   150
                    offset := (inStream nextLongMSB:(byteOrder ~~ #lsb))
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   151
                ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   152
            ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   153
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   154
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   155
3f9277473954 Initial revision
claus
parents:
diff changeset
   156
    (tagType == 254) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   157
        "NewSubfileType"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   158
        "newSubFileType := value."
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   159
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   160
"/        'newSubfiletype ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   161
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   162
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   163
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   164
    (tagType == 255) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   165
        "SubfileType"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   166
        subFileType := value.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   167
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   168
"/        'subfiletype ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   169
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   170
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   171
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   172
    (tagType == 256) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   173
        "ImageWidth"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   174
        width := value.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   175
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   176
"/        'width ' print. width printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   177
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   178
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   179
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   180
    (tagType == 257) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   181
        "ImageHeight"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   182
        height := value.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   183
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   184
"/        'height ' print. height  printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   185
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   186
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   187
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   188
    (tagType == 258) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   189
        "bitspersample"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   190
         bitsPerSample := valueArray.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   191
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   192
"/        'bitspersample ' print. bitsPerSample printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   193
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   194
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   195
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   196
    (tagType == 259) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   197
        "compression"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   198
        compression := value.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   199
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   200
"/        'compression ' print. compression printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   201
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   202
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   203
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   204
    (tagType == 262) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   205
        "photometric"
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   206
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   207
        (value == 0) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   208
          photometric := #whiteIs0
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   209
        ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   210
          (value == 1) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   211
            photometric := #blackIs0
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   212
          ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   213
            (value == 2) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   214
              photometric := #rgb
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   215
            ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   216
              (value == 3) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   217
                photometric := #palette
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   218
              ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   219
                (value == 4) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   220
                  photometric := #transparency
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   221
                ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   222
                  (value == 5) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   223
                    photometric := #separated  "/ color separations
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   224
                  ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   225
                    (value == 6) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   226
                      photometric := #ycbr    "/ CCIR 601
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   227
                    ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   228
                      (value == 8) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   229
                        photometric := #cielab  "/ 1976 CIE L*a*b*
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   230
                      ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   231
                        photometric := nil
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   232
                      ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   233
                    ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   234
                  ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   235
                ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   236
              ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   237
            ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   238
          ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   239
        ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   240
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   241
"/        'photometric ' print. photometric printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   242
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   243
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   244
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   245
    (tagType == 263) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   246
        "Treshholding"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   247
        "threshholding := value."
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   248
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   249
"/        'treshholding ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   250
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   251
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   252
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   253
    (tagType == 264) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   254
        "CellWidth"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   255
        "cellWidth:= value."
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   256
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   257
"/        'cellWidth ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   258
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   259
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   260
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   261
    (tagType == 265) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   262
        "CellLength"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   263
        "cellLength:= value."
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   264
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   265
"/        'cellLength ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   266
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   267
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   268
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   269
    (tagType == 266) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   270
        "fillOrder"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   271
        (value == 1) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   272
          fillOrder := #msb
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   273
        ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   274
          (value == 2) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   275
            fillOrder := #lsb
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   276
          ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   277
            fillOrder := nil
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   278
          ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   279
        ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   280
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   281
"/        'fillorder ' print. fillOrder printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   282
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   283
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   284
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   285
    (tagType == 269) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   286
        "documentName - info only"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   287
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   288
"/        'documentName ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   289
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   290
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   291
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   292
    (tagType == 270) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   293
        "imageDescription - info only"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   294
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   295
"/        'imageDescription ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   296
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   297
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   298
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   299
    (tagType == 271) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   300
        "make - info only"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   301
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   302
"/        'make ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   303
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   304
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   305
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   306
    (tagType == 272) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   307
        "model - info only"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   308
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   309
"/        'model ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   310
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   311
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   312
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   313
    (tagType == 273) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   314
        "stripoffsets"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   315
        stripOffsets := valueArray.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   316
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   317
"/        'stripOffsets Array(' print. stripOffsets size print. ')' printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   318
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   319
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   320
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   321
    (tagType == 274) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   322
        "Orientation"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   323
        orientation:= value.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   324
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   325
"/        'orientation ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   326
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   327
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   328
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   329
    (tagType == 277) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   330
        "samplesPerPixel"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   331
        samplesPerPixel := value.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   332
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   333
"/        'samplesperpixel ' print. samplesPerPixel printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   334
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   335
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   336
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   337
    (tagType == 278) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   338
        "rowsperstrip"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   339
        rowsPerStrip := value.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   340
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   341
"/        'rowsperstrip ' print. rowsPerStrip printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   342
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   343
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   344
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   345
    (tagType == 279) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   346
        "stripbytecount"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   347
        stripByteCounts := valueArray.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   348
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   349
"/        'stripByteCounts Array(' print. 
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   350
"/        stripByteCounts size print.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   351
"/        ')' printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   352
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   353
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   354
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   355
    (tagType == 280) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   356
        "MinSampleValue"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   357
        "minSampleValue:= value."
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   358
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   359
"/        'minSampleValue ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   360
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   361
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   362
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   363
    (tagType == 281) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   364
        "MaxSampleValue"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   365
        "maxSampleValue:= value."
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   366
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   367
"/        'maxSampleValue ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   368
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   369
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   370
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   371
    (tagType == 282) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   372
        "xResolution"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   373
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   374
"/        'xres ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   375
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   376
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   377
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   378
    (tagType == 283) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   379
        "yResolution"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   380
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   381
"/        'yres ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   382
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   383
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   384
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   385
    (tagType == 284) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   386
        "planarconfig"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   387
        (value == 1) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   388
          planarConfiguration := 1
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   389
        ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   390
          (value == 2) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   391
            planarConfiguration := 2
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   392
          ] ifFalse:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   393
            planarConfiguration := nil
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   394
          ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   395
        ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   396
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   397
"/        'planarconfig ' print. planarConfiguration printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   398
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   399
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   400
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   401
    (tagType == 285) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   402
        "pageName"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   403
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   404
"/        'pageName ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   405
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   406
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   407
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   408
    (tagType == 286) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   409
        "xPosition"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   410
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   411
"/        'xPos ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   412
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   413
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   414
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   415
    (tagType == 287) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   416
        "yPosition"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   417
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   418
"/        'yPos ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   419
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   420
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   421
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   422
    (tagType == 288) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   423
        "freeOffsets"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   424
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   425
"/        'freeOffsets ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   426
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   427
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   428
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   429
    (tagType == 289) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   430
        "freeByteCounts"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   431
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   432
"/        'freeByteCounts ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   433
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   434
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   435
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   436
    (tagType == 290) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   437
        "grayResponceUnit"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   438
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   439
"/        'grayResponceUnit' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   440
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   441
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   442
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   443
    (tagType == 291) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   444
        "grayResponceCurve"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   445
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   446
"/        'grayResponceCurve' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   447
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   448
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   449
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   450
    (tagType == 292) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   451
        "group3options"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   452
        group3options := value.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   453
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   454
"/        'group3options ' print. group3options printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   455
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   456
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   457
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   458
    (tagType == 293) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   459
        "group4options"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   460
        "group4options := value."
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   461
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   462
"/        'group4options ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   463
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   464
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   465
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   466
    (tagType == 296) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   467
        "resolutionunit"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   468
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   469
"/        (value == 1) ifTrue:[
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   470
"/            'res-unit pixel' printNewline
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   471
"/        ] ifFalse:[
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   472
"/            (value == 2) ifTrue:[
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   473
"/                'res-unit inch' printNewline
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   474
"/            ] ifFalse:[
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   475
"/                (value == 3) ifTrue:[
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   476
"/                    'res-unit mm' printNewline
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   477
"/                ] ifFalse:[
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   478
"/                    'res-unit invalid' printNewline
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   479
"/                ]
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   480
"/            ]
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   481
"/        ].
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   482
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   483
        "resolutionUnit := value."
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   484
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   485
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   486
    (tagType == 297) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   487
        "pageNumber"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   488
        "pageNumber := value."
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   489
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   490
"/        'pageNumber ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   491
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   492
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   493
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   494
    (tagType == 300) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   495
        "colorResponceUnit"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   496
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   497
"/        'colorResponceUnit' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   498
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   499
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   500
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   501
    (tagType == 301) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   502
        "colorResponceCurve"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   503
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   504
"/        'colorResponceCurve' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   505
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   506
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   507
    ].
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   508
    (tagType == 305) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   509
        "software - info only"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   510
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   511
"/        'software' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   512
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   513
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   514
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   515
    (tagType == 306) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   516
        "dateTime - info only"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   517
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   518
"/        'dateTime ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   519
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   520
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   521
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
   522
    (tagType == 315) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   523
        "artist - info only"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   524
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   525
"/        'artist ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   526
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   527
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   528
    ].
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   529
    (tagType == 316) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   530
        "host computer - info only"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   531
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   532
"/        'host ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   533
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   534
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   535
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   536
    (tagType == 317) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   537
        "predictor"
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   538
        predictor := value.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   539
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   540
"/        'predictor ' print. predictor printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   541
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   542
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   543
    ].
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   544
    (tagType == 318) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   545
        "whitePoint"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   546
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   547
"/        'whitePoint ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   548
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   549
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   550
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   551
    (tagType == 319) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   552
        "primaryChromatics"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   553
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   554
"/        'primaryChromatics ' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   555
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   556
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   557
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   558
    (tagType == 320) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   559
        "colorMap"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   560
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   561
"/        'colorMap (size=' print. valueArray size print. ')' printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   562
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   563
        "
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   564
         the tiff colormap contains 16bit values;
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   565
         our colormap expects 8bit values
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   566
        "
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   567
        n := valueArray size // 3.
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
   568
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   569
        rV := ByteArray uninitializedNew:n.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   570
        gV := ByteArray uninitializedNew:n.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   571
        bV := ByteArray uninitializedNew:n.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   572
        scaleFactor := 255.0 / 16rFFFF.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   573
        i2 := n+1.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   574
        i3 := 2*n+1.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   575
        1 to:n do:[:vi |
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   576
            val := ((valueArray at:vi) * scaleFactor) rounded.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   577
            rV at:vi put:val.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   578
            val := ((valueArray at:i2) * scaleFactor) rounded.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   579
            gV at:vi put:val.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   580
            val := ((valueArray at:i3) * scaleFactor) rounded.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   581
            bV at:vi put:val.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   582
            i2 := i2 + 1.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   583
            i3 := i3 + 1.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   584
        ].
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   585
        colorMap := Colormap redVector:rV greenVector:gV blueVector:bV.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   586
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   587
    ].
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   588
    (tagType == 332) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   589
        "ink set"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   590
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   591
"/        'ink set' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   592
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   593
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   594
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   595
    (tagType == 333) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   596
        "ink names"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   597
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   598
"/        'ink names' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   599
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   600
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   601
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   602
    (tagType == 336) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   603
        "dot range"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   604
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   605
"/        'dot range' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   606
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   607
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   608
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   609
    (tagType == 337) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   610
        "target printer"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   611
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   612
"/        'target printer' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   613
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   614
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   615
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   616
    (tagType == 339) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   617
        "sample format"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   618
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   619
"/        'sample format' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   620
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   621
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   622
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   623
    (tagType == 340) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   624
        "min sample value"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   625
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   626
"/        'min sample value' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   627
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   628
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   629
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   630
    (tagType == 341) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   631
        "max sample value"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   632
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   633
"/        'max sample value' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   634
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   635
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   636
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   637
    (tagType == 512) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   638
        "jpeg proc"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   639
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   640
"/        'jpeg proc' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   641
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   642
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   643
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   644
    (tagType == 513) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   645
        "jpeg proc"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   646
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   647
"/        'jpeg proc' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   648
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   649
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   650
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   651
    (tagType == 32995) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   652
        "matteing"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   653
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   654
"/        'matteing' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   655
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   656
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   657
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   658
    (tagType == 32996) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   659
        "datatype"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   660
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   661
"/        'datatype' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   662
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   663
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   664
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   665
    (tagType == 32997) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   666
        "imagedepth"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   667
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   668
"/        'imagedepth' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   669
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   670
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   671
    ].
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   672
    (tagType == 32998) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   673
        "tiledepth"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   674
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   675
"/        'tiledepth' print. value printNewline.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   676
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   677
        ^ self
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   678
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   679
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   680
"/
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   681
"/ 'TIFFReader: tag:' print. tagType print. ' typ:' print. numberType print.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   682
"/ ' len:' print. length print. ' offs:' print. offset print. 
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   683
"/ ' val:' print. value print. ' valArr:' print. valueArray printNewline.  
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   684
"/
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   685
    'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   686
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   687
    "Modified: 31.1.1997 / 10:23:44 / cg"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   688
!
3f9277473954 Initial revision
claus
parents:
diff changeset
   689
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   690
readCCITT3RLETiffImageData
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   691
     'TIFFReader [warning]: ccitt mod Huffman (rle) compression not implemented' errorPrintCR.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   692
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   693
    "Modified: 10.1.1997 / 18:09:02 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   694
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   695
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   696
readCCITT3RLEWTiffImageData
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   697
     'TIFFReader [warning]: ccitt mod Huffman (rlew) compression not implemented' errorPrintCR.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   698
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   699
    "Modified: 10.1.1997 / 18:09:11 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   700
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   701
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   702
readCCITTGroup3TiffImageData
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   703
    "not really tested - all I got is a single
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   704
     fax from NeXT step"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   705
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   706
    |bytesPerRow bitsPerRow compressedStrip nPlanes 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   707
     stripNr       "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   708
     offset        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   709
     row           "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   710
     bytesPerStrip "{ Class: SmallInteger }" |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   711
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   712
    nPlanes := samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   713
    (nPlanes == 2) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   714
        'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   715
        nPlanes := 1
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   716
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   717
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   718
    (nPlanes ~~ 1) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   719
        'TIFFReader [warning]: only monochrome/greyscale supported' errorPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   720
        ^ nil
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   721
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   722
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   723
    stripByteCounts isNil ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   724
        'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   725
        ^ nil
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   726
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   727
    (rowsPerStrip ~~ 1) isNil ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   728
        'TIFFReader [warning]: currently require rowsPerStrip to be 1' errorPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   729
        ^ nil
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   730
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   731
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   732
"/    'TIFFReader: decompressing CCITT-3 ...' infoPrintNL.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   733
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   734
    bitsPerRow := width * (bitsPerSample at:1).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   735
    bytesPerRow := bitsPerRow // 8.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   736
    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   737
        bytesPerRow := bytesPerRow + 1
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   738
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   739
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   740
    data := ByteArray new:(bytesPerRow * height).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   741
    compressedStrip := ByteArray uninitializedNew:bytesPerRow.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   742
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   743
    offset := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   744
    stripNr := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   745
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   746
    row := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   747
    bytesPerStrip := bytesPerRow * rowsPerStrip.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   748
    [row <= height] whileTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   749
        stripNr := stripNr + 1.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   750
        inStream position:((stripOffsets at:stripNr) + 1).
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   751
        inStream nextBytes:(stripByteCounts at:stripNr) into:compressedStrip.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   752
        self class decompressCCITT3From:compressedStrip
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   753
                                   into:data
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   754
                             startingAt:offset
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   755
                                  count:width.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   756
        offset := offset + bytesPerStrip.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   757
        row := row + rowsPerStrip
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   758
    ]
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   759
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   760
    "Modified: 10.1.1997 / 18:14:56 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   761
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   762
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   763
readCCITTGroup4TiffImageData
359
6fdd7d3119a8 *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   764
    'TIFFReader [warning]: ccitt group4 fax compression not implemented' errorPrintCR.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   765
359
6fdd7d3119a8 *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   766
    "Modified: 10.1.1997 / 19:10:59 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   767
!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   768
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   769
readChars:n
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   770
    "read n characters and return them in a string"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   771
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   772
    |oldPos offset string|
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   773
329
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   774
    n == 0 ifTrue:[^ ''].
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   775
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   776
    string := String new:(n - 1).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   777
    (n <= 4) ifTrue:[
329
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   778
        inStream nextBytes:(n - 1) into:string
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   779
    ] ifFalse:[
329
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   780
        offset := inStream nextLongMSB:(byteOrder ~~ #lsb).
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   781
        oldPos := inStream position.
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   782
        inStream position:(offset + 1).
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   783
        inStream nextBytes:(n - 1) into:string.
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   784
        inStream position:oldPos
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   785
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   786
    ^ string
329
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   787
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   788
    "Modified: 5.9.1996 / 12:21:08 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   789
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   790
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   791
readFracts:nFracts
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   792
    "read nFracts fractions (2 32bit words) and return them in an array"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   793
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   794
    |oldPos offset values numerator denominator msb
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   795
     n "{ Class: SmallInteger }" |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   796
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   797
    n := nFracts.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   798
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   799
    msb := byteOrder ~~ #lsb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   800
    values := Array basicNew:n.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   801
    offset := inStream nextLongMSB:msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   802
    oldPos := inStream position.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   803
    inStream position:(offset + 1).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   804
    1 to:n do:[:index |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   805
	numerator := inStream nextLongMSB:msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   806
	denominator := inStream nextLongMSB:msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   807
	values at:index put:(Fraction numerator:numerator denominator:denominator)
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   808
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   809
    inStream position:oldPos.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   810
    ^ values
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   811
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   812
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   813
readJPEGTiffImageData
359
6fdd7d3119a8 *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   814
    'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   815
359
6fdd7d3119a8 *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 357
diff changeset
   816
    "Modified: 10.1.1997 / 19:11:02 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   817
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   818
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   819
readLZWTiffImageData
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   820
    "read LZW compressed tiff data; this method only
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   821
     handles 3x8 rgb and 1x2 or 2x2 greyscale images.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   822
     For 2x2 greyscale images, the alpha plane is ignored.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   823
     (maybe other formats work also - its simply not
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   824
      tested)"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   825
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   826
    |bytesPerRow compressedStrip nPlanes 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   827
     bytesPerStrip "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   828
     nBytes        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   829
     prevSize      "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   830
     stripNr       "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   831
     offset        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   832
     row           "{ Class: SmallInteger }" |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   833
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   834
    nPlanes := samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   835
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   836
    (nPlanes == 3) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   837
        (((bitsPerSample at:1) ~~ 8) 
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   838
        or:[((bitsPerSample at:2) ~~ 8) 
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   839
        or:[((bitsPerSample at:3) ~~ 8)]]) ifTrue:[
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   840
            'TIFFReader [warning]: only 8/8/8 bit/sample are supported' errorPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   841
            ^ nil
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   842
        ].
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   843
        bytesPerRow := width * samplesPerPixel.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   844
    ] ifFalse:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   845
        (nPlanes == 2) ifTrue:[
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   846
            (planarConfiguration ~~ 2) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   847
                'TIFFReader [warning]: only separate planes are supported' errorPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   848
                ^ nil
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   849
            ].
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   850
            'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   851
            nPlanes := 1
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   852
        ].
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   853
        (nPlanes == 1) ifFalse:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   854
            'TIFFReader [warning]: only 3-sample rgb / monochrome supported' errorPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   855
            ^ nil
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   856
        ].
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   857
        bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   858
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   859
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   860
    stripByteCounts isNil ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   861
        'TIFFReader [warning]: currently require stripByteCounts' errorPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   862
        ^ nil
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
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   865
"/    'TIFFReader: decompressing LZW ...' infoPrintNL.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   866
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   867
    data := ByteArray uninitializedNew:(bytesPerRow * height).
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
    offset := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   870
    stripNr := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   871
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   872
    row := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   873
    bytesPerStrip := bytesPerRow * rowsPerStrip.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   874
    prevSize := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   875
    [row <= height] whileTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   876
        stripNr := stripNr + 1.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   877
        inStream position:((stripOffsets at:stripNr) + 1).
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   878
        nBytes := stripByteCounts at:stripNr.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   879
        (nBytes > prevSize) ifTrue:[
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   880
            compressedStrip := ByteArray uninitializedNew:nBytes.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   881
            prevSize := nBytes
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   882
        ].
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   883
        inStream nextBytes:nBytes
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   884
                      into:compressedStrip.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   885
        self class decompressLZWFrom:compressedStrip
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   886
                               count:nBytes
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   887
                                into:data
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   888
                          startingAt:offset.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   889
        offset := offset + bytesPerStrip.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   890
        row := row + rowsPerStrip
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   891
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   892
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   893
    (predictor == 2) ifTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   894
        self class decodeDelta:3 in:data width:width height:height
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   895
    ]
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   896
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   897
    "Modified: 10.1.1997 / 18:13:21 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   898
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   899
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   900
readLongs:nLongs
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   901
    "read nLongs long numbers (32bit) and return them in an array"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   902
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   903
    |oldPos offset values msb 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   904
     n "{ Class: SmallInteger }" |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   905
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   906
    n := nLongs.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   907
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   908
    msb := byteOrder ~~ #lsb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   909
    values := Array basicNew:n.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   910
    (n == 1) ifTrue:[
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   911
	values at:1 put:(inStream nextLongMSB:msb).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   912
    ] ifFalse:[
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   913
	offset := inStream nextLongMSB:msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   914
	oldPos := inStream position.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   915
	inStream position:(offset + 1).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   916
	1 to:n do:[:index |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   917
	    values at:index put:(inStream nextLongMSB:msb)
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   918
	].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   919
	inStream position:oldPos
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   920
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   921
    ^ values
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   922
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   923
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   924
readNeXTJPEGTiffImageData
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   925
    'TIFFReader [warning]: jpeg compression not implemented' errorPrintCR
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   926
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   927
    "Modified: 10.1.1997 / 18:11:04 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   928
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   929
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   930
readNeXTRLE2TiffImageData
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   931
    'TIFFReader [warning]: next 2bit rle compression not implemented' errorPrintCR.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   932
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   933
    "Modified: 10.1.1997 / 18:11:01 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   934
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   935
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   936
readPackbitsTiffImageData
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   937
    "had no samples yet - however, packbits decompression
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   938
     is rather trivial to add ..."
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   939
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   940
    'TIFFReader [warning]: packbits compression not implemented' errorPrintCR
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   941
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   942
    "Modified: 10.1.1997 / 18:10:57 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   943
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   944
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   945
readShorts:nShorts
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   946
    "read nShorts short numbers (16bit) and return them in an array"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   947
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   948
    |oldPos offset values msb val2
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   949
     n "{ Class: SmallInteger }" |
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   950
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   951
    n := nShorts.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   952
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   953
    msb := (byteOrder ~~ #lsb).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   954
    values := Array basicNew:n.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   955
    (n <= 2) ifTrue:[
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   956
	values at:1 put:(inStream nextUnsignedShortMSB:msb).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   957
	val2 := inStream nextUnsignedShortMSB:msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   958
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   959
	(n == 2) ifTrue:[
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   960
	    values at:2 put:val2
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   961
	]
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   962
    ] ifFalse:[
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   963
	offset := inStream nextLongMSB:msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   964
	oldPos := inStream position.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   965
	inStream position:(offset + 1).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   966
	1 to:n do:[:index |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   967
	    values at:index put:(inStream nextUnsignedShortMSB:msb)
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   968
	].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   969
	inStream position:oldPos
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   970
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   971
    ^ values
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   972
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   973
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   974
readUncompressedTiffImageData
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   975
    |bytesPerRow bitsPerRow nPlanes 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   976
     stripNr       "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   977
     offset        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   978
     row           "{ Class: SmallInteger }" 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   979
     nBytes        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   980
     bitsPerPixel overAllBytes|
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   981
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   982
    nPlanes := samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   983
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   984
    "only support 1-sample/pixel,
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   985
     with alpha - if separate planes,
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   986
     or rgb - if non separate planes and no alpha"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   987
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   988
    (nPlanes == 2) ifTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   989
        (planarConfiguration ~~ 2) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   990
            'TIFFReader [warning]: with alpha, only separate planes supported' errorPrintCR.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   991
            ^ nil
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   992
        ].
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   993
        '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
   994
        nPlanes := 1.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   995
        bitsPerPixel := bitsPerSample at:1.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   996
        bitsPerSample := Array with:bitsPerPixel.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   997
        samplesPerPixel := 1.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   998
    ] ifFalse:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   999
        (nPlanes == 3) ifTrue:[
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1000
            (planarConfiguration ~~ 1) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1001
                'TIFFReader [warning]: only non separate planes supported' errorPrintCR.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1002
                ^ nil
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1003
            ].
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1004
            bitsPerSample ~= #(8 8 8) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1005
                'TIFFReader [warning]: only 8/8/8 rgb images supported' errorPrintCR.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1006
                ^ nil
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1007
            ].
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1008
            bitsPerPixel := 24
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1009
        ] ifFalse:[
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1010
            (nPlanes ~~ 1) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1011
                'TIFFReader [warning]: format not supported' errorPrintCR.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1012
                ^ nil
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1013
            ].
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1014
            bitsPerPixel := bitsPerSample at:1.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1015
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1016
    ].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1017
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1018
    bitsPerRow := width * bitsPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1019
    bytesPerRow := bitsPerRow // 8.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1020
    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1021
        bytesPerRow := bytesPerRow + 1
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1022
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1023
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1024
    overAllBytes := bytesPerRow * height.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1025
    data := ByteArray uninitializedNew:overAllBytes.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1026
336
9789b02d95bf oops - the very last pixel was not read (in readUncompressed ...)
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1027
    offset := 0.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1028
    stripNr := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1029
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1030
    row := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1031
    [row <= height] whileTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1032
        stripNr := stripNr + 1.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1033
        nBytes := stripByteCounts at:stripNr.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1034
        inStream position:((stripOffsets at:stripNr) + 1).
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1035
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1036
        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
  1037
            nBytes := overAllBytes - offset.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1038
        ].
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1039
336
9789b02d95bf oops - the very last pixel was not read (in readUncompressed ...)
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1040
        inStream nextBytes:nBytes into:data startingAt:offset+1.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1041
        offset := offset + nBytes.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1042
        row := row + rowsPerStrip
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1043
    ]
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1044
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1045
    "Modified: 10.1.1997 / 18:10:46 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1046
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1047
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1048
writeBitsPerSample
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  1049
"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1050
'bitsPerSample: ' print. bitsPerSample printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1051
'store bitspersample at: ' print. outStream position printNewline.
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  1052
"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1053
    bitsPerSamplePos := outStream position.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1054
    bitsPerSample do:[:n |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1055
	self writeShort:n
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1056
    ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1057
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1058
3f9277473954 Initial revision
claus
parents:
diff changeset
  1059
writeColorMap
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1060
    |n|
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1061
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1062
    colorMapPos := outStream position.
35
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1063
    #(red green blue) do:[:component |
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1064
	n := 0.
35
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1065
	colorMap do:[:clr |
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1066
	    |entry|
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1067
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1068
	    clr isNil ifTrue:[
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1069
		entry := 0
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1070
	    ] ifFalse:[
35
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1071
		entry := clr perform:component.
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1072
		"
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1073
		 tiff map is 16 bit - scale from percent to 0..16rFFFF
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1074
		"
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1075
		entry := (entry * 16rFFFF / 100) rounded.
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1076
	    ].
35
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1077
	    self writeShort:entry.
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1078
	    n := n + 1
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1079
	].
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1080
	"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1081
	 fill to 256 entries
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1082
	"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1083
	[n < 256] whileTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1084
	    self writeShort:0.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1085
	    n := n + 1.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1086
	]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1087
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
  1088
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1089
3f9277473954 Initial revision
claus
parents:
diff changeset
  1090
writeStripByteCounts
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  1091
"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1092
'stripByteCounts: ' print. stripByteCounts printNewline.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1093
'store stripbytecounts at: ' print. outStream position printNewline.
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  1094
"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1095
    stripByteCountsPos := outStream position.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1096
    stripByteCounts do:[:c |
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1097
	self writeShort:c
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1098
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
  1099
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1100
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1101
writeStripOffsets
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  1102
"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1103
'stripOffsets: ' print. stripOffsets printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1104
'store stripoffsets at: ' print. outStream position printNewline.
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  1105
"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1106
    stripOffsetsPos := outStream position.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1107
    stripOffsets do:[:o |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1108
	self writeLong:o
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1109
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
  1110
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1111
3f9277473954 Initial revision
claus
parents:
diff changeset
  1112
writeTag:tagType
3f9277473954 Initial revision
claus
parents:
diff changeset
  1113
    self writeTiffTag:tagType.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1114
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1115
3f9277473954 Initial revision
claus
parents:
diff changeset
  1116
writeTiffTag:tagType
3f9277473954 Initial revision
claus
parents:
diff changeset
  1117
    |value valueArray numberType count address|
3f9277473954 Initial revision
claus
parents:
diff changeset
  1118
3f9277473954 Initial revision
claus
parents:
diff changeset
  1119
    count := 1.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1120
    address := nil.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1121
    (tagType == 253) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1122
	"tiff class"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1123
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1124
    (tagType == 254) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1125
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1126
    (tagType == 255) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1127
	"SubfileType"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1128
	value := subFileType.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1129
	numberType := #long.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1130
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1131
    (tagType == 256) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1132
	"ImageWidth"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1133
	value := width.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1134
	numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1135
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1136
    (tagType == 257) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1137
	"ImageHeight"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1138
	value := height.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1139
	numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1140
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1141
    (tagType == 258) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1142
	"bitspersample"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1143
	address := bitsPerSamplePos - 1.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1144
	numberType := #short.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1145
	count := bitsPerSample size.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1146
	valueArray := bitsPerSample
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1147
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1148
    (tagType == 259) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1149
	"compression"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1150
	value := compression.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1151
	numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1152
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1153
    (tagType == 262) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1154
	"photometric"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1155
	(photometric == #whiteIs0) ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1156
	  value := 0
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1157
	] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1158
	  (photometric == #blackIs0) ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1159
	    value := 1
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1160
	  ] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1161
	    (photometric == #rgb) ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1162
	      value := 2
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1163
	    ] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1164
	      (photometric == #palette) ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1165
		value := 3
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1166
	      ] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1167
		(photometric == #transparency) ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1168
		  value := 4
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1169
		] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1170
		  self error:'bad photometric'
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1171
		]
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1172
	      ]
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1173
	    ]
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1174
	  ]
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1175
	].
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1176
	numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1177
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1178
    (tagType == 263) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1179
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1180
    (tagType == 264) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1181
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1182
    (tagType == 265) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1183
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1184
    (tagType == 266) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1185
	"fillOrder"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1186
	(fillOrder == #msb) ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1187
	    value := 1
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1188
	] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1189
	  (fillOrder == #lsb) ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1190
	    value := 2
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1191
	  ] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1192
	    self error:'bad fillOrder'
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1193
	  ]
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1194
	].
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1195
	numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1196
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1197
    (tagType == 269) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1198
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1199
    (tagType == 270) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1200
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1201
    (tagType == 271) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1202
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1203
    (tagType == 272) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1204
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1205
    (tagType == 273) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1206
	"stripoffsets"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1207
	address := stripOffsetsPos - 1.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1208
	numberType := #long.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1209
	count := stripOffsets size.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1210
	valueArray := stripOffsets
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1211
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1212
    (tagType == 274) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1213
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1214
    (tagType == 277) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1215
	"samplesPerPixel"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1216
	value := samplesPerPixel.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1217
	numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1218
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1219
    (tagType == 278) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1220
	"rowsperstrip"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1221
	value := rowsPerStrip.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1222
	numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1223
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1224
    (tagType == 279) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1225
	"stripbytecount"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1226
	address := stripByteCountsPos - 1.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1227
	numberType := #short.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1228
	count := stripByteCounts size.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1229
	valueArray := stripByteCounts
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1230
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1231
    (tagType == 280) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1232
	"min sample value"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1233
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1234
    (tagType == 281) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1235
	"max sample value"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1236
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1237
    (tagType == 282) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1238
	"x resolution"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1239
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1240
    (tagType == 283) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1241
	"y resolution"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1242
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1243
    (tagType == 284) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1244
	"planarconfig"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1245
	value := planarConfiguration.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1246
	numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1247
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1248
    (tagType == 285) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1249
	"pageName"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1250
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1251
    (tagType == 286) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1252
	"xPosition"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1253
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1254
    (tagType == 287) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1255
	"yPosition"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1256
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1257
    (tagType == 288) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1258
	"freeOffsets"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1259
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1260
    (tagType == 289) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1261
	"freeByteCounts"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1262
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1263
    (tagType == 290) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1264
	"grayResponceUnit"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1265
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1266
    (tagType == 291) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1267
	"grayResponceCurve"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1268
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1269
    (tagType == 292) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1270
	"group3options"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1271
	value := group3options.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1272
	numberType := #long.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1273
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1274
    (tagType == 293) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1275
	"group4options"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1276
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1277
    (tagType == 296) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1278
	"resolutionunit"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1279
	^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1280
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1281
    (tagType == 297) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1282
	"pageNumber"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1283
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1284
    (tagType == 300) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1285
	"colorResponceUnit"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1286
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1287
    (tagType == 301) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1288
	"colorResponceCurve"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1289
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1290
    (tagType == 306) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1291
	"dateTime"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1292
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1293
    (tagType == 315) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1294
	"artist"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1295
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1296
    (tagType == 317) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1297
	"predictor"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1298
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1299
    (tagType == 320) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1300
	"colormap"
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1301
	address := colorMapPos - 1.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1302
	numberType := #short.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1303
	count := 256 "(colorMap at:1) size" * 3.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1304
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1305
3f9277473954 Initial revision
claus
parents:
diff changeset
  1306
    (value isNil and:[address isNil]) ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1307
	self error:'unhandled tag'.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1308
	^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1309
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1310
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  1311
"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1312
'tag:' print. tagType print. ' typ:' print. numberType print.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1313
' len:' print. count print.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1314
' val:' print. value printNewline.  
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  1315
"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1316
3f9277473954 Initial revision
claus
parents:
diff changeset
  1317
    self writeShort:tagType.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1318
    numberType == #short ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1319
	self writeShort:3.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1320
	self writeLong:count.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1321
    ] ifFalse:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1322
	numberType == #long ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1323
	    self writeShort:4.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1324
	    self writeLong:count.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1325
	] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1326
	    numberType == #byte ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1327
		self writeShort:1.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1328
		self writeLong:count.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1329
	    ] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1330
		self error:'bad numbertype'
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1331
	    ]
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1332
	]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1333
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1334
    address notNil ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1335
	(numberType == #long and:[count == 1]) ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1336
	    self writeLong:(valueArray at:1).
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1337
	    ^ self
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1338
	].
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1339
	(numberType == #short and:[count <= 2]) ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1340
	    self writeShort:(valueArray at:1).
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1341
	    count == 2 ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1342
		self writeShort:(valueArray at:2).
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1343
	    ] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1344
		self writeShort:0
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1345
	    ].
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1346
	    ^ self
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1347
	].
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1348
	(numberType == #byte and:[count <= 4]) ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1349
	    outStream nextPut:(valueArray at:1).
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1350
	    count > 1 ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1351
		outStream nextPut:(valueArray at:2).
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1352
		count > 2 ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1353
		    outStream nextPut:(valueArray at:3).
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1354
		    count > 3 ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1355
			outStream nextPut:(valueArray at:4).
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1356
		    ] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1357
			outStream nextPut:0
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1358
		    ].
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1359
		] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1360
		    outStream nextPut:0
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1361
		].
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1362
	    ] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1363
		outStream nextPut:0
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1364
	    ].
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1365
	    ^ self
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1366
	].
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1367
	self writeLong:address.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1368
	^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1369
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1370
    numberType == #short ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1371
	self writeShort:value.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1372
	self writeShort:0
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1373
    ] ifFalse:[
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1374
	numberType == #long ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1375
	    self writeLong:value
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1376
	] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1377
	    numberType == #byte ifTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1378
		outStream nextPut:value.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1379
		outStream nextPut:0.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1380
		outStream nextPut:0.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1381
		outStream nextPut:0.
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1382
	    ] ifFalse:[
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1383
		self error:'bad numbertype'
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1384
	    ]
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1385
	]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1386
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1387
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1388
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1389
writeUncompressedBits
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1390
    "write bits as one or multiple strips"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1391
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1392
    |offs bytesPerRow nBytes
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1393
     h "{ Class: SmallInteger }"|
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1394
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1395
    nBytes := data size.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1396
    nBytes < 16rFFFF ifTrue:[
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1397
	stripOffsets := Array with:(outStream position - 1).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1398
	stripByteCounts := Array with:nBytes.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1399
	outStream nextPutBytes:nBytes from:data.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1400
	rowsPerStrip := height
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1401
    ] ifFalse:[
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1402
	stripOffsets := Array basicNew:height.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1403
	bytesPerRow := nBytes // height.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1404
	stripByteCounts := (Array basicNew:height) atAllPut:bytesPerRow.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1405
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1406
	offs := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1407
	h := height.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1408
	1 to:h do:[:row |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1409
	    stripOffsets at:row put:(outStream position - 1).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1410
	    outStream nextPutBytes:bytesPerRow from:data startingAt:offs.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1411
	    offs := offs + bytesPerRow
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1412
	].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1413
	rowsPerStrip := 1
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1414
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1415
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1416
    'stripOffsets: ' print. stripOffsets printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1417
    'stripByteCounts: ' print. stripByteCounts printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1418
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1419
! !
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1420
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1421
!TIFFReader methodsFor:'reading from file'!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1422
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1423
fromStream:aStream
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1424
    "read a stream containing a TIFF image.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1425
     Leave image description in instance variables."
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1426
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1427
    |char1 char2 version 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1428
     numberOfTags "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1429
     tagType      "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1430
     numberType   "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1431
     length       "{ Class: SmallInteger }"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1432
     result offset ok msb
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1433
     bitsPerPixel bytesPerRow offset1 offset2 tmp|
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1434
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1435
    inStream := aStream.
331
304f9c439efa allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
  1436
    aStream binary.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1437
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1438
    char1 := aStream next.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1439
    char2 := aStream next.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1440
    (char1 ~~ char2) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1441
        'TIFFReader [warning]: not a tiff file' errorPrintCR.
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1442
        ^ nil
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1443
    ].
331
304f9c439efa allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
  1444
    (char1 == $I asciiValue) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1445
        byteOrder := #lsb.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1446
        msb := false.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1447
    ] ifFalse:[
331
304f9c439efa allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
  1448
        (char1 == $M asciiValue) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1449
            byteOrder := #msb.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1450
            msb := true.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1451
        ] ifFalse:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1452
            'TIFFReader [warning]: not a tiff file' errorPrintCR.
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1453
            ^ nil
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1454
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1455
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1456
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1457
    version := self readShort.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1458
    (version ~~ 42) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1459
        'TIFFReader [warning]: version of tiff-file not supported' errorPrintCR.
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1460
        ^ nil
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1461
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1462
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1463
    "setup default values"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1464
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1465
    compression := 1. "none"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1466
    fillOrder := #msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1467
    planarConfiguration := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1468
    photometric := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1469
    bitsPerSample := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1470
    samplesPerPixel := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1471
    width := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1472
    height := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1473
    stripOffsets := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1474
    rowsPerStrip := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1475
    "resolutionUnit := 2."
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1476
    predictor := 1.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1477
    orientation := nil.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1478
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1479
    offset := aStream nextLongMSB:msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1480
    aStream position:offset + 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1481
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1482
    numberOfTags := self readShort.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1483
    1 to:numberOfTags do:[:index |
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1484
        tagType := self readShort.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1485
        numberType := self readShort.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1486
        length := aStream nextLongMSB:msb.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1487
        self decodeTiffTag:tagType numberType:numberType length:length
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1488
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1489
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1490
    offset := aStream nextLongMSB:msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1491
    (offset ~~ 0) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1492
        'TIFFReader [info]: more tags ignored' infoPrintCR
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1493
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1494
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1495
    "check for required tags"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1496
    ok := true.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1497
    width isNil ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1498
        'TIFFReader [warning]: missing width tag' errorPrintCR.
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1499
        ok := false
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1500
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1501
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1502
    height isNil ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1503
        'TIFFReader [warning]: missing length tag' errorPrintCR.
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1504
        ok := false
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1505
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1506
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1507
    photometric isNil ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1508
        'TIFFReader [warning]: missing photometric tag' errorPrintCR.
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1509
        ok := false
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1510
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1511
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1512
    stripOffsets isNil ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1513
        'TIFFReader [warning]: missing stripOffsets tag' errorPrintCR.
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1514
        ok := false
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1515
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1516
3f9277473954 Initial revision
claus
parents:
diff changeset
  1517
    stripByteCounts isNil ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1518
        stripOffsets size == 1 ifTrue:[
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1519
            stripByteCounts := Array with:(self bitsPerPixel // 8) * width * height
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1520
        ]
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1521
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1522
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1523
    stripByteCounts isNil ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1524
        'TIFFReader [warning]: missing stripByteCounts tag' errorPrintCR.
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1525
        ok := false
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1526
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1527
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1528
    ok ifFalse:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1529
        ^ nil
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1530
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1531
334
1da7672635be dimensionCallBack
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
  1532
    dimensionCallBack notNil ifTrue:[
1da7672635be dimensionCallBack
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
  1533
        dimensionCallBack value:self
1da7672635be dimensionCallBack
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
  1534
    ].
1da7672635be dimensionCallBack
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
  1535
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1536
    "given all the information, read the bits"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1537
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1538
    rowsPerStrip isNil ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1539
        rowsPerStrip := height
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1540
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1541
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1542
    ok := false.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1543
    (compression == 1) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1544
        result := self readUncompressedTiffImageData.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1545
        ok := true
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1546
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1547
    (compression == 2) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1548
        result := self readCCITT3RLETiffImageData.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1549
        ok := true
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1550
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1551
    (compression == 3) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1552
        result := self readCCITTGroup3TiffImageData.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1553
        ok := true
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1554
    ]. 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1555
    (compression == 4) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1556
        result := self readCCITTGroup4TiffImageData.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1557
        ok := true
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1558
    ]. 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1559
    (compression == 5) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1560
        result := self readLZWTiffImageData.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1561
        ok := true
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1562
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1563
    (compression == 6) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1564
        result := self readJPEGTiffImageData.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1565
        ok := true
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1566
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1567
    (compression == 32766) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1568
        result := self readNeXTRLE2TiffImageData.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1569
        ok := true
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1570
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1571
    (compression == 32771) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1572
        result := self readCCITTRLEWTiffImageData.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1573
        ok := true
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1574
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1575
    (compression == 32773) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1576
        result := self readPackbitsTiffImageData.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1577
        ok := true
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1578
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1579
    (compression == 32865) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1580
        result := self readNeXTJPEGTiffImageData.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1581
        ok := true
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1582
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1583
    ok ifFalse:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1584
        'TIFFReader [warning]: compression type ' errorPrint. compression errorPrint.
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1585
        ' not known' errorPrintCR
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1586
    ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1587
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1588
    orientation == 4 ifTrue:[
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1589
        "/ bottom-to-top; reverse rows to top-to bottom
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1590
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1591
        bytesPerRow := self bytesPerRow.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1592
        tmp := ByteArray new:bytesPerRow.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1593
        offset1 := 1.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1594
        offset2 := (height-1)*bytesPerRow + 1.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1595
        0 to:(height-1//2) do:[:row |
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1596
            tmp replaceFrom:1 to:bytesPerRow
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1597
                with:data startingAt:offset1.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1598
            data replaceFrom:offset1 to:offset1+bytesPerRow-1
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1599
                 with:data startingAt:offset2.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1600
            data replaceFrom:offset2 to:offset2+bytesPerRow-1
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1601
                 with:tmp startingAt:1.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1602
            offset1 := offset1 + bytesPerRow.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1603
            offset2 := offset2 - bytesPerRow.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1604
        ].
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1605
    ].
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1606
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1607
    ^ result
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  1608
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1609
    "Modified: 31.1.1997 / 10:39:55 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1610
! !
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1611
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1612
!TIFFReader methodsFor:'writing to file'!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1613
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1614
save:image onFile:aFileName
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1615
    "save image as (uncompressed) TIFF file on aFileName"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1616
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1617
    |pos1 pos|
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1618
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1619
    outStream := FileStream newFileNamed:aFileName.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1620
    outStream isNil ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1621
        'TIFFReader [warning]: create error' errorPrintCR. 
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1622
        ^ nil
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1623
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1624
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1625
    "save as msb"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1626
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1627
    byteOrder := #msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1628
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1629
    byteOrder := #lsb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1630
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1631
    fillOrder := #msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1632
    width := image width.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1633
    height := image height.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1634
    photometric := image photometric.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1635
    samplesPerPixel := image samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1636
    bitsPerSample := image bitsPerSample.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1637
    colorMap := image colorMap.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1638
    planarConfiguration := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1639
    compression := 1.   "none"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1640
    data := image bits.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1641
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1642
    currentOffset := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1643
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1644
    (byteOrder == #msb) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1645
        outStream nextPut:$M. outStream nextPut:$M.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1646
    ] ifFalse:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1647
        outStream nextPut:$I. outStream nextPut:$I.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1648
    ].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1649
    currentOffset := currentOffset + 2.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1650
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1651
    outStream binary.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1652
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1653
    self writeShort:42.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1654
    currentOffset := currentOffset + 2.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1655
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1656
    pos1 := outStream position.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1657
    self writeLong:0.           "start of tags - filled in later"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1658
    currentOffset := currentOffset + 4.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1659
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1660
    "output strips"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1661
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1662
    self writeUncompressedBits. "this outputs bits as strips, sets stripOffsets and stripByteCounts"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1663
    self writeStripOffsets.     "this outputs strip offsets, sets stripOffsetsPos"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1664
    self writeStripByteCounts.  "this outputs strip bytecounts, sets stripByteCountPos"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1665
    self writeBitsPerSample.    "this outputs bitsPerSample, sets bitsPerSamplePos"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1666
    photometric == #palette ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1667
        self writeColorMap      "this outputs colorMap, sets colorMapPos"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1668
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1669
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1670
    pos := outStream position.                  "backpatch tag offset"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1671
    outStream position:pos1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1672
    self writeLong:(pos - 1).                   "fill in tag offset"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1673
    outStream position:pos.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1674
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1675
('patch tag offset at: ', (pos1 printStringRadix:16) , ' to ',
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1676
                         (pos printStringRadix:16)) printNewline.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1677
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1678
    "output tag data"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1679
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1680
    photometric == #palette ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1681
        self writeShort:11.  "11 tags"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1682
    ] ifFalse:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1683
        self writeShort:10.  "10 tags"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1684
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1685
    self writeTag:256.               "image width"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1686
    self writeTag:257.               "image height"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1687
    self writeTag:258.               "bits per sample"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1688
    self writeTag:259.               "compression"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1689
    self writeTag:262.               "photometric"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1690
    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
  1691
    self writeTag:277.               "samplesPerPixel"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1692
    self writeTag:278.               "rowsPerStrip"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1693
    self writeTag:279.               "strip byte counts"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1694
    self writeTag:284.               "planarconfig"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1695
    photometric == #palette ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1696
        self writeTag:320            "colorMap"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1697
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1698
    self writeLong:0.                "end of tags mark"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1699
    outStream close
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1700
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1701
    "Modified: 10.1.1997 / 18:13:38 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1702
! !
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
  1703
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1704
!TIFFReader class methodsFor:'documentation'!
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
  1705
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1706
version
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1707
    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.46 1997-01-31 09:40:39 cg Exp $'
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1708
! !
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1709
TIFFReader initialize!