TIFFReader.st
author Claus Gittinger <cg@exept.de>
Thu, 24 Aug 2017 22:46:23 +0200
changeset 3974 b4f7c8442dd8
parent 3957 c7db19dbd128
child 3975 1315fd14851b
permissions -rw-r--r--
#FEATURE by cg class: TIFFReader added: #readLong8s:signed: changed: #decodeTiffTag:numberType:length: #fromStream: #readLZWTiffImageData
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
3f9277473954 Initial revision
claus
parents:
diff changeset
     1
"
6
4ac87e6bf82f *** empty log message ***
claus
parents: 5
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
     3
	      All Rights Reserved
0
3f9277473954 Initial revision
claus
parents:
diff changeset
     4
3f9277473954 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
3f9277473954 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
3f9277473954 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
3f9277473954 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
3f9277473954 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
3f9277473954 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
3f9277473954 Initial revision
claus
parents:
diff changeset
    11
"
1571
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
    12
"{ Package: 'stx:libview2' }"
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
    13
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
    14
"{ NameSpace: Smalltalk }"
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
    15
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    16
ImageReader subclass:#TIFFReader
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
    17
	instanceVariableNames:'planarConfiguration subFileType stripOffsets rowsPerStrip
159
327da5085900 fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    18
		fillOrder compression group3options predictor stripByteCounts
327da5085900 fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    19
		currentOffset stripOffsetsPos stripByteCountsPos bitsPerSamplePos
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
    20
		colorMapPos orientation'
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
    21
	classVariableNames:''
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
    22
	poolDictionaries:''
1745
4fa0fad2a463 code cleanup (colorMap handling)
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
    23
	category:'Graphics-Images-Readers'
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    24
!
3f9277473954 Initial revision
claus
parents:
diff changeset
    25
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    26
Dictionary subclass:#TIFFMetaData
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    27
	instanceVariableNames:''
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    28
	classVariableNames:''
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    29
	poolDictionaries:''
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    30
	privateIn:TIFFReader
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    31
!
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
    32
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
    33
!TIFFReader class methodsFor:'documentation'!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    34
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    35
copyright
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    36
"
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    37
 COPYRIGHT (c) 1991 by Claus Gittinger
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    38
	      All Rights Reserved
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    39
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    40
 This software is furnished under a license and may be used
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    41
 only in accordance with the terms of that license and with the
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    42
 inclusion of the above copyright notice.   This software may not
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    43
 be provided or otherwise made available to, or used by, any
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    44
 other person.  No title to or ownership of the software is
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    45
 hereby transferred.
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    46
"
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    47
!
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    48
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    49
documentation
3f9277473954 Initial revision
claus
parents:
diff changeset
    50
"
21
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    51
    This class knows how to read TIFF files and how to
66b31c91177f *** empty log message ***
claus
parents: 19
diff changeset
    52
    write uncompressed TIFF files.
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
    53
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    54
    Implemented & Missing Features:
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
    55
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    56
      - Only single image files are supported.
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    57
      - Not all formats are implemented, and of those that are, not all are tested.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    58
        It should read with most rgb, palette, mono and greyscale images, 
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
    59
        although the alpha channel is currently not supported and ignored.
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    60
        It supports reading of uncompressed, LZW, packbits and CCITT-G3 compressed images
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    61
        JPEG and many other formats are currently not implemented.
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
    62
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    63
      - Only writing of uncompressed images is currently implemented.
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    64
        It should write (at least) mono, 8-bit palette and 24 bit rgb formats.
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    65
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    66
    More formats will come... (will they ever be needed ?)
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    67
3777
1700fa5bf5c2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3693
diff changeset
    68
    TODO (?): since I don't want to spend all of my life adding more formats here and
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
    69
    reinventing the wheel, this code should be changed to use the tiff library.
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
    70
    That would give us most formats and also writing capabilities for free.
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    71
    Late note: 
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    72
        I hate C and interfacing to C libraries: it almost always leads to trouble
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    73
        w.r.t. memory leaks, non-reentrancy, non-interruptability etc.
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    74
        (we recently fixed a malloc-non-reentrant bug for some architecture...)
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
    75
        So its robably better to do it all in a real programming language ;-)
195
7975a2c4a890 commentary
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
    76
220
4106d9ce7e02 documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    77
    [author:]
4106d9ce7e02 documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    78
        Claus Gittinger
4106d9ce7e02 documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    79
195
7975a2c4a890 commentary
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
    80
    [See also:]
234
b6352d13e792 xrefs in documentation
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    81
        Image Form Icon
197
50812e81d86f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 195
diff changeset
    82
        BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader 
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
    83
        ST80FormReader SunRasterReader TargaReader WindowsIconReader 
209
840ddcf12904 commentary
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
    84
        XBMReader XPMReader XWDReader 
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    85
"
3f9277473954 Initial revision
claus
parents:
diff changeset
    86
! !
3f9277473954 Initial revision
claus
parents:
diff changeset
    87
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
    88
!TIFFReader class methodsFor:'initialization'!
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    89
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
    90
initialize
198
6d76856aaa80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
    91
    "install myself in the Image classes fileFormat table
398
aef700d15416 new suffix-table
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
    92
     for the `.tiff' and `.tif' extensions."
198
6d76856aaa80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
    93
647
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    94
    MIMETypes defineImageType:'image/tiff' suffix:'tif'  reader:self.
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    95
    MIMETypes defineImageType:nil          suffix:'tiff' reader:self.
198
6d76856aaa80 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
    96
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
    97
    "
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
    98
     self initialize
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
    99
    "
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   100
398
aef700d15416 new suffix-table
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   101
    "Modified: 1.2.1997 / 15:00:01 / cg"
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
   102
! !
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
   103
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   104
!TIFFReader class methodsFor:'testing'!
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   105
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   106
canRepresent:anImage
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   107
    "return true, if anImage can be represented in my file format.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   108
     Any image is supported."
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   109
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   110
    ^ true
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   111
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   112
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   113
isValidImageFile:aFileName
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   114
    "return true, if aFileName contains a GIF image"
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   115
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   116
    |inStream char1 char2 version|
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   117
11
1d0df18a7049 *** empty log message ***
claus
parents: 6
diff changeset
   118
    inStream := self streamReadingFile:aFileName.
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   119
    inStream isNil ifTrue:[^ false].
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   120
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   121
    char1 := inStream next.
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   122
    char2 := inStream next.
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   123
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   124
    ((char1 ~~ char2) or:[(char1 ~~ $I) and:[char1 ~~ $M]]) ifTrue:[
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   125
        inStream close.
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   126
        ^ false
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   127
    ].
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   128
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   129
    inStream binary.
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
   130
    version := inStream nextInt16MSB:(char1 == $M).
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   131
    inStream close.
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   132
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   133
    (version ~~ 42) ifTrue:[^ false].
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
   134
    ^ true
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   135
! !
3f9277473954 Initial revision
claus
parents:
diff changeset
   136
3f9277473954 Initial revision
claus
parents:
diff changeset
   137
!TIFFReader methodsFor:'private'!
3f9277473954 Initial revision
claus
parents:
diff changeset
   138
3f9277473954 Initial revision
claus
parents:
diff changeset
   139
decodeTiffTag:tagType numberType:numberType length:length
3f9277473954 Initial revision
claus
parents:
diff changeset
   140
    |offset value valueArray 
40
c2e206361c7b *** empty log message ***
claus
parents: 38
diff changeset
   141
     val scaleFactor rV gV bV
c2e206361c7b *** empty log message ***
claus
parents: 38
diff changeset
   142
     n  "{ Class: SmallInteger }"
