TargaReader.st
author tz
Mon, 11 May 1998 22:50:54 +0200
changeset 918 64336276b146
parent 815 5fe6cac83186
child 1065 32a68620ddab
permissions -rw-r--r--
unused local
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
     1
"
aeed5856f457 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
aeed5856f457 Initial revision
claus
parents:
diff changeset
     3
	      All Rights Reserved
aeed5856f457 Initial revision
claus
parents:
diff changeset
     4
aeed5856f457 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
aeed5856f457 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
aeed5856f457 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
aeed5856f457 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
aeed5856f457 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
aeed5856f457 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
aeed5856f457 Initial revision
claus
parents:
diff changeset
    11
"
aeed5856f457 Initial revision
claus
parents:
diff changeset
    12
aeed5856f457 Initial revision
claus
parents:
diff changeset
    13
ImageReader subclass:#TargaReader
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
    14
	instanceVariableNames:'orientation'
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    15
	classVariableNames:''
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    16
	poolDictionaries:''
259
62b1bbafd9ba category change
Claus Gittinger <cg@exept.de>
parents: 234
diff changeset
    17
	category:'Graphics-Images-Support'
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    18
!
aeed5856f457 Initial revision
claus
parents:
diff changeset
    19
aeed5856f457 Initial revision
claus
parents:
diff changeset
    20
!TargaReader class methodsFor:'documentation'!
aeed5856f457 Initial revision
claus
parents:
diff changeset
    21
aeed5856f457 Initial revision
claus
parents:
diff changeset
    22
copyright
aeed5856f457 Initial revision
claus
parents:
diff changeset
    23
"
aeed5856f457 Initial revision
claus
parents:
diff changeset
    24
 COPYRIGHT (c) 1994 by Claus Gittinger
aeed5856f457 Initial revision
claus
parents:
diff changeset
    25
	      All Rights Reserved
aeed5856f457 Initial revision
claus
parents:
diff changeset
    26
aeed5856f457 Initial revision
claus
parents:
diff changeset
    27
 This software is furnished under a license and may be used
aeed5856f457 Initial revision
claus
parents:
diff changeset
    28
 only in accordance with the terms of that license and with the
aeed5856f457 Initial revision
claus
parents:
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
aeed5856f457 Initial revision
claus
parents:
diff changeset
    30
 be provided or otherwise made available to, or used by, any
aeed5856f457 Initial revision
claus
parents:
diff changeset
    31
 other person.  No title to or ownership of the software is
aeed5856f457 Initial revision
claus
parents:
diff changeset
    32
 hereby transferred.
aeed5856f457 Initial revision
claus
parents:
diff changeset
    33
"
aeed5856f457 Initial revision
claus
parents:
diff changeset
    34
!
aeed5856f457 Initial revision
claus
parents:
diff changeset
    35
aeed5856f457 Initial revision
claus
parents:
diff changeset
    36
documentation
aeed5856f457 Initial revision
claus
parents:
diff changeset
    37
"
aeed5856f457 Initial revision
claus
parents:
diff changeset
    38
    this class provides methods for loading targa-file (tga) images.
556
a2d03470af59 documentation
Claus Gittinger <cg@exept.de>
parents: 555
diff changeset
    39
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    40
    Limitations: 
556
a2d03470af59 documentation
Claus Gittinger <cg@exept.de>
parents: 555
diff changeset
    41
        not fully tested (I only had a few targa files to check things)
a2d03470af59 documentation
Claus Gittinger <cg@exept.de>
parents: 555
diff changeset
    42
        only supports 8,24 and 32 bits/pixel formats; alpha channel is ignored
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    43
        Image saving not supported
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    44
aeed5856f457 Initial revision
claus
parents:
diff changeset
    45
    I had two tga files to test this code with - it may not work with
556
a2d03470af59 documentation
Claus Gittinger <cg@exept.de>
parents: 555
diff changeset
    46
    other targa files (it certainly does not work with 1/16 bit images).
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
    47
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    48
    Suggestions: adapt & use the pbmplus library here.
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    49
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    50
    [See also:]
