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