35
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
   143
     i2 "{ Class: SmallInteger }"
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
   144
     i3 "{ Class: SmallInteger }" |
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   145
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   146
"/ 'tiffTag: ' print. tagType printCR.
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   147
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   148
    (numberType == 3 "TIFF_SHORT") ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   149
        "16 bit ushort"
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   150
        valueArray := self readShorts:length signed:false.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   151
        value := valueArray at:1
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   152
    ] ifFalse:[(numberType == 4 "TIFF_LONG") ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   153
        "32 bit uinteger"
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   154
        valueArray := self readLongs:length signed:false.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   155
        value := valueArray at:1
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   156
    ] ifFalse:[(numberType == 2 "TIFF_ASCII") ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   157
        "ascii characters"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   158
        value := self readChars:length
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   159
    ] ifFalse:[(numberType == 5 "TIFF_RATIONAL") ifTrue:[
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   160
        "64 (32+32) bit ufraction"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   161
        valueArray := self readFracts:length signed:false.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   162
        value := valueArray at:1
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   163
    ] ifFalse:[(numberType == 1 "TIFF_BYTE") ifTrue:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   164
        "8bit uinteger"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   165
        value := self readBytes:length signed:false
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   166
    ] ifFalse:[(numberType == 6 "TIFF_SBYTE") ifTrue:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   167
        "TIFF6: 8bit signed integer"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   168
        value := self readBytes:length  signed:true
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   169
    ] ifFalse:[(numberType == 8 "TIFF_SSHORT") ifTrue:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   170
        "TIFF6: 16bit signed integer"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   171
        value := self readShorts:length signed:true
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   172
    ] ifFalse:[(numberType == 9 "TIFF_SLONG") ifTrue:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   173
        "TIFF6: 32bit signed integer"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   174
        value := self readLongs:length signed:true
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   175
    ] ifFalse:[(numberType == 10 "TIFF_SRATIONAL") ifTrue:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   176
        "TIFF6: 64 (32+32) bit signed fraction"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   177
        value := self readFracts:length signed:true
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   178
    ] ifFalse:[(numberType == 11 "TIFF_FLOAT") ifTrue:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   179
        "TIFF6: 32 bit IEEE float"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   180
        value := self readFloats:length
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   181
    ] ifFalse:[(numberType == 12 "TIFF_DOUBLE") ifTrue:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   182
        "TIFF6: 64 bit IEEE double"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
   183
        value := self readDoubles:length
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   184
        
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   185
    "/ the following are preps for the propsed bigTiff format    
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   186
    ] ifFalse:[(numberType == 16 "TIFF_LONG8") ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   187
        "BIGTIFF: 8-byte unsigned integer"
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   188
        value := self readLong8s:length signed:false
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   189
    ] ifFalse:[(numberType == 17 "TIFF_SLONG8") ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   190
        "BIGTIFF: 8-byte signed integer"
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   191
        value := self readLong8s:length signed:true
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   192
    ] ifFalse:[(numberType == 18 "TIFF_IFD8") ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   193
        "BIGTIFF: 8-byte unsigned IFD offset"
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   194
        value := self readLong8s:length signed:false
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   195
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   196
    ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
   197
        offset := (inStream nextInt32MSB:(byteOrder ~~ #lsb))
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   198
    ]]]]]]]]]]]]]].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   199
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   200
    (tagType between:200 and:299) ifTrue:[
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   201
        (tagType == 254) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   202
            "/ New SubfileType
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   203
            "/      REDUCEDIMAGE    -> 1
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   204
            "/      PAGE            -> 2
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   205
            "/      MASK            -> 4
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   206
            "newSubFileType := value."
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   207
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   208
            "/ 'newSubfiletype ' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   209
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   210
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   211
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   212
        (tagType == 255) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   213
            "/ Old SubfileType
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   214
            "/      IMAGE           -> 1
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   215
            "/      REDUCEDIMAGE    -> 2
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   216
            "/      PAGE            -> 3
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   217
            subFileType := value.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   218
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   219
            "/ 'subfiletype ' print. value printNewline.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   220
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   221
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   222
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   223
        (tagType == 256) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   224
            "ImageWidth"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   225
            width := value.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   226
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   227
            "/ 'width ' print. width printNewline.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   228
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   229
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   230
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   231
        (tagType == 257) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   232
            "ImageHeight"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   233
            height := value.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   234
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   235
            "/ 'height ' print. height  printNewline.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   236
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   237
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   238
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   239
        (tagType == 258) ifTrue:[
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
   240
            "bitspersample"  
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   241
             bitsPerSample := valueArray.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   242
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   243
            "/ 'bitspersample ' print. bitsPerSample printNewline.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   244
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   245
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   246
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   247
        (tagType == 259) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   248
            "/ compression
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   249
            "/      NONE            -> 1
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   250
            "/      CCITTRLE        -> 2
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   251
            "/      CCITTFAX3       -> 3
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   252
            "/      CCITTFAX4       -> 4
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   253
            "/      LZW             -> 5
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   254
            "/      OJPEG           -> 6
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   255
            "/      JPEG            -> 7
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   256
            "/      NEXT            -> 32766
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   257
            "/      CCITTRLEW       -> 32771
520
4eb74c86229e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   258
            "/      PACKBITS        -> 32773
4eb74c86229e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   259
            "/      THUNDERSCAN     -> 32809
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   260
            "/      PIXARFILM       -> 32908
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   261
            "/      PIXARLOG        -> 32909
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   262
            "/      DEFLATE         -> 32946
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   263
            "/      DCS             -> 32947
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   264
            "/      JBIG            -> 34661
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   265
            
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   266
            compression := value.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   267
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   268
            "/ 'compression ' print. compression printNewline.
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   269
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   270
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   271
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   272
        (tagType == 262) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   273
            "photometric"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   274
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   275
            (value == 0) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   276
              photometric := #whiteIs0
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   277
            ] ifFalse:[
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   278
              (value == 1) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   279
                photometric := #blackIs0
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   280
              ] ifFalse:[
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   281
                (value == 2) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   282
                  photometric := #rgb
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   283
                ] ifFalse:[
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   284
                  (value == 3) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   285
                    photometric := #palette
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   286
                  ] ifFalse:[
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   287
                    (value == 4) ifTrue:[
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   288
                      photometric := #transparencyMask
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   289
                    ] ifFalse:[
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   290
                      (value == 5) ifTrue:[
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   291
                        photometric := #cmyk  "/ color separations
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   292
                      ] ifFalse:[
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   293
                        (value == 6) ifTrue:[
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   294
                          photometric := #ycbcr    "/ CCIR 601
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   295
                        ] ifFalse:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   296
                          (value == 8) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   297
                            photometric := #cielab  "/ 1976 CIE L*a*b*
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   298
                          ] ifFalse:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   299
                            photometric := nil
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   300
                          ]
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   301
                        ]
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   302
                      ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   303
                    ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   304
                  ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   305
                ]
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   306
              ]
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   307
            ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   308
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   309
            "/ 'photometric ' print. photometric printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   310
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   311
            ^ self
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   312
        ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   313
        (tagType == 263) ifTrue:[
3957
c7db19dbd128 #OTHER by mawalch
mawalch
parents: 3899
diff changeset
   314
            "/ Thresholding
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   315
            "/      BILEVEL         -> 1
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   316
            "/      HALFTONE        -> 2
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   317
            "/      ERRORDIFFUSE    -> 3
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   318
3957
c7db19dbd128 #OTHER by mawalch
mawalch
parents: 3899
diff changeset
   319
            "thresholding := value."
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   320
3957
c7db19dbd128 #OTHER by mawalch
mawalch
parents: 3899
diff changeset
   321
            "/ 'thresholding ' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   322
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   323
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   324
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   325
        (tagType == 264) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   326
            "CellWidth"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   327
            "/ 'cellWidth ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   328
            metaData at:#CellWidth put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   329
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   330
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   331
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   332
        (tagType == 265) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   333
            "CellLength"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   334
            "/ 'cellLength ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   335
            metaData at:#CellLength put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   336
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   337
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   338
        (tagType == 266) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   339
            "fillOrder"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   340
            (value == 1) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   341
              fillOrder := #msb
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   342
            ] ifFalse:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   343
              (value == 2) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   344
                fillOrder := #lsb
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   345
              ] ifFalse:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   346
                fillOrder := nil
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   347
              ]
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   348
            ].
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   349
            "/ 'fillorder ' print. fillOrder printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   350
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   351
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   352
        (tagType == 269) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   353
            "documentName - info only"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   354
            "/ 'documentName ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   355
            metaData at:#DocumentName put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   356
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   357
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   358
        (tagType == 270) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   359
            "imageDescription - info only"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   360
            "/ 'imageDescription ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   361
            metaData at:#ImageDescription put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   362
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   363
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   364
        (tagType == 271) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   365
            "make - info only"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   366
            "/ 'make ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   367
            metaData at:#Make put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   368
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   369
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   370
        (tagType == 272) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   371
            "model - info only"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   372
            "/ 'model ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   373
            metaData at:#Model put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   374
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   375
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   376
        (tagType == 273) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   377
            stripOffsets := valueArray.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   378
            "/ 'stripOffsets Array(' print. stripOffsets size print. ')' printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   379
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   380
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   381
        (tagType == 274) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   382
            "Orientation"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   383
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   384
            orientation :=
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   385
                            #( nil          "/ 1 normal (topLeft)
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   386
                               unsupported  "/ 2 horizontal flip
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   387
                               unsupported  "/ 3 horizontal & vertical flip
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   388
                               vFlip        "/ 4 vertical flip
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   389
                               unsupported  "/ 5 rot 90' counter clock-wise
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   390
                               unsupported  "/ 6 rot 90' clock-wise
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   391
                               unsupported  "/ 7 rot 90' & flip
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   392
                               unsupported  "/ 8 rot 90' ccw & flip
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   393
                             ) at:value ifAbsent:#unsupported.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   394
            metaData at:#Orientation put:value.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   395
            "/ 'orientation ' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   396
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   397
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   398
        (tagType == 277) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   399
            samplesPerPixel := value.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   400
            "/ 'samplesperpixel ' print. samplesPerPixel printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   401
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   402
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   403
        (tagType == 278) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   404
            rowsPerStrip := value.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   405
            "/ 'rowsperstrip ' print. rowsPerStrip printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   406
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   407
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   408
        (tagType == 279) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   409
            "stripbytecount"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   410
            stripByteCounts := valueArray.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   411
            "/        'stripByteCounts Array(' print. 
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   412
            "/        stripByteCounts size print.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   413
            "/        ')' printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   414
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   415
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   416
        (tagType == 280) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   417
            "/ 'minSampleValue ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   418
            metaData at:#MinSampleValue put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   419
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   420
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   421
        (tagType == 281) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   422
            "/ 'maxSampleValue ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   423
            metaData at:#MaxSampleValue put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   424
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   425
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   426
        (tagType == 282) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   427
            "/ 'xResolution ' print. value printNewline.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   428
            metaData at:#ResolutionX put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   429
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   430
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   431
        (tagType == 283) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   432
            "/ 'yResolution ' print. value printNewline.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   433
            metaData at:#ResolutionY put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   434
            ^ self
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   435
        ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   436
        (tagType == 284) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   437
            (value == 1) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   438
              planarConfiguration := 1
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   439
            ] ifFalse:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   440
              (value == 2) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   441
                planarConfiguration := 2
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   442
              ] ifFalse:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   443
                planarConfiguration := nil
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   444
              ]
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   445
            ].
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   446
            "/ 'planarconfig ' print. planarConfiguration printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   447
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   448
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   449
        (tagType == 285) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   450
            "/ 'pageName ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   451
            metaData at:#PageName put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   452
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   453
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   454
        (tagType == 286) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   455
            "/ 'xPosition ' print. value printNewline.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   456
            metaData at:#PositionX put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   457
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   458
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   459
        (tagType == 287) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   460
            "/ 'yPosition ' print. value printNewline.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   461
            metaData at:#PositionY put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   462
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   463
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   464
        (tagType == 288) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   465
            "/ 'freeOffsets ' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   466
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   467
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   468
        (tagType == 289) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   469
            "/ 'freeByteCounts ' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   470
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   471
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   472
        (tagType == 290) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   473
            "/ 'grayResponceUnit' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   474
            metaData at:#GrayResponceUnit put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   475
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   476
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   477
        (tagType == 291) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   478
            "/ 'grayResponceCurve' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   479
            metaData at:#GrayResponceCurve put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   480
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   481
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   482
        (tagType == 292) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   483
            "/ group3options
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   484
            "/      2DENCODING      -> 1
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   485
            "/      UNCOMPRESSED    -> 2
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   486
            "/      FILLBITS        -> 4
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   487
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   488
            group3options := value.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   489
            "/ 'group3options ' print. group3options printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   490
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   491
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   492
        (tagType == 293) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   493
            "/ group4options
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   494
            "/      UNCOMPRESSED    -> 2
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   495
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   496
            "group4options := value."
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   497
            "/ 'group4options ' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   498
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   499
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   500
        (tagType == 296) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   501
            "resolutionunit"
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   502
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   503
    "/        (value == 1) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   504
    "/            'res-unit pixel' printNewline
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   505
    "/        ] ifFalse:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   506
    "/            (value == 2) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   507
    "/                'res-unit inch' printNewline
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   508
    "/            ] ifFalse:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   509
    "/                (value == 3) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   510
    "/                    'res-unit mm' printNewline
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   511
    "/                ] ifFalse:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   512
    "/                    'res-unit invalid' printNewline
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   513
    "/                ]
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   514
    "/            ]
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   515
    "/        ].
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   516
            metaData at:#ResolutionUnit put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   517
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   518
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   519
        (tagType == 297) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   520
            "/ 'pageNumber ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   521
            metaData at:#PageNumber put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   522
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   523
        ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   524
    ].
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   525
    
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   526
    (tagType between:300 and:399) ifTrue:[
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   527
        (tagType == 300) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   528
            "/ 'colorResponceUnit' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   529
            metaData at:#ColorResponceUnit put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   530
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   531
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   532
        (tagType == 301) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   533
            "/ 'colorResponceCurve' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   534
            metaData at:#ColorResponceCurve put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   535
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   536
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   537
        (tagType == 305) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   538
            "software - info only"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   539
            "/ 'software' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   540
            metaData at:#Software put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   541
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   542
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   543
        (tagType == 306) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   544
            "dateTime - info only"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   545
            "/ 'dateTime ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   546
            metaData at:#DateTime put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   547
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   548
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   549
        (tagType == 315) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   550
            "artist - info only"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   551
            "/ 'artist ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   552
            metaData at:#Artist put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   553
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   554
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   555
        (tagType == 316) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   556
            "host computer - info only"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   557
            "/ 'host ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   558
            metaData at:#HostComputer put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   559
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   560
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   561
        (tagType == 317) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   562
            "/ 'predictor ' print. predictor printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   563
            predictor := value.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   564
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   565
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   566
        (tagType == 318) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   567
            "/ 'whitePoint ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   568
            metaData at:#WhitePoint put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   569
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   570
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   571
        (tagType == 319) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   572
            "/ 'primaryChromatics ' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   573
            metaData at:#PrimaryChromatics put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   574
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   575
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   576
        (tagType == 320) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   577
            "/ 'colorMap (size=' print. valueArray size print. ')' printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   578
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   579
            "
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   580
             the tiff colormap contains 16bit values;
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   581
             our colormap expects 8bit values
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   582
            "
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   583
            n := valueArray size // 3.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   584
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   585
            rV := ByteArray uninitializedNew:n.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   586
            gV := ByteArray uninitializedNew:n.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   587
            bV := ByteArray uninitializedNew:n.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   588
            scaleFactor := 255.0 / 16rFFFF.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   589
            i2 := n+1.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   590
            i3 := 2*n+1.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   591
            1 to:n do:[:vi |
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   592
                val := ((valueArray at:vi) * scaleFactor) rounded.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   593
                rV at:vi put:val.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   594
                val := ((valueArray at:i2) * scaleFactor) rounded.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   595
                gV at:vi put:val.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   596
                val := ((valueArray at:i3) * scaleFactor) rounded.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   597
                bV at:vi put:val.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   598
                i2 := i2 + 1.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   599
                i3 := i3 + 1.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   600
            ].
1759
f52382e5a9b8 slowly getting rid of the Colormap class
Claus Gittinger <cg@exept.de>
parents: 1748
diff changeset
   601
            colorMap := MappedPalette redVector:rV greenVector:gV blueVector:bV.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   602
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   603
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   604
        (tagType == 321) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   605
            "/ 'halftonehints' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   606
            metaData at:#HalftoneHints put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   607
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   608
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   609
        (tagType == 322) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   610
            "/ 'tilewidth' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   611
            metaData at:#TileWidth put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   612
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   613
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   614
        (tagType == 323) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   615
            "/ 'tilelength' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   616
            metaData at:#TileLength put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   617
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   618
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   619
        (tagType == 324) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   620
            "/ 'tileoffsets' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   621
            metaData at:#TileOffsets put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   622
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   623
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   624
        (tagType == 325) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   625
            "/ 'tilebytecounts' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   626
            metaData at:#TileByteCounts put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   627
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   628
        ].