234
b6352d13e792 xrefs in documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    51
        Image Form Icon
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    52
        BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader 
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    53
        ST80FormReader SunRasterReader TIFFReader WindowsIconReader 
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    54
        XBMReader XPMReader XWDReader
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    55
"
aeed5856f457 Initial revision
claus
parents:
diff changeset
    56
! !
aeed5856f457 Initial revision
claus
parents:
diff changeset
    57
aeed5856f457 Initial revision
claus
parents:
diff changeset
    58
!TargaReader class methodsFor:'initialization'!
aeed5856f457 Initial revision
claus
parents:
diff changeset
    59
aeed5856f457 Initial revision
claus
parents:
diff changeset
    60
initialize
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    61
    "tell Image-class, that a new fileReader is present
398
aef700d15416 new suffix-table
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    62
     for the '.tga' extension."
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    63
647
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    64
    MIMETypes defineImageType:'image/x-targa' suffix:'tga' reader:self.
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    65
630
48657c687a8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
    66
    "Modified: 27.6.1997 / 18:39:43 / cg"
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    67
! !
aeed5856f457 Initial revision
claus
parents:
diff changeset
    68
aeed5856f457 Initial revision
claus
parents:
diff changeset
    69
!TargaReader class methodsFor:'testing'!
aeed5856f457 Initial revision
claus
parents:
diff changeset
    70
aeed5856f457 Initial revision
claus
parents:
diff changeset
    71
isValidImageFile:aFileName
aeed5856f457 Initial revision
claus
parents:
diff changeset
    72
    "return true, if aFileName contains a targa-file image"
aeed5856f457 Initial revision
claus
parents:
diff changeset
    73
43
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
    74
    |aStream w h depth flags|
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    75
43
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
    76
    aStream := self streamReadingFile:aFileName.
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
    77
    aStream isNil ifTrue:[^ false].
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
    78
    aStream binary.
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
    79
    aStream skip:12.   "/ skip 12 bytes
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    80
43
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
    81
    w := aStream nextShortMSB:false.
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
    82
    h := aStream nextShortMSB:false.
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    83
43
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
    84
    depth := aStream next.
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
    85
    flags := aStream next.
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    86
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
    87
    (#(8 "16" 24 32) includes:depth) ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
    88
        aStream close. ^ false
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    89
    ].
aeed5856f457 Initial revision
claus
parents:
diff changeset
    90
43
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
    91
    aStream close. 
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
    92
    ^ true
aeed5856f457 Initial revision
claus
parents:
diff changeset
    93
aeed5856f457 Initial revision
claus
parents:
diff changeset
    94
    "
aeed5856f457 Initial revision
claus
parents:
diff changeset
    95
     TargaReader isValidImageFile:'bitmaps/test.tga'    
aeed5856f457 Initial revision
claus
parents:
diff changeset
    96
     TargaReader isValidImageFile:'bitmaps/garfield.gif'  
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
    97
    "
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
    98
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
    99
    "Modified: 21.4.1997 / 20:46:52 / cg"
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   100
! !
aeed5856f457 Initial revision
claus
parents:
diff changeset
   101
aeed5856f457 Initial revision
claus
parents:
diff changeset
   102
!TargaReader methodsFor:'reading from file'!
aeed5856f457 Initial revision
claus
parents:
diff changeset
   103
43
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
   104
fromStream:aStream
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   105
    "read a targa-image from aFileName. return the receiver (with all
aeed5856f457 Initial revision
claus
parents:
diff changeset
   106
     relevant instance variables set for the image) or nil on error"
aeed5856f457 Initial revision
claus
parents:
diff changeset
   107
918
64336276b146 unused local
tz
parents: 815
diff changeset
   108
    |depth flags lenID hasColorMap imageType 
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   109
     cmapOffset cmapLength cmapEntrySize xOrg yOrg