1827
ae4d319c0292 comment
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   629
        (tagType == 326) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   630
            "/ 'badFaxLines' print. value printNewline.
1827
ae4d319c0292 comment
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   631
            ^ self
ae4d319c0292 comment
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   632
        ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   633
        (tagType == 327) ifTrue:[
1827
ae4d319c0292 comment
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   634
            "CleanFaxData"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   635
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   636
            "/        'cleanfaxdata' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   637
            "/        (value == 0) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   638
            "/            'no lines with incorrect pixel counts' printNewline
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   639
            "/        ] ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   640
            "/            (value == 1) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   641
            "/                'incorrect lines were regenerated' printNewline
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   642
            "/            ] ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   643
            "/                (value == 2) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   644
            "/                    'incorrect lines were not regenerated' printNewline
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   645
            "/                ] ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   646
            "/                    'cleanfaxdata invalid' printNewline
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   647
            "/                ]
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   648
            "/            ]
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   649
            "/        ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   650
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   651
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   652
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   653
        (tagType == 328) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   654
            "/ 'consecutiveBadFaxLines' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   655
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   656
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   657
        (tagType == 330) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   658
            "/ 'subifd' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   659
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   660
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   661
        (tagType == 332) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   662
            "/ 'ink set' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   663
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   664
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   665
        (tagType == 333) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   666
            "/ 'ink names' print. value printNewline.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   667
            metaData at:#IncNames put:value.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   668
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   669
        ].
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   670
        (tagType == 334) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   671
            "/ 'numinks' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   672
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   673
        ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   674
        (tagType == 336) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   675
            "/ 'dot range' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   676
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   677
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   678
        (tagType == 337) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   679
            "/ 'target printer' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   680
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   681
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   682
        (tagType == 338) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   683
            "/ 'extrasamples' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   684
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   685
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   686
        (tagType == 339) ifTrue:[
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
   687
            "/ 'sample format' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   688
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   689
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   690
        (tagType == 340) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   691
            "/ 'min sample value' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   692
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   693
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   694
        (tagType == 341) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   695
            "/ 'max sample value' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   696
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   697
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   698
        (tagType == 342) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   699
            "/ 'transfer range' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   700
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   701
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   702
        (tagType == 343) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   703
            "/ 'clip path' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   704
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   705
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   706
        (tagType == 344) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   707
            "/ 'xclip path units' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   708
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   709
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   710
        (tagType == 345) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   711
            "/ 'yclip path units' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   712
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   713
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   714
        (tagType == 347) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   715
            "/ 'jpegtables' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   716
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   717
        ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   718
    ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   719
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   720
    (tagType between:400 and:499) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   721
        (tagType == 400) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   722
            "/ 'GlobalParametersIFD' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   723
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   724
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   725
        (tagType == 401) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   726
            "/ 'ProfileType' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   727
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   728
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   729
        (tagType == 402) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   730
            "/ 'FaxProfile' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   731
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   732
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   733
        (tagType == 403) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   734
            "/ 'CodingMethods' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   735
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   736
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   737
        (tagType == 404) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   738
            "/ 'VersionYear' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   739
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   740
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   741
        (tagType == 405) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   742
            "/ 'ModeNumber' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   743
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   744
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   745
        (tagType == 433) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   746
            "/ 'Decode' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   747
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   748
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   749
        (tagType == 434) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   750
            "/ 'DefaultImageColor' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   751
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   752
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   753
    ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   754
    
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   755
    (tagType between:500 and:599) ifTrue:[
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   756
        "/ obsolete JPEG tags
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   757
        (tagType == 512) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   758
            "/ 'jpeg proc' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   759
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   760
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   761
        (tagType == 513) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   762
            "/ 'jpeg proc' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   763
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   764
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   765
        (tagType == 514) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   766
            "/ 'jpeg ifByteCount' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   767
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   768
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   769
        (tagType == 515) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   770
            "/ 'jpeg restartInterval' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   771
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   772
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   773
        (tagType == 517) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   774
            "/ 'jpeg glossLessPredictors' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   775
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   776
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   777
        (tagType == 518) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   778
            "/ 'jpeg pointTransform' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   779
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   780
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   781
        (tagType == 519) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   782
            "/ 'jpeg qTables' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   783
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   784
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   785
        (tagType == 520) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   786
            "/ 'jpeg dcTables' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   787
             ^ self
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   788
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   789
        (tagType == 521) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   790
            "/ 'jpeg acTables' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   791
            ^ self
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   792
        ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   793
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   794
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   795
        (tagType == 529) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   796
            "/ 'ycbr coeff' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   797
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   798
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   799
        (tagType == 530) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   800
            "/ 'ycbr subsampling' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   801
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   802
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   803
        (tagType == 531) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   804
            "/ 'ycbr positioning' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   805
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   806
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   807
        (tagType == 532) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   808
            "/ 'referenceBlackWhite' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   809
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   810
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   811
        (tagType == 559) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   812
            "/ 'stripRowCounts' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   813
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   814
        ].
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   815
    ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   816
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   817
    (tagType between:700 and:799) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   818
        (tagType == 700) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   819
            "XMLPACKET"
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   820
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   821
            "/ In TIFF files, the XML Packet containing XMP metadata is pointed to
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   822
            "/ by an entry in the Image File Directory (IFD). That entry has a Tag
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   823
            "/ value of 700, as shown in Table 1.1, "TIFF IFD Directory Entry for
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   824
            "/ XML Packets
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   825
            
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   826
            "/ 'XMLPACKET' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   827
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   828
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   829
    ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   830
    
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   831
    (tagType > 32000) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   832
        (tagType == 32781) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   833
            "/'imageid' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   834
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   835
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   836
        (tagType == 32932) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   837
            "/'wang annotation' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   838
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   839
        ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   840
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   841
        "/ Private Island graphics tags
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   842
        (tagType == 32953) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   843
            "/'ref points' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   844
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   845
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   846
        (tagType == 32954) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   847
            "/ 'regionTagPoint' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   848
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   849
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   850
        (tagType == 32955) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   851
            "/ 'regionWarpCorners' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   852
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   853
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   854
        (tagType == 32956) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   855
            "/ 'regionAffine' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   856
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   857
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   858
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   859
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   860
        "/ Private SGI tags
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   861
        (tagType == 32995) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   862
            "/ 'matteing' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   863
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   864
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   865
        (tagType == 32996) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   866
            "/ 'datatype' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   867
            ^ self
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   868
        ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   869
        (tagType == 32997) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   870
            "/ 'imagedepth' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   871
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   872
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   873
        (tagType == 32998) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   874
            "/ 'tiledepth' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   875
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   876
        ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   877
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   878
        "/ Private Pixar tags
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   879
        (tagType == 33300) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   880
            "/ 'image full width' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   881
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   882
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   883
        (tagType == 33301) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   884
            "/ 'image full length' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   885
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   886
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   887
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   888
        "/ Private Eastman Kodak tags
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   889
        (tagType == 33405) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   890
            "/ 'write serial number' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   891
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   892
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   893
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   894
        "/ unknown
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   895
        (tagType == 33432) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   896
            "/ 'copyright' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   897
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   898
        ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   899
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   900
        (tagType == 33550) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   901
            "/ 'geotiff modelpixelscaletag' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   902
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   903
        ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   904
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   905
        (tagType == 33723) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   906
            "/ 'RICHTIFFIPTC' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   907
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   908
        ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   909
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   910
        "/ Private Texas instruments
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   911
        (tagType == 34232) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   912
            "/ 'sequence frame count' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   913
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   914
        ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   915
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   916
        "/ Private Pixel magic
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   917
        (tagType == 34232) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   918
            "/ 'jbig options' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   919
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   920
        ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   921
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   922
        "/ private Photoshop
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   923
        (tagType == 34377) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   924
            "/ 'photoshop RICHTIFFIPTC' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   925
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   926
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   927
        (tagType == 34665) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   928
            "/ 'EXIFIFD' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   929
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   930
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   931
        (tagType == 34675) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   932
            "/ 'ICCPROFILE' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   933
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   934
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   935
        
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   936
        (tagType == 34732) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   937
            "/ 'ImageLayer' print. value printNewline.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   938
            ^ self
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   939
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   940
        
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   941
        "/ More Private SGI
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   942
        (tagType == 34908) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   943
            "/ 'fax recv params' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   944
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   945
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   946
        (tagType == 34909) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   947
            "/ 'fax subaddress' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   948
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   949
        ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   950
        (tagType == 34910) ifTrue:[
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   951
            "/ 'fax recv time' print. value printNewline.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   952
            ^ self
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   953
        ].
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
   954
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   955
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   956
"/
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   957
"/ '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
   958
"/ ' 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
   959
"/ ' 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
   960
"/
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   961
    'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   962
3957
c7db19dbd128 #OTHER by mawalch
mawalch
parents: 3899
diff changeset
   963
    "Modified (format): / 23-05-2017 / 16:12:58 / mawalch"
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
   964
    "Modified: / 24-08-2017 / 22:02:33 / cg"
440
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   965
! !
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   966
1762
55cf76514c8c method category rename
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
   967
!TIFFReader methodsFor:'private-data reading'!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   968
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   969
readCCITT3RLETiffImageData
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   970
    ^ self fileFormatError:'ccitt G3 mod Huffman (rle) compression not implemented'
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   971
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   972
    "Modified: / 3.2.1998 / 18:03:14 / cg"
135
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
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   975
readCCITT3RLEWTiffImageData
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   976
    ^ self fileFormatError:'ccitt G3 mod Huffman (rlew) compression not implemented'.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   977
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   978
    "Modified: / 3.2.1998 / 18:03:30 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   979
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   980
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   981
readCCITTGroup3TiffImageData
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
   982
    "not really tested - all I got is a single fax from NeXT step"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   983
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   984
    |bytesPerRow bitsPerRow compressedStrip nPlanes 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   985
     stripNr       "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   986
     offset        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   987
     row           "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   988
     bytesPerStrip "{ Class: SmallInteger }" |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   989
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   990
    nPlanes := samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   991
    (nPlanes == 2) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   992
        'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   993
        nPlanes := 1
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   994
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   995
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   996
    (nPlanes ~~ 1) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   997
        ^ self fileFormatError:'only monochrome/greyscale ccitt3supported'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
   998
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   999
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1000
    stripByteCounts isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1001
        ^ self fileFormatError:'currently require stripByteCounts'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1002
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1003
    (rowsPerStrip ~~ 1) isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1004
        ^ self fileFormatError:'currently require rowsPerStrip to be 1'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1005
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1006
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1007
"/    'TIFFReader: decompressing CCITT-3 ...' infoPrintNL.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1008
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1009
    bitsPerRow := width * (bitsPerSample at:1).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1010
    bytesPerRow := bitsPerRow // 8.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1011
    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1012
        bytesPerRow := bytesPerRow + 1
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1013
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1014
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1015
    data := ByteArray new:(bytesPerRow * height).
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1016
    compressedStrip := ByteArray uninitializedNew:bytesPerRow.
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
    offset := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1019
    stripNr := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1020
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1021
    row := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1022
    bytesPerStrip := bytesPerRow * rowsPerStrip.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1023
    [row <= height] whileTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1024
        stripNr := stripNr + 1.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1025
        self positionToStrip:stripNr.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1026
        inStream nextBytes:(stripByteCounts at:stripNr) into:compressedStrip.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1027
        self class decompressCCITT3From:compressedStrip
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1028
                                   into:data
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1029
                             startingAt:offset
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1030
                                  count:width.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1031
        offset := offset + bytesPerStrip.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1032
        row := row + rowsPerStrip
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1033
    ]
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1034
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1035
    "Modified: / 3.2.1998 / 18:04:21 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1036
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1037
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1038
readCCITTGroup4TiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1039
    ^ self fileFormatError:'ccitt group4 fax compression not implemented'.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1040
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1041
    "Modified: / 3.2.1998 / 18:04:34 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1042
!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1043
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  1044
readCCITTRLEWTiffImageData
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  1045
    ^ self fileFormatError:'ccitt mod Huffman (rlew) compression not implemented'
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  1046
!
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  1047
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1048
readDCSTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1049
    ^ self fileFormatError:'dcs compression not implemented'.
329
5fb99e0734e4 handle empty character-strings
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
  1050
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1051
    "Modified: / 3.2.1998 / 18:04:44 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1052
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1053
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1054
readDeflateTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1055
    ^ self fileFormatError:'deflate compression not implemented'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1056
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1057
    "Modified: / 3.2.1998 / 18:04:54 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1058
!
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1059
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1060
readJBIGTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1061
    ^ self fileFormatError:'jbig compression not implemented'.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1062
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1063
    "Modified: / 3.2.1998 / 18:05:04 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1064
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1065
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1066
readJPEGTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1067
    ^ self fileFormatError:'jpeg compression not implemented'.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1068
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1069
    "Modified: / 3.2.1998 / 18:05:12 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1070
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1071
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1072
readLZWTiffImageData
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1073
    "read LZW compressed tiff data; this method only
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1074
     handles 3x8 rgb and 1x2 or 2x2 greyscale images.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1075
     For 2x2 greyscale images, the alpha plane is ignored.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1076
     (maybe other formats work also - its simply not
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1077
      tested)"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1078
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1079
    |bytesPerRow compressedStrip nPlanes overAllBytes
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1080
     bytesPerStrip "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1081
     nBytes        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1082
     prevSize      "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1083
     stripNr       "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1084
     offset        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1085
     row           "{ Class: SmallInteger }" |
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1086
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1087
    nPlanes := samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1088
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1089
    (nPlanes >= 3) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1090
        (bitsPerSample conform:[:each | each == 8]) ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1091
            ^ self fileFormatError:'only 8/8/8(/8) bits/sample are supported'.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1092
        ].
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1093
        bytesPerRow := width * samplesPerPixel.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1094
    ] ifFalse:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1095
        (nPlanes == 2) ifTrue:[
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1096
            (planarConfiguration ~~ 2) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1097
                ^ self fileFormatError:'only separate planes are supported'.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1098
            ].
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1099
            'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1100
            nPlanes := 1
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1101
        ].
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1102
        (nPlanes == 1) ifFalse:[
1830
8b04109affc1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  1103
            ^ self fileFormatError:'unsupported nPlanes: ' , nPlanes printString, '; only 3-sample rgb / monochrome supported'.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1104
        ].
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1105
        bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1106
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1107
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1108
    stripByteCounts isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1109
        ^ self fileFormatError:'currently require stripByteCounts'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1110
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1111
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1112
"/    'TIFFReader: decompressing LZW ...' infoPrintNL.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1113
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1114
    overAllBytes := bytesPerRow * height.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1115
    bytesPerRow == width ifTrue:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1116
        data := ByteArray uninitializedNew:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1117
    ] ifFalse:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1118
        data := ByteArray new:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1119
    ].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1120
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1121
    offset := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1122
    stripNr := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1123
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1124
    row := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1125
    bytesPerStrip := bytesPerRow * rowsPerStrip.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1126
    prevSize := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1127
    [row <= height] whileTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1128
        stripNr := stripNr + 1.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1129
        self positionToStrip:stripNr.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1130
        nBytes := stripByteCounts at:stripNr.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1131
        (nBytes > prevSize) ifTrue:[
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1132
            compressedStrip := ByteArray uninitializedNew:nBytes.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1133
            prevSize := nBytes
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1134
        ].
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1135
        inStream nextBytes:nBytes into:compressedStrip.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1136
        self class 
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1137
            decompressLZWFrom:compressedStrip count:nBytes
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1138
            into:data startingAt:offset.
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1139
        offset := offset + bytesPerStrip.
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1140
        row := row + rowsPerStrip
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1141
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1142
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1143
    (predictor == 2) ifTrue:[
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1144
        self class decodeDelta:3 in:data width:width height:height
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1145
    ]