918
64336276b146 unused local
tz
parents: 815
diff changeset
   110
     t bytesPerPixel bytesPerRow rowIdx startIdx endIdx rle|
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   111
43
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
   112
    inStream := aStream.
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
   113
    aStream binary.
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
   114
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   115
    lenID := aStream next.
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   116
    hasColorMap := aStream next.
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   117
    imageType := aStream next.
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   118
    cmapOffset := aStream nextShortMSB:false.
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   119
    cmapLength := aStream nextShortMSB:false.
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   120
    cmapEntrySize := aStream next.
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   121
    xOrg := aStream nextShortMSB:false.
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   122
    yOrg := aStream nextShortMSB:false.
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   123
43
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
   124
    width := aStream nextShortMSB:false.
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
   125
    height := aStream nextShortMSB:false.
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
   126
    depth := aStream next.
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   127
    (#(8 "16" 24 32) includes:depth) ifFalse:[
815
5fe6cac83186 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   128
        ^ self fileFormatError:('unsupported depth: ', depth printString).
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   129
    ].
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   130
    depth == 32 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   131
        'TargaReader [info]: alpha channel ignored' infoPrintCR.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   132
    ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   133
        'TargaReader [info]: depth: ' infoPrint. depth infoPrintCR.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   134
    ].
551
7e0fb2e4f214 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   135
7e0fb2e4f214 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   136
    "/ MapRGB == 1
7e0fb2e4f214 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   137
    "/ RawRGB == 2
7e0fb2e4f214 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   138
    "/ RawMono == 3
7e0fb2e4f214 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   139
    "/ MapEnCode == 9
7e0fb2e4f214 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   140
    "/ RawEnCode == 10
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   141
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   142
    (#(1 2 9 10) includes:imageType) ifFalse:[
551
7e0fb2e4f214 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   143
        'TargaReader [warning]: unsupported imageType: ' errorPrint. imageType errorPrintCR.
7e0fb2e4f214 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   144
    ].
7e0fb2e4f214 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   145
    'TargaReader [info]: imageType: ' infoPrint. imageType infoPrintCR.
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   146
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   147
    "/ flags:
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   148
    "/    0000 xxxx  attribute-bits-per-pixel
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   149
    "/    0000 0001  greysc
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   150
    "/    0000 0010  colour
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   151
    "/    0000 0011  mapped
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   152
    "/    0000 0100  rleEncoded
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   153
    "/    0000 1000  interlaced
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   154
    "/    00xx 0000  origin (0 -> lower-left / 1 -> l-r / 2 -> u-l / 3 -> u-r)
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   155
    "/    xx00 0000  interleave (0 -> none / 1 -> odd/even / 2 ->4-fould / 3 reserved)
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   156
    "/
43
e85c7d392833 *** empty log message ***
claus
parents: 37
diff changeset
   157
    flags := aStream next.
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   158
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   159
    (flags bitAnd:2r11000000) ~~ 0 ifTrue:[
815
5fe6cac83186 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   160
        ^ self fileFormatError:('unsupported interlace: ' , flags printString).
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   161
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   162
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   163
    rle := flags bitTest:2r000001000.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   164
    flags := flags bitAnd:2r111110111.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   165
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   166
    (flags bitAnd:2r00001111) ~~ 0 ifTrue:[
815
5fe6cac83186 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   167
        ^ self fileFormatError:('unsupported flags: ' , flags printString).
551
7e0fb2e4f214 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   168
    ].
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   169
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   170
    (flags bitAnd:2r00110000) == 16r20 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   171
        orientation := #topLeft
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   172
    ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   173
        (flags bitAnd:2r00110000) == 16r30 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   174
            orientation := #topRight
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   175
        ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   176
            (flags bitAnd:2r00110000) == 16r10 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   177
                orientation := #bottomRight
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   178
            ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   179
                (flags bitAnd:2r00110000) == 0 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   180
                    orientation := #bottomLeft
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   181
                ]
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   182
            ]
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   183
        ]
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   184
    ].
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   185
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   186
    lenID ~~ 0 ifTrue:[
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   187
        aStream skip:lenID
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   188
    ].
aeed5856f457 Initial revision
claus
parents:
diff changeset
   189
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   190
    hasColorMap ~~ 0 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   191
        "/ read the colorMap
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   192
        colorMap := Array new:cmapLength.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   193
        1 to:cmapLength do:[:index |
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   194
            |r g b|
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   195
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   196
            b := aStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   197
            g := aStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   198
            r := aStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   199
            colorMap at:index put:(Color redByte:r greenByte:g blueByte:b).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   200
        ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   201
        'TargaReader [info]: has colorMap' infoPrintCR.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   202
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   203
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   204
    depth == 32 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   205
        imageType == 2 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   206
"/            rle ifTrue:[self halt].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   207
            self read32.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   208
        ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   209
"/            rle ifFalse:[self halt].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   210
            self read32RLE.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   211
        ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   212
        bytesPerRow := width*3.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   213
        bytesPerPixel := 3.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   214
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   215
    depth == 24 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   216
        imageType == 2 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   217
"/            rle ifTrue:[self halt].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   218
            self read24.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   219
        ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   220
"/            rle ifFalse:[self halt].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   221
            self read24RLE.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   222
        ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   223
        bytesPerRow := width*3.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   224
        bytesPerPixel := 3.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   225
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   226
    depth == 8 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   227
        imageType == 1 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   228
"/            rle ifTrue:[self halt].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   229
            self read8.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   230
        ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   231
"/            rle ifFalse:[self halt].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   232
            self read8RLE
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   233
        ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   234
        bytesPerRow := width.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   235
        bytesPerPixel := 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   236
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   237
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   238
    orientation == #topLeft ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   239
    ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   240
        orientation == #topRight ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   241
            "/ flip horizontal
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   242
            rowIdx := 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   243
            1 to:height do:[:row |
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   244
                startIdx := rowIdx.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   245
                endIdx := rowIdx + bytesPerRow - bytesPerPixel.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   246
                1 to:width//2 do:[:x |
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   247
                    0 to:bytesPerPixel-1 do:[:c |
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   248
                        t := data at:startIdx+c.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   249
                        data at:startIdx+c put:(data at:endIdx+c).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   250
                        data at:endIdx+c put:t.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   251
                    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   252
                    startIdx := startIdx + bytesPerPixel.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   253
                    endIdx := endIdx - bytesPerPixel.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   254
                ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   255
                rowIdx := rowIdx + width.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   256
            ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   257
        ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   258
            orientation == #bottomLeft ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   259
                "/ flip vertical
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   260
                startIdx := 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   261
                endIdx := 1 + ((height - 1) * bytesPerRow).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   262
                t := ByteArray new:bytesPerRow.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   263
                1 to:height//2 do:[:row |
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   264
                    t replaceFrom:1 to:bytesPerRow with:data startingAt:startIdx.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   265
                    data replaceFrom:startIdx to:startIdx+bytesPerRow-1 with:data startingAt:endIdx.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   266
                    data replaceFrom:endIdx to:endIdx+bytesPerRow-1 with:t startingAt:1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   267
                    startIdx := startIdx + bytesPerRow.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   268
                    endIdx := endIdx - bytesPerRow
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   269
                ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   270
            ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   271
                'TargaReader [warning]: unsupported orientation: ' errorPrint. orientation errorPrintCR.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   272
            ]
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   273
        ]
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   274
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   275
    ^ self
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   276
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   277
    "
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   278
     TargaReader fromFile:'bitmaps/test.tga' 
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   279
    "
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   280
815
5fe6cac83186 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   281
    "Modified: / 3.2.1998 / 18:18:16 / cg"
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   282
!
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   283
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   284
read24
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   285
    "read a 24 bit/pixel targa-image"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   286
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   287
    |nBytes ok dSize t|
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   288
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   289
    data := ByteArray new:(width * height * 3).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   290
    inStream nextBytes:(dSize := data size) into:data.
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   291
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   292
    "
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   293
     mhmh - pixel-byte order is blue-green-red
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   294
     swap blue & red bytes
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   295
    "
107
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
   296
    nBytes := data size.
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
   297
    ok := false.
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
   298
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
   299
%{  /* OPTIONAL */
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
   300
    if (__isByteArray(_INST(data))) {
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   301
        int __lastIndex = __intVal(nBytes) - 2;
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   302
        unsigned char *__cp = __ByteArrayInstPtr(_INST(data))->ba_element;
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   303
        int __i;
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   304
        unsigned char __t;
107
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
   305
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   306
        for (__i=0; __i<__lastIndex; __i+=3, __cp+=3) {
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   307
            __t = __cp[0];
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   308
            __cp[0] = __cp[2];
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   309
            __cp[2] = __t;
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   310
        }
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   311
        ok = true;
107
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
   312
    }
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
   313
%}.
Claus Gittinger <cg@exept.de>
parents: 96
diff changeset
   314
    ok ifFalse:[
299
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   315
        1 to:(dSize - 2) by:3 do:[:i |
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   316
            t := data at:i.
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   317
            data at:i put:(data at:i+2).
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   318
            data at:i+2 put:t
23d89531904f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   319
        ]
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   320
    ].
aeed5856f457 Initial revision
claus
parents:
diff changeset
   321
aeed5856f457 Initial revision
claus
parents:
diff changeset
   322
    photometric := #rgb.
aeed5856f457 Initial revision
claus
parents:
diff changeset
   323
    samplesPerPixel := 3.
aeed5856f457 Initial revision
claus
parents:
diff changeset
   324
    bitsPerSample := #(8 8 8).
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   325
!
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   326
555
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   327
read24RLE
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   328
    "read an 8 bit/pixel rle encoded targa-image"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   329
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   330
    |total count dstIndex code n r g b|
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   331
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   332
    data := ByteArray new:((total := width * height * 3)).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   333
    count := 0.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   334
    dstIndex := 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   335
    [count < total] whileTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   336
        code := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   337
        n := (code bitAnd:16r7F) + 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   338
        (code bitAnd:16r80) ~~ 0 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   339
            b := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   340
            g := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   341
            r := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   342
            n timesRepeat:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   343
                data at:dstIndex put:r.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   344
                data at:dstIndex+1 put:g.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   345
                data at:dstIndex+2 put:b.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   346
                dstIndex := dstIndex + 3
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   347
            ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   348
        ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   349
            n timesRepeat:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   350
                b := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   351
                g := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   352
                r := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   353
                data at:dstIndex put:r.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   354
                data at:dstIndex+1 put:g.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   355
                data at:dstIndex+2 put:b.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   356
                dstIndex := dstIndex + 3
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   357
            ]
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   358
        ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   359
        count := count + (n * 3).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   360
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   361
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   362
    photometric := #rgb.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   363
    samplesPerPixel := 3.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   364
    bitsPerSample := #(8 8 8).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   365
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   366
    "Modified: 21.4.1997 / 20:21:12 / cg"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   367
    "Created: 21.4.1997 / 20:43:23 / cg"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   368