335
a32831edacc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1146
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1147
    "Modified: / 24-08-2017 / 20:58:59 / cg"
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1148
    "Modified (format): / 24-08-2017 / 22:16:41 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1149
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1150
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1151
readNeXTJPEGTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1152
    ^ self fileFormatError:'next jpeg compression not implemented'.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1153
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1154
    "Modified: / 3.2.1998 / 18:10:45 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1155
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1156
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1157
readNeXTRLE2TiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1158
    ^ self fileFormatError:'next 2bit rle compression not implemented'.
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1159
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1160
    "Modified: / 3.2.1998 / 18:10:54 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1161
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1162
1826
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  1163
readNewJPEGTiffImageData
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  1164
    ^ self fileFormatError:'new jpeg compression not implemented'.
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  1165
!
0a452034f661 comment
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  1166
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1167
readPackbitsTiffImageData
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1168
    "this has only been tested with monochrome images"
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1169
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1170
    |bytesPerRow bitsPerRow nPlanes 
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1171
     stripNr       "{ Class: SmallInteger }"
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1172
     offset        "{ Class: SmallInteger }"
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1173
     row           "{ Class: SmallInteger }" 
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1174
     nBytes        "{ Class: SmallInteger }"
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1175
     nDecompressedBytes  "{ Class: SmallInteger }"
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1176
     bitsPerPixel overAllBytes buffer|
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1177
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1178
    nPlanes := samplesPerPixel.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1179
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1180
    "only support 1-sample/pixel,
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1181
     with alpha - if separate planes,
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1182
     or rgb - if non separate planes and no alpha"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1183
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1184
    (nPlanes == 2) ifTrue:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1185
        (planarConfiguration ~~ 2) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1186
            ^ self fileFormatError:'with alpha, only separate planes supported'.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1187
        ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1188
        'TIFFReader [info]: ignoring alpha plane' infoPrintCR.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1189
        nPlanes := 1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1190
        bitsPerPixel := bitsPerSample at:1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1191
        bitsPerSample := Array with:bitsPerPixel.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1192
        samplesPerPixel := 1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1193
    ] ifFalse:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1194
        (nPlanes == 3) ifTrue:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1195
            (planarConfiguration ~~ 1) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1196
                ^ self fileFormatError:'only non separate planes supported'.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1197
            ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1198
            bitsPerSample ~= #(8 8 8) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1199
                ^ self fileFormatError:'only 8/8/8 rgb images supported'.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1200
            ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1201
            bitsPerPixel := 24
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1202
        ] ifFalse:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1203
            (nPlanes ~~ 1) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1204
                ^ self fileFormatError:'format not supported'.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1205
            ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1206
            bitsPerPixel := bitsPerSample at:1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1207
        ]
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1208
    ].
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1209
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1210
    bitsPerRow := width * bitsPerPixel.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1211
    bytesPerRow := bitsPerRow // 8.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1212
    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1213
        bytesPerRow := bytesPerRow + 1
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1214
    ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1215
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1216
    overAllBytes := bytesPerRow * height.
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1217
    bytesPerRow == width ifTrue:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1218
        data := ByteArray uninitializedNew:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1219
    ] ifFalse:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1220
        data := ByteArray new:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1221
    ].
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1222
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1223
    offset := 1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1224
    stripNr := 0.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1225
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1226
    buffer := nil.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1227
    row := 1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1228
    [row <= height] whileTrue:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1229
        stripNr := stripNr + 1.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1230
        nBytes := stripByteCounts at:stripNr.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1231
        self positionToStrip:stripNr.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1232
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1233
        nBytes > buffer size ifTrue:[
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1234
            "/ realloc
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1235
            buffer := ByteArray uninitializedNew:nBytes.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1236
        ].
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1237
        inStream nextBytes:nBytes into:buffer.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1238
3382
cca44f2caa2d class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 3211
diff changeset
  1239
        nDecompressedBytes := self class decompressPackBits:nBytes from:buffer to:data startingAt:offset.
744
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1240
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1241
        offset := offset + nDecompressedBytes.
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1242
        row := row + rowsPerStrip
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1243
    ]
363d53be9eb0 packbits decompression.
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1244
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1245
    "Modified: / 12.8.1998 / 13:57:34 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1246
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1247
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1248
readPixarFilmTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1249
    ^ self fileFormatError:'pixar film compression not implemented'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1250
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1251
    "Modified: / 3.2.1998 / 18:11:45 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1252
!
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1253
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1254
readPixarLogTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1255
    ^ self fileFormatError:'pixar log compression not implemented'.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1256
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1257
    "Modified: / 3.2.1998 / 18:11:53 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1258
!
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1259
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1260
readThunderScanTiffImageData
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1261
    ^ self fileFormatError:'thunderScan compression not implemented' .
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1262
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1263
    "Modified: / 3.2.1998 / 18:12:01 / cg"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1264
!
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1265
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1266
readTiffImageData
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1267
    (compression == 1) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1268
        ^ self readUncompressedTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1269
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1270
    (compression == 2) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1271
        ^ self readCCITT3RLETiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1272
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1273
    (compression == 3) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1274
        ^ self readCCITTGroup3TiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1275
    ]. 
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1276
    (compression == 4) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1277
        ^ self readCCITTGroup4TiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1278
    ]. 
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1279
    (compression == 5) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1280
        ^ self readLZWTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1281
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1282
    (compression == 6) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1283
        ^ self readJPEGTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1284
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1285
    (compression == 7) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1286
        ^ self readNewJPEGTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1287
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1288
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1289
    (compression == 32766) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1290
        ^ self readNeXTRLE2TiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1291
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1292
    (compression == 32771) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1293
        ^ self readCCITTRLEWTiffImageData.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1294
    ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1295
    (compression == 32773) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1296
        ^ self readPackbitsTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1297
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1298
    (compression == 32809) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1299
        ^ self readThunderScanTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1300
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1301
    (compression == 32908) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1302
        ^ self readPixarFilmTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1303
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1304
    (compression == 32909) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1305
        ^ self readPixarLogTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1306
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1307
    (compression == 32946) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1308
        ^ self readDeflateTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1309
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1310
    (compression == 32947) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1311
        ^ self readDCSTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1312
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1313
    (compression == 32865) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1314
        ^ self readNeXTJPEGTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1315
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1316
    (compression == 34661) ifTrue:[
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1317
        ^ self readJBIGTiffImageData.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1318
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1319
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1320
    ^ self fileFormatError:('compression type ' , compression printString , ' not known').
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1321
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1322
    "Created: / 11.4.1997 / 00:19:44 / cg"
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1323
    "Modified: / 3.2.1998 / 18:12:36 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1324
!
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1325
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1326
readUncompressedTiffImageData
3610
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1327
    |bytesPerRow   "{ Class: SmallInteger }"
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1328
     bitsPerRow    "{ Class: SmallInteger }"
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1329
     nPlanes 
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1330
     stripNr       "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1331
     offset        "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1332
     row           "{ Class: SmallInteger }" 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1333
     nBytes        "{ Class: SmallInteger }"
3610
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1334
     bitsPerPixel 
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1335
     overAllBytes  "{ Class: SmallInteger }"
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1336
     where         "{ Class: SmallInteger }"
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1337
     stripPos      |
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1338
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1339
    nPlanes := samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1340
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1341
    "/ not all formats are supported here,
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1342
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1343
    (nPlanes == 2) ifTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1344
        (planarConfiguration ~~ 2) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1345
            ^ self fileFormatError:'with alpha, only separate planes supported'.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1346
        ].
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  1347
        '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
  1348
        nPlanes := 1.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1349
        bitsPerPixel := bitsPerSample at:1.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1350
        bitsPerSample := Array with:bitsPerPixel.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1351
        samplesPerPixel := 1.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1352
    ] ifFalse:[
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1353
        (nPlanes == 4) ifTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1354
            (planarConfiguration ~~ 1) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1355
                ^ self fileFormatError:'only non separate planes supported'.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1356
            ].
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1357
            bitsPerSample ~= #(8 8 8 8) ifTrue:[
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1358
                ^ self fileFormatError:'only 8/8/8/8 cmyk images supported'.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1359
            ].
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1360
            bitsPerPixel := 32.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1361
        ] ifFalse:[
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1362
            (nPlanes == 3) ifTrue:[
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1363
                (planarConfiguration ~~ 1) ifTrue:[
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1364
                    ^ self fileFormatError:'only non separate planes supported'.
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1365
                ].
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1366
                bitsPerSample ~= #(8 8 8) ifTrue:[
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1367
                    ^ self fileFormatError:'only 8/8/8 rgb images supported (is: ' , bitsPerSample printString , ')'.
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1368
                ].
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1369
                bitsPerPixel := 24
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1370
            ] ifFalse:[
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1371
                (nPlanes ~~ 1) ifTrue:[
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1372
                    ^ self fileFormatError:('unsupported format: nplanes=' , nPlanes printString).
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1373
                ].
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1374
                bitsPerPixel := bitsPerSample at:1.
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1375
            ]
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1376
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1377
    ].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1378
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1379
    bitsPerRow := width * bitsPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1380
    bytesPerRow := bitsPerRow // 8.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1381
    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1382
        bytesPerRow := bytesPerRow + 1
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1383
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1384
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1385
    overAllBytes := bytesPerRow * height.
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1386
    bytesPerRow == width ifTrue:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1387
        data := ByteArray uninitializedNew:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1388
    ] ifFalse:[
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1389
        data := ByteArray new:overAllBytes.
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1390
    ].
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1391
336
9789b02d95bf oops - the very last pixel was not read (in readUncompressed ...)
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1392
    offset := 0.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1393
    stripNr := 0.
3610
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1394
    where := -1.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1395
    row := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1396
    [row <= height] whileTrue:[
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1397
        stripNr := stripNr + 1.
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1398
        nBytes := stripByteCounts at:stripNr.
3610
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1399
        stripPos := stripOffsets at:stripNr.
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1400
        where ~~ stripPos ifTrue:[
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1401
            inStream position:stripPos.
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1402
            where := stripPos.
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1403
        ].
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1404
        
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1405
        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
  1406
            nBytes := overAllBytes - offset.
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1407
        ].
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1408
563
38cbee875bfa read data in blocks - better if images are read from a CD
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
  1409
        "/ read it 4k-wise; this leads to a better behavior,
1748
0ad7db36c871 comment
Claus Gittinger <cg@exept.de>
parents: 1745
diff changeset
  1410
        "/ when reading big images from a slow device (such as a cdrom)
563
38cbee875bfa read data in blocks - better if images are read from a CD
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
  1411
        inStream nextBytes:nBytes into:data startingAt:offset+1 blockSize:4096.
1230
993aaef8a28a support reading of 4-plane cmyk uncompressed images.
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1412
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1413
        offset := offset + nBytes.
3610
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1414
        row := row + rowsPerStrip.
e9326c841c48 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
  1415
        where := where + nBytes.
1748
0ad7db36c871 comment
Claus Gittinger <cg@exept.de>
parents: 1745
diff changeset
  1416
    ].
317
5de89b17ed48 care for bad strip size (how can this happen ?)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  1417
1037
90d38c8e3f5f use initialized byteArrays, in case rows are padded
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1418
    "Modified: / 12.8.1998 / 13:57:14 / cg"
440
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1419
! !
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1420
1762
55cf76514c8c method category rename
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  1421
!TIFFReader methodsFor:'private-reading'!
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1422
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1423
positionToStrip:stripNr
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1424
    inStream position:(stripOffsets at:stripNr).
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1425
!
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1426
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  1427
readBytes:n signed:isSigned
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1428
    "read n 8bit signed or unsigned integers and return them in an array or byteArray"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1429
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1430
    |oldPos offset bytes|
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1431
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1432
    n == 0 ifTrue:[^ ''].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1433
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  1434
    bytes := (isSigned ifTrue:[Array] ifFalse:[ByteArray]) new:n.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1435
    (n <= 4) ifTrue:[
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  1436
        isSigned ifTrue:[
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1437
            1 to:n do:[:i | bytes at:i put:(inStream nextSignedByte) ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1438
        ] ifFalse:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1439
            inStream nextBytes:n into:bytes.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1440
        ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1441
        (n < 4) ifTrue:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1442
            inStream skip:(4 - n).
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1443
        ]
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1444
    ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1445
        offset := inStream nextInt32MSB:(byteOrder ~~ #lsb).
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1446
        oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1447
        inStream position:offset.
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  1448
        isSigned ifTrue:[
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1449
            1 to:n do:[:i | bytes at:i put:(inStream nextSignedByte) ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1450
        ] ifFalse:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1451
            inStream nextBytes:n into:bytes.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1452
        ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1453
        inStream position:oldPos
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1454
    ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1455
    ^ bytes
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1456
!
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1457
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1458
readChars:n
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1459
    "read n characters and return them in a string"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1460
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1461
    |oldPos offset string|
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1462
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1463
    n == 0 ifTrue:[^ ''].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1464
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1465
    string := String new:(n - 1).
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1466
    (n <= 4) ifTrue:[
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1467
        inStream nextBytes:(n - 1) into:string.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1468
        (n < 4) ifTrue:[
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1469
            inStream skip:(4 - n).
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1470
        ]
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1471
    ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1472
        offset := inStream nextInt32MSB:(byteOrder ~~ #lsb).
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1473
        oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1474
        inStream position:offset.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1475
        inStream nextBytes:(n - 1) into:string.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1476
        inStream position:oldPos
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1477
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1478
    ^ string
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1479
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1480
    "Modified: 5.9.1996 / 12:21:08 / cg"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1481
!
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1482
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1483
readDoubles:nFloats
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1484
    "read nFloats IEEE 64bit doubles and return them in an array"
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1485
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1486
    |oldPos offset values val msb 
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1487
     n "{ Class: SmallInteger }" |
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1488
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1489
    n := nFloats.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1490
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1491
    msb := byteOrder ~~ #lsb.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1492
    values := DoubleArray basicNew:n.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1493
    (n == 1) ifTrue:[
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1494
        val := Float readBinaryIEEEDoubleFrom:inStream MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1495
        values at:1 put:val.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1496
    ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1497
        offset := inStream nextInt32MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1498
        oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1499
        inStream position:offset.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1500
        1 to:n do:[:index |
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1501
            val := Float readBinaryIEEEDoubleFrom:inStream MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1502
            values at:index put:val
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1503
        ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1504
        inStream position:oldPos
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1505
    ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1506
    ^ values
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1507
!
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1508
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1509
readFloats:nFloats
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1510
    "read nFloats IEEE 32bit floats and return them in an array"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1511
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1512
    |oldPos offset values val msb 
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1513
     n "{ Class: SmallInteger }" |
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1514
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1515
    n := nFloats.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1516
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1517
    msb := byteOrder ~~ #lsb.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1518
    values := FloatArray basicNew:n.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1519
    (n == 1) ifTrue:[
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1520
        val := ShortFloat readBinaryIEEESingleFrom:inStream MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1521
        values at:1 put:val.
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1522
    ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1523
        offset := inStream nextInt32MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1524
        oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1525
        inStream position:offset.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1526
        1 to:n do:[:index |
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1527
            val := ShortFloat readBinaryIEEESingleFrom:inStream MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1528
            values at:index put:val
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1529
        ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1530
        inStream position:oldPos
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1531
    ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1532
    ^ values
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1533
!
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1534
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  1535
readFracts:nFracts signed:isSigned
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1536
    "read nFracts fractions (2 32bit words) and return them in an array"
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1537
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1538
    |oldPos offset values numerator denominator msb
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1539
     n "{ Class: SmallInteger }" |
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1540
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1541
    n := nFracts.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1542
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1543
    msb := byteOrder ~~ #lsb.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1544
    values := Array basicNew:n.
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1545
    offset := inStream nextInt32MSB:msb.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1546
    oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1547
    inStream position:offset.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1548
    1 to:n do:[:index |
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1549
        numerator := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb].
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1550
        denominator := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb].
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1551
        values at:index put:(Fraction numerator:numerator denominator:denominator)
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1552
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1553
    inStream position:oldPos.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1554
    ^ values
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1555
!
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1556
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1557
readLong8s:nLongs signed:isSigned
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1558
    "read nLongs signed or unsigned long8 numbers (64bit) and return them in an array"
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1559
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1560
    |oldPos offset values val msb 
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1561
     n "{ Class: SmallInteger }" |
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1562
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1563
    n := nLongs.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1564
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1565
    msb := byteOrder ~~ #lsb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1566
    values := Array basicNew:n.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1567
    (n == 1) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1568
        val := isSigned ifTrue:[inStream nextInt64MSB:msb] ifFalse:[inStream nextUnsignedInt64MSB:msb].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1569
        values at:1 put:val.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1570
    ] ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1571
        offset := inStream nextInt64MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1572
        oldPos := inStream position.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1573
        inStream position:offset.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1574
        1 to:n do:[:index |
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1575
            val := isSigned ifTrue:[inStream nextInt64MSB:msb] ifFalse:[inStream nextUnsignedInt64MSB:msb].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1576
            values at:index put:val
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1577
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1578
        inStream position:oldPos
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1579
    ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1580
    ^ values
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1581
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1582
    "Created: / 24-08-2017 / 22:01:26 / cg"
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1583
!
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  1584
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  1585
readLongs:nLongs signed:isSigned
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1586
    "read nLongs signed or unsigned long numbers (32bit) and return them in an array"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1587
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1588
    |oldPos offset values val msb 
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1589
     n "{ Class: SmallInteger }" |
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1590
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1591
    n := nLongs.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1592
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1593
    msb := byteOrder ~~ #lsb.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1594
    values := Array basicNew:n.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1595
    (n == 1) ifTrue:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1596
        val := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb].
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1597
        values at:1 put:val.
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1598
    ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1599
        offset := inStream nextInt32MSB:msb.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1600
        oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1601
        inStream position:offset.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1602
        1 to:n do:[:index |
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1603
            val := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb].
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1604
            values at:index put:val
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1605
        ].
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1606
        inStream position:oldPos
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1607
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1608
    ^ values
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1609
!
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1610
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  1611
readShorts:nShorts signed:isSigned
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1612
    "read nShorts signed or unsigned short numbers (16bit) and return them in an array"
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1613
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1614
    |oldPos offset values msb val1 val2
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1615
     n "{ Class: SmallInteger }" |
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1616
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1617
    n := nShorts.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1618
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1619
    msb := (byteOrder ~~ #lsb).
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1620
    values := Array basicNew:n.
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1621
    (n <= 2) ifTrue:[
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  1622
        isSigned ifTrue:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1623
            val1 := inStream nextInt16MSB:msb.
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1624
            val2 := inStream nextInt16MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1625
        ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1626
            val1 := inStream nextUnsignedInt16MSB:msb.
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1627
            val2 := inStream nextUnsignedInt16MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1628
        ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1629
        values at:1 put:val1.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1630
        (n == 2) ifTrue:[
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1631
            values at:2 put:val2
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1632
        ]
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1633
    ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1634
        offset := inStream nextInt32MSB:msb.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1635
        oldPos := inStream position.
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1636
        inStream position:offset.
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1637
        1 to:n do:[:index |
1838
2476baed377c make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents: 1830
diff changeset
  1638
            isSigned ifTrue:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1639
                val1 := inStream nextInt16MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1640
            ] ifFalse:[
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  1641
                val1 := inStream nextUnsignedInt16MSB:msb.
1829
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1642
            ].
af94d3366af3 tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1643
            values at:index put:val1
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1644
        ].
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1645
        inStream position:oldPos
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1646
    ].
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1647
    ^ values
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1648
! !
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  1649
1762
55cf76514c8c method category rename
Claus Gittinger <cg@exept.de>
parents: 1759
diff changeset
  1650
!TIFFReader methodsFor:'private-writing'!
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1651
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1652
writeBitsPerSample
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  1653
"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1654
'bitsPerSample: ' print. bitsPerSample printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1655
'store bitspersample at: ' print. outStream position printNewline.
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  1656
"
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1657
    bitsPerSamplePos := outStream position.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1658
    bitsPerSample do:[:n |
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1659
        self writeShort:n
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1660
    ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1661
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1662
3f9277473954 Initial revision
claus
parents:
diff changeset
  1663
writeColorMap
28
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1664
    |n|
8daff0234d2e *** empty log message ***
claus
parents: 25
diff changeset
  1665
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1666
    colorMapPos := outStream position.
35
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1667
    #(red green blue) do:[:component |
440
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1668
        n := 0.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1669
        colorMap do:[:clr |
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1670
            |entry|
35
f13cdd0b44c7 *** empty log message ***
claus
parents: 32
diff changeset
  1671
440
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1672
            clr isNil ifTrue:[
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1673
                entry := 0
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1674
            ] ifFalse:[
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1675
                entry := clr perform:component.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1676
                "
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1677
                 tiff map is 16 bit - scale from percent to 0..16rFFFF
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1678
                "
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1679
                entry := (entry * 16rFFFF / 100) rounded.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1680
            ].
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1681
            self writeShort:entry.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1682
            n := n + 1
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1683
        ].
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1684
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1685
        "
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1686
         fill to 256 entries
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1687
        "
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1688
        [n < 256] whileTrue:[
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1689
            self writeShort:0.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1690
            n := n + 1.
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1691
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1692
    ]
440
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1693
fa1e1a56ea43 category rename
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1694
    "Modified: 20.2.1997 / 18:06:10 / cg"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1695
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1696
3f9277473954 Initial revision
claus
parents:
diff changeset
  1697
writeStripByteCounts
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  1698
"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1699
'stripByteCounts: ' print. stripByteCounts printNewline.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1700
'store stripbytecounts at: ' print. outStream position printNewline.
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  1701
"
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1702
    stripByteCountsPos := outStream position.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1703
    stripByteCounts do:[:c |
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1704
        self writeShort:c
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1705
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
  1706
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1707
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1708
writeStripOffsets
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  1709
"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1710
'stripOffsets: ' print. stripOffsets printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1711
'store stripoffsets at: ' print. outStream position printNewline.
3
78aaa5408119 *** empty log message ***
claus
parents: 0
diff changeset
  1712
"
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  1713
    stripOffsetsPos := outStream position.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1714
    stripOffsets do:[:o |
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1715
        self writeLong:o
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1716
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
  1717
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1718
3f9277473954 Initial revision
claus
parents:
diff changeset
  1719
writeTag:tagType
3f9277473954 Initial revision
claus
parents:
diff changeset
  1720
    self writeTiffTag:tagType.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1721
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1722
3f9277473954 Initial revision
claus
parents:
diff changeset
  1723
writeTiffTag:tagType
3f9277473954 Initial revision
claus
parents:
diff changeset
  1724
    |value valueArray numberType count address|
3f9277473954 Initial revision
claus
parents:
diff changeset
  1725
3f9277473954 Initial revision
claus
parents:
diff changeset
  1726
    count := 1.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1727
    address := nil.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1728
    (tagType == 253) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1729
        "tiff class"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1730
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1731
    (tagType == 254) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1732
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1733
    (tagType == 255) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1734
        "SubfileType"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1735
        value := subFileType.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1736
        numberType := #long.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1737
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1738
    (tagType == 256) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1739
        "ImageWidth"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1740
        value := width.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1741
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1742
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1743
    (tagType == 257) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1744
        "ImageHeight"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1745
        value := height.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1746
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1747
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1748
    (tagType == 258) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1749
        "bitspersample"
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1750
        address := bitsPerSamplePos.
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1751
        numberType := #short.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1752
        count := bitsPerSample size.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1753
        valueArray := bitsPerSample
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1754
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1755
    (tagType == 259) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1756
        "compression"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1757
        value := compression.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1758
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1759
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1760
    (tagType == 262) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1761
        "photometric"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1762
        (photometric == #whiteIs0) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1763
            value := 0
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1764
        ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1765
            (photometric == #blackIs0) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1766
                value := 1
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1767
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1768
                (photometric == #rgb) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1769
                    value := 2
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1770
                ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1771
                    (photometric == #palette) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1772
                        value := 3
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1773
                    ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1774
                        (photometric == #transparency) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1775
                            value := 4
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1776
                        ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1777
                            self error:'bad photometric' mayProceed:true.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1778
                        ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1779
                    ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1780
                ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1781
            ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1782
        ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1783
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1784
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1785
    (tagType == 263) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1786
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1787
    (tagType == 264) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1788
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1789
    (tagType == 265) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1790
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1791
    (tagType == 266) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1792
        "fillOrder"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1793
        (fillOrder == #msb) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1794
            value := 1
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1795
        ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1796
            (fillOrder == #lsb) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1797
                value := 2
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1798
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1799
                self error:'bad fillOrder' mayProceed:true
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1800
            ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1801
        ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1802
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1803
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1804
    (tagType == 269) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1805
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1806
    (tagType == 270) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1807
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1808
    (tagType == 271) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1809
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1810
    (tagType == 272) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1811
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1812
    (tagType == 273) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1813
        "stripoffsets"
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1814
        address := stripOffsetsPos.
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1815
        numberType := #long.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1816
        count := stripOffsets size.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1817
        valueArray := stripOffsets
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1818
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1819
    (tagType == 274) ifTrue:[
3f9277473954 Initial revision
claus
parents:
diff changeset
  1820
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1821
    (tagType == 277) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1822
        "samplesPerPixel"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1823
        value := samplesPerPixel.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1824
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1825
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1826
    (tagType == 278) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1827
        "rowsperstrip"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1828
        value := rowsPerStrip.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1829
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1830
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1831
    (tagType == 279) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1832
        "stripbytecount"
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1833
        address := stripByteCountsPos.
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1834
        numberType := #short.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1835
        count := stripByteCounts size.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1836
        valueArray := stripByteCounts
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1837
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1838
    (tagType == 280) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1839
        "min sample value"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1840
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1841
    (tagType == 281) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1842
        "max sample value"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1843
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1844
    (tagType == 282) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1845
        "x resolution"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1846
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1847
    (tagType == 283) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1848
        "y resolution"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1849
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1850
    (tagType == 284) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1851
        "planarconfig"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1852
        value := planarConfiguration.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1853
        numberType := #short.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1854
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1855
    (tagType == 285) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1856
        "pageName"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1857
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1858
    (tagType == 286) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1859
        "xPosition"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1860
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1861
    (tagType == 287) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1862
        "yPosition"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1863
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1864
    (tagType == 288) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1865
        "freeOffsets"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1866
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1867
    (tagType == 289) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1868
        "freeByteCounts"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1869
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1870
    (tagType == 290) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1871
        "grayResponceUnit"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1872
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1873
    (tagType == 291) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1874
        "grayResponceCurve"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1875
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1876
    (tagType == 292) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1877
        "group3options"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1878
        value := group3options.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1879
        numberType := #long.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1880
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1881
    (tagType == 293) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1882
        "group4options"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1883
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1884
    (tagType == 296) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1885
        "resolutionunit"
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1886
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1887
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1888
    (tagType == 297) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1889
        "pageNumber"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1890
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1891
    (tagType == 300) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1892
        "colorResponceUnit"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1893
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1894
    (tagType == 301) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1895
        "colorResponceCurve"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1896
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1897
    (tagType == 306) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1898
        "dateTime"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1899
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1900
    (tagType == 315) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1901
        "artist"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1902
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1903
    (tagType == 317) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1904
        "predictor"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1905
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1906
    (tagType == 320) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1907
        "colormap"
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1908
        address := colorMapPos.
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1909
        numberType := #short.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1910
        count := 256 "(colorMap at:1) size" * 3.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1911
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1912
3f9277473954 Initial revision
claus
parents:
diff changeset
  1913
    (value isNil and:[address isNil]) ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1914
        self error:'unhandled tag' mayProceed:true.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1915
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1916
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1917
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  1918
"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1919
'tag:' print. tagType print. ' typ:' print. numberType print.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1920
' len:' print. count print.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1921
' val:' print. value printNewline.  
14
20638e830834 *** empty log message ***
claus
parents: 11
diff changeset
  1922
"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1923
3f9277473954 Initial revision
claus
parents:
diff changeset
  1924
    self writeShort:tagType.
3f9277473954 Initial revision
claus
parents:
diff changeset
  1925
    numberType == #short ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1926
        self writeShort:3.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1927
        self writeLong:count.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1928
    ] ifFalse:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1929
        numberType == #long ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1930
            self writeShort:4.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1931
            self writeLong:count.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1932
        ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1933
            numberType == #byte ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1934
                self writeShort:1.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1935
                self writeLong:count.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1936
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1937
                self error:'bad numbertype'
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1938
            ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1939
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1940
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1941
    address notNil ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1942
        (numberType == #long and:[count == 1]) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1943
            self writeLong:(valueArray at:1).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1944
            ^ self
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1945
        ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1946
        (numberType == #short and:[count <= 2]) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1947
            self writeShort:(valueArray at:1).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1948
            count == 2 ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1949
                self writeShort:(valueArray at:2).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1950
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1951
                self writeShort:0
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1952
            ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1953
            ^ self
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1954
        ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1955
        (numberType == #byte and:[count <= 4]) ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1956
            outStream nextPut:(valueArray at:1).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1957
            count > 1 ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1958
                outStream nextPut:(valueArray at:2).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1959
                count > 2 ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1960
                    outStream nextPut:(valueArray at:3).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1961
                    count > 3 ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1962
                        outStream nextPut:(valueArray at:4).
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1963
                    ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1964
                        outStream nextPut:0
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1965
                    ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1966
                ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1967
                    outStream nextPut:0
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1968
                ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1969
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1970
                outStream nextPut:0
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1971
            ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1972
            ^ self
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1973
        ].
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1974
        self writeLong:address.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1975
        ^ self
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1976
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1977
    numberType == #short ifTrue:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1978
        self writeShort:value.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1979
        self writeShort:0
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1980
    ] ifFalse:[
1215
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1981
        numberType == #long ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1982
            self writeLong:value
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1983
        ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1984
            numberType == #byte ifTrue:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1985
                outStream nextPut:value.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1986
                outStream nextPut:0.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1987
                outStream nextPut:0.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1988
                outStream nextPut:0.
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1989
            ] ifFalse:[
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1990
                self error:'bad numbertype'
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1991
            ]
e40392a58092 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  1992
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  1993
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  1994
!
3f9277473954 Initial revision
claus
parents:
diff changeset
  1995
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1996
writeUncompressedBits
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1997
    "write bits as one or multiple strips"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1998
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  1999
    |offs bytesPerRow nBytes
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2000
     h "{ Class: SmallInteger }"|
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2001
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2002
    nBytes := data size.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2003
    nBytes < 16rFFFF ifTrue:[
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2004
        stripOffsets := Array with:(outStream position).
1703
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2005
        stripByteCounts := Array with:nBytes.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2006
        outStream nextPutBytes:nBytes from:data.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2007
        rowsPerStrip := height
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2008
    ] ifFalse:[
1703
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2009
        stripOffsets := Array basicNew:height.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2010
        bytesPerRow := nBytes // height.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2011
        stripByteCounts := (Array basicNew:height) atAllPut:bytesPerRow.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2012
1703
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2013
        offs := 1.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2014
        h := height.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2015
        1 to:h do:[:row |
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2016
            stripOffsets at:row put:(outStream position).
1703
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2017
            outStream nextPutBytes:bytesPerRow from:data startingAt:offs.
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2018
            offs := offs + bytesPerRow
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2019
        ].
5a08db3f0013 prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  2020
        rowsPerStrip := 1
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2021
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2022
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2023
    'stripOffsets: ' print. stripOffsets printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2024
    'stripByteCounts: ' print. stripByteCounts printNewline.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2025
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2026
! !
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2027
1805
93f557cbe600 category changes
Claus Gittinger <cg@exept.de>
parents: 1785
diff changeset
  2028
!TIFFReader methodsFor:'reading'!
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2029
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2030
fromStream:aStream
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2031
    "read a stream containing a TIFF image.
3899
fd43372bf11d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3777
diff changeset
  2032
     Leave image description in instance variables.
fd43372bf11d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3777
diff changeset
  2033
     (i.e. to get the image, ask with image)."
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2034
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2035
    |char1 char2 version 
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2036
     numberOfTags "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2037
     tagType      "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2038
     numberType   "{ Class: SmallInteger }"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2039
     length       "{ Class: SmallInteger }"
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2040
     result offset msb
918
64336276b146 unused local
tz
parents: 814
diff changeset
  2041
     bytesPerRow offset1 offset2 tmp|
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2042
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2043
    inStream := aStream.
331
304f9c439efa allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
  2044
    aStream binary.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2045
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2046
    char1 := aStream next.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2047
    char2 := aStream next.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2048
    (char1 ~~ char2) ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2049
        ^ self fileFormatError:'not a tiff file'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2050
    ].
1953
90f3c42ef3c1 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1846
diff changeset
  2051
    (char1 == $I codePoint) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2052
        byteOrder := #lsb.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2053
        msb := false.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2054
    ] ifFalse:[
1953
90f3c42ef3c1 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1846
diff changeset
  2055
        (char1 == $M codePoint) ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2056
            byteOrder := #msb.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2057
            msb := true.
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2058
        ] ifFalse:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2059
            ^ self fileFormatError:'not a tiff file'.
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2060
        ]
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2061
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2062
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2063
    version := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2064
    (version == 42) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2065
        offset := aStream nextUnsignedInt32MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2066
        aStream position:offset.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2067
    ] ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2068
       (version == 43) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2069
            |byteSizeOfOffsets always0|
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2070
            
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2071
            "/ 43 is the proposed bigtiff format
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2072
            byteSizeOfOffsets := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2073
            byteSizeOfOffsets == 8 ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2074
                ^ self fileFormatError:'version of bigtiff-file not supported'.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2075
            ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2076
            always0 := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2077
            always0 == 8 ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2078
                ^ self fileFormatError:'version of bigtiff-file not supported'.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2079
            ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2080
            offset := aStream nextUnsignedInt64MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2081
            aStream position:offset.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2082
        ] ifFalse:[    
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2083
            ^ self fileFormatError:'version of tiff-file not supported'.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2084
        ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2085
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2086
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2087
    "setup default values"
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
  2088
    metaData := TIFFMetaData new.
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
  2089
    
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2090
    compression := 1. "none"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2091
    fillOrder := #msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2092
    planarConfiguration := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2093
    photometric := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2094
    bitsPerSample := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2095
    samplesPerPixel := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2096
    width := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2097
    height := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2098
    stripOffsets := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2099
    rowsPerStrip := nil.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2100
    "resolutionUnit := 2."
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2101
    predictor := 1.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  2102
    orientation := nil.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2103
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2104
    (version == 42) ifTrue:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2105
        numberOfTags := aStream nextUnsignedInt16MSB:msb.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2106
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2107
        1 to:numberOfTags do:[:index |
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2108
            tagType := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2109
            numberType := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2110
            length := aStream nextInt32MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2111
            self decodeTiffTag:tagType numberType:numberType length:length
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2112
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2113
        offset := aStream nextInt32MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2114
    ] ifFalse:[
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2115
        numberOfTags := aStream nextUnsignedInt64MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2116
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2117
        1 to:numberOfTags do:[:index |
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2118
            tagType := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2119
            numberType := aStream nextUnsignedInt16MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2120
            length := aStream nextInt64MSB:msb.
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2121
            self decodeTiffTag:tagType numberType:numberType length:length
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2122
        ].
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2123
        offset := aStream nextInt32MSB:msb.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2124
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2125
    (offset ~~ 0) ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2126
        'TIFFReader [info]: more tags ignored' infoPrintCR
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2127
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2128
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2129
    "check for required tags"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2130
    width isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2131
        ^ self fileFormatError:'missing width tag'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2132
    ].
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2133
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2134
    height isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2135
        ^ self fileFormatError:'missing length tag'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2136
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2137
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2138
    photometric isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2139
        ^ self fileFormatError:'missing photometric tag'.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2140
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2141
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2142
    stripOffsets isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2143
        ^ self fileFormatError:'missing stripOffsets tag'.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2144
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2145
3f9277473954 Initial revision
claus
parents:
diff changeset
  2146
    stripByteCounts isNil ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2147
        stripOffsets size == 1 ifTrue:[
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2148
            stripByteCounts := Array with:(self bitsPerPixel // 8) * width * height
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2149
        ]
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2150
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2151
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2152
    stripByteCounts isNil ifTrue:[
814
6240dfc2fd3b use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  2153
        ^ self fileFormatError:'missing stripByteCounts tag'.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2154
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2155
1846
d29322944b05 dimensionReport
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2156
    self reportDimension.
334
1da7672635be dimensionCallBack
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
  2157
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2158
    "given all the information, read the bits"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2159
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2160
    rowsPerStrip isNil ifTrue:[
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2161
        rowsPerStrip := height
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2162
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2163
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2164
    result := self readTiffImageData.
743
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2165
    result isNil ifTrue:[
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2166
        "/ unsupported format.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2167
        ^ nil
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2168
    ].
516
76ffe180cff8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
  2169
743
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2170
    orientation == #vFlip ifTrue:[
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2171
        "/ reverse rows to top-to bottom
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  2172
743
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2173
        bytesPerRow := self bytesPerRow.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2174
        tmp := ByteArray new:bytesPerRow.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2175
        offset1 := 1.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2176
        offset2 := (height-1)*bytesPerRow + 1.
3693
0b4a3090f2a8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3610
diff changeset
  2177
        0 to:((height-1)//2) do:[:row |
743
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2178
            tmp replaceFrom:1 to:bytesPerRow
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2179
                with:data startingAt:offset1.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2180
            data replaceFrom:offset1 to:offset1+bytesPerRow-1
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2181
                 with:data startingAt:offset2.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2182
            data replaceFrom:offset2 to:offset2+bytesPerRow-1
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2183
                 with:tmp startingAt:1.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2184
            offset1 := offset1 + bytesPerRow.
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2185
            offset2 := offset2 - bytesPerRow.
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  2186
        ].
743
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2187
    ].
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2188
    orientation == #unsupported ifTrue:[
43be299fc515 return nil for unsupported formats.
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
  2189
        'TIFFReader [warning]: unsupported orientation' errorPrintCR
393
9e9f2272b524 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2190
    ].
392
7729a280960c handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  2191
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2192
    ^ result
192
947cc10f86dc commentary
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
  2193
3974
b4f7c8442dd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3957
diff changeset
  2194
    "Modified: / 24-08-2017 / 22:07:23 / cg"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2195
! !
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2196
1805
93f557cbe600 category changes
Claus Gittinger <cg@exept.de>
parents: 1785
diff changeset
  2197
!TIFFReader methodsFor:'writing'!
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2198
1571
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2199
save:image onStream:aStream
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2200
    "save image as (uncompressed) TIFF file on aFileName"
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2201
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2202
    |pos1 pos indicator|
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2203
1078
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2204
    image mask notNil ifTrue:[
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2205
        Image informationLostQuerySignal
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2206
            raiseWith:image
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2207
            errorString:('TIFF writer does not (yet) support an imageMask').
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2208
    ].
fc33e172bbbc raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  2209
1571
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2210
    outStream := aStream.
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2211
    outStream binary.
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2212
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2213
    "save as msb"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2214
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2215
    byteOrder := #msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2216
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2217
    byteOrder := #lsb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2218
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2219
    fillOrder := #msb.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2220
    width := image width.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2221
    height := image height.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2222
    photometric := image photometric.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2223
    samplesPerPixel := image samplesPerPixel.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2224
    bitsPerSample := image bitsPerSample.
1785
16917d309b46 oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2225
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2226
    colorMap := image colorMap.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2227
    planarConfiguration := 1.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2228
    compression := 1.   "none"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2229
    data := image bits.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2230
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2231
    currentOffset := 0.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2232
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2233
    (byteOrder == #msb) ifTrue:[
1953
90f3c42ef3c1 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1846
diff changeset
  2234
        indicator := $M codePoint.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2235
    ] ifFalse:[
1953
90f3c42ef3c1 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1846
diff changeset
  2236
        indicator := $I codePoint.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2237
    ].
1571
cffaf89a0c6e New: #save:onStream
Stefan Vogel <sv@exept.de>
parents: 1230
diff changeset
  2238
    outStream nextPut:indicator; nextPut:indicator.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2239
    currentOffset := currentOffset + 2.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2240
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2241
    self writeShort:42.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2242
    currentOffset := currentOffset + 2.
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2243
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2244
    pos1 := outStream position.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2245
    self writeLong:0.           "start of tags - filled in later"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2246
    currentOffset := currentOffset + 4.
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2247
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2248
    "output strips"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2249
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2250
    self writeUncompressedBits. "this outputs bits as strips, sets stripOffsets and stripByteCounts"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2251
    self writeStripOffsets.     "this outputs strip offsets, sets stripOffsetsPos"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2252
    self writeStripByteCounts.  "this outputs strip bytecounts, sets stripByteCountPos"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2253
    self writeBitsPerSample.    "this outputs bitsPerSample, sets bitsPerSamplePos"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2254
    photometric == #palette ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2255
        self writeColorMap      "this outputs colorMap, sets colorMapPos"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2256
    ].
3f9277473954 Initial revision
claus
parents:
diff changeset
  2257
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2258
    pos := outStream position.        "backpatch tag offset"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2259
    outStream position:pos1.
1704
1526c7b84920 code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1703
diff changeset
  2260
    self writeLong:pos.                     "fill in tag offset"
3211
6d43ccc9adc4 class: TIFFReader
Stefan Vogel <sv@exept.de>
parents: 3112
diff changeset
  2261
    outStream position:pos.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2262
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2263
('patch tag offset at: ', (pos1 printStringRadix:16) , ' to ',
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2264
                         (pos printStringRadix:16)) printNewline.
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2265
"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2266
    "output tag data"
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2267
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2268
    photometric == #palette ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2269
        self writeShort:11.  "11 tags"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2270
    ] ifFalse:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2271
        self writeShort:10.  "10 tags"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2272
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2273
    self writeTag:256.               "image width"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2274
    self writeTag:257.               "image height"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2275
    self writeTag:258.               "bits per sample"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2276
    self writeTag:259.               "compression"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2277
    self writeTag:262.               "photometric"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2278
    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
  2279
    self writeTag:277.               "samplesPerPixel"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2280
    self writeTag:278.               "rowsPerStrip"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2281
    self writeTag:279.               "strip byte counts"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2282
    self writeTag:284.               "planarconfig"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2283
    photometric == #palette ifTrue:[
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2284
        self writeTag:320            "colorMap"
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2285
    ].
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2286
    self writeLong:0.                "end of tags mark"
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2287
! !
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
  2288
357
4bcb93f5892e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
  2289
!TIFFReader class methodsFor:'documentation'!
30
9638bc775850 *** empty log message ***
claus
parents: 28
diff changeset
  2290
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2291
version
3552
ef88cdf452d1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  2292
    ^ '$Header$'
0
3f9277473954 Initial revision
claus
parents:
diff changeset
  2293
! !
1702
75a595a70c86 stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  2294
3112
d6fbee4954ca class: TIFFReader
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2295
135
ff507d9a242b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 117
diff changeset
  2296
TIFFReader initialize!