!
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   369
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   370
read32
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   371
    "read a 32 bit/pixel targa-image; skip alpha channel (for now)"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   372
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   373
    |total dstIndex a r g b|
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   374
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   375
    data := ByteArray new:((total := width * height * 3)).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   376
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   377
    dstIndex := 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   378
    [total > 0] whileTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   379
        inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   380
        a := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   381
        b := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   382
        g := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   383
        r := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   384
        data at:dstIndex put:r.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   385
        data at:dstIndex+1 put:g.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   386
        data at:dstIndex+2 put:b.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   387
        dstIndex := dstIndex + 3.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   388
        total := total - 3.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   389
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   390
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   391
    photometric := #rgb.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   392
    samplesPerPixel := 3.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   393
    bitsPerSample := #(8 8 8).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   394
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   395
    "Modified: 21.4.1997 / 20:21:12 / cg"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   396
    "Created: 21.4.1997 / 20:45:35 / cg"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   397
!
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   398
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   399
read32RLE
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   400
    "read a 32 bit/pixel rle encoded targa-image; skip alpha channel (for now)"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   401
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   402
    |total count dstIndex code n a r g b|
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   403
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   404
    data := ByteArray new:((total := width * height * 3)).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   405
    count := 0.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   406
    dstIndex := 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   407
    [count < total] whileTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   408
        code := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   409
        n := (code bitAnd:16r7F) + 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   410
        (code bitAnd:16r80) ~~ 0 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   411
            a := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   412
            b := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   413
            g := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   414
            r := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   415
            n timesRepeat:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   416
                data at:dstIndex put:r.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   417
                data at:dstIndex+1 put:g.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   418
                data at:dstIndex+2 put:b.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   419
                dstIndex := dstIndex + 3
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   420
            ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   421
        ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   422
            n timesRepeat:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   423
                a := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   424
                b := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   425
                g := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   426
                r := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   427
                data at:dstIndex put:r.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   428
                data at:dstIndex+1 put:g.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   429
                data at:dstIndex+2 put:b.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   430
                dstIndex := dstIndex + 3
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   431
            ]
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   432
        ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   433
        count := count + (n * 3).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   434
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   435
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   436
    photometric := #rgb.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   437
    samplesPerPixel := 3.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   438
    bitsPerSample := #(8 8 8).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   439
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   440
    "Created: 21.4.1997 / 20:43:54 / cg"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   441
    "Modified: 21.4.1997 / 20:45:49 / cg"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   442
!
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   443
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   444
read8
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   445
    "read an 8 bit/pixel targa-image"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   446
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   447
    data := ByteArray new:(width * height).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   448
    inStream nextBytes:(data size) into:data.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   449
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   450
    colorMap isNil ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   451
        photometric := #blackIs0.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   452
    ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   453
        photometric := #palette.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   454
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   455
    samplesPerPixel := 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   456
    bitsPerSample := #(8).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   457
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   458
    "Created: 21.4.1997 / 20:12:35 / cg"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   459
    "Modified: 21.4.1997 / 20:39:02 / cg"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   460
!
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   461
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   462
read8RLE
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   463
    "read an 8 bit/pixel rle encoded targa-image"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   464
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   465
    |total count dstIndex code n byte|
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   466
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   467
    data := ByteArray new:((total := width * height)).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   468
    count := 0.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   469
    dstIndex := 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   470
    [count < total] whileTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   471
        code := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   472
        n := (code bitAnd:16r7F) + 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   473
        (code bitAnd:16r80) ~~ 0 ifTrue:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   474
            byte := inStream nextByte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   475
            data from:dstIndex to:dstIndex+n-1 put:byte.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   476
        ] ifFalse:[
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   477
            inStream nextBytes:n into:data startingAt:dstIndex.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   478
        ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   479
        count := count + n.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   480
        dstIndex := dstIndex + n.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   481
    ].
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   482
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   483
    photometric := #palette.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   484
    samplesPerPixel := 1.
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   485
    bitsPerSample := #(8).
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   486
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   487
    "Created: 21.4.1997 / 20:19:46 / cg"
f51ec2cc4482 support RLE, 8 and 32 bit images
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   488
    "Modified: 21.4.1997 / 20:21:12 / cg"
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   489
! !
aeed5856f457 Initial revision
claus
parents:
diff changeset
   490
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   491
!TargaReader class methodsFor:'documentation'!
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   492
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   493
version
918
64336276b146 unused local
tz
parents: 815
diff changeset
   494
    ^ '$Header: /cvs/stx/stx/libview2/TargaReader.st,v 1.17 1998-05-11 20:49:37 tz Exp $'
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   495
! !
37
aeed5856f457 Initial revision
claus
parents:
diff changeset
   496
TargaReader initialize!