XPMReader.st
author Claus Gittinger <cg@exept.de>
Tue, 03 Feb 1998 18:21:40 +0100
changeset 817 dec0b7b06c79
parent 693 e228da8c7ddf
child 917 66872b5bfdcb
permissions -rw-r--r--
use common fileFormatError reporter
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
     1
"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
28
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
     3
	      All Rights Reserved
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
     4
24b4aff428c0 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
24b4aff428c0 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
24b4aff428c0 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
24b4aff428c0 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
24b4aff428c0 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    11
"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    12
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    13
ImageReader subclass:#XPMReader
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    14
	instanceVariableNames:''
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    15
	classVariableNames:''
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    16
	poolDictionaries:''
259
62b1bbafd9ba category change
Claus Gittinger <cg@exept.de>
parents: 234
diff changeset
    17
	category:'Graphics-Images-Support'
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    18
!
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    19
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
    20
!XPMReader class methodsFor:'documentation'!
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    21
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    22
copyright
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    23
"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    24
 COPYRIGHT (c) 1994 by Claus Gittinger
28
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
    25
	      All Rights Reserved
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    26
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    27
 This software is furnished under a license and may be used
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    28
 only in accordance with the terms of that license and with the
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    30
 be provided or otherwise made available to, or used by, any
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    31
 other person.  No title to or ownership of the software is
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    32
 hereby transferred.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    33
"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    34
!
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    35
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    36
documentation
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    37
"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    38
    this class provides methods for loading x-pixmap-file (xpm) images.
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    39
24
6bc436eb4c4a *** empty log message ***
claus
parents: 22
diff changeset
    40
    These images are used (in X) for palette images (see ctwm or hp-vue for a lot
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    41
    of them). 
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    42
    The code here is a hack - it may not work for all images 
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    43
    (it works for the testfiles I got here).
24
6bc436eb4c4a *** empty log message ***
claus
parents: 22
diff changeset
    44
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    45
    Limitations: 
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    46
        only reads the full-color specification, ignoring monochrome
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    47
        and greyscale info.
24
6bc436eb4c4a *** empty log message ***
claus
parents: 22
diff changeset
    48
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    49
        Can only handle single-character index.
24
6bc436eb4c4a *** empty log message ***
claus
parents: 22
diff changeset
    50
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    51
        Only understands single-word color names (i.e. names with spaces 
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    52
        are not supported)
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    53
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
    54
        Image writing is only supported for images with less than about 50
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
    55
        colors (single byte encoding). If present, the mask must be a
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
    56
        single bit mask (i.e. no alpha channel).
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
    57
        Due to the algorithm, writing may be slow for big images
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    58
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    59
    Suggestions: adapt & use the XPM library here.
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    60
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    61
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    62
    [See also:]
234
b6352d13e792 xrefs in documentation
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    63
        Image Form Icon
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    64
        BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader 
210
5405de794686 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    65
        ST80FormReader SunRasterReader TargaReader TIFFReader WindowsIconReader 
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    66
        XBMReader XWDReader 
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    67
"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    68
! !
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    69
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
    70
!XPMReader class methodsFor:'initialization'!
28
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
    71
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
    72
initialize
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    73
    "tell Image-class, that a new fileReader is present
400
b40294e3fee0 new suffix-table
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
    74
     for the '.xpm' and '.pm' extensions."
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    75
647
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    76
    MIMETypes defineImageType:'image/x-xpixmap' suffix:'xpm' reader:self.
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    77
    MIMETypes defineImageType:nil               suffix:'pm'  reader:self.
398
aef700d15416 new suffix-table
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
    78
400
b40294e3fee0 new suffix-table
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
    79
    "Modified: 1.2.1997 / 15:10:29 / cg"
28
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
    80
! !
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
    81
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
    82
!XPMReader class methodsFor:'testing'!
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    83
460
2c2215c50c28 added #canRepresent:
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
    84
canRepresent:anImage
2c2215c50c28 added #canRepresent:
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
    85
    "return true, if anImage can be represented in my file format.
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    86
     Currently only images with less than 80 colors are supported."
460
2c2215c50c28 added #canRepresent:
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
    87
2c2215c50c28 added #canRepresent:
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
    88
    anImage depth <= 6 ifTrue:[^ true].
2c2215c50c28 added #canRepresent:
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
    89
    anImage photometric == #palette ifTrue:[
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    90
        anImage colorMap size < 80 ifTrue:[^ true].
460
2c2215c50c28 added #canRepresent:
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
    91
    ].
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    92
    ^ anImage usedColors size < 80
460
2c2215c50c28 added #canRepresent:
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
    93
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    94
    "Modified: 27.2.1997 / 12:40:22 / cg"
460
2c2215c50c28 added #canRepresent:
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
    95
!
2c2215c50c28 added #canRepresent:
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
    96
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    97
isValidImageFile:aFileName
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    98
    "return true, if aFileName contains an x-bitmap-file image"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
    99
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   100
    |line inStream |
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   101
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   102
    inStream := self streamReadingFile:aFileName.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   103
    inStream isNil ifTrue:[^ false].
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   104
550
254480517864 handle long line read error.
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   105
    Stream readErrorSignal handle:[:ex |
254480517864 handle long line read error.
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   106
        line := nil
254480517864 handle long line read error.
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   107
    ] do:[
254480517864 handle long line read error.
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   108
        line := inStream nextLine.
254480517864 handle long line read error.
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   109
    ].
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   110
    inStream close.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   111
    line isNil ifTrue:[^ false].
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   112
    (line startsWith:'/* XPM') ifFalse:[^ false].
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   113
    ^ true
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   114
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   115
    "
562
921472d151d9 handle commented lines (in colorSpec)
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   116
     XPMReader isValidImageFile:'fooBar'    
921472d151d9 handle commented lines (in colorSpec)
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   117
     XPMReader isValidImageFile:'bitmaps/xpmBitmaps/device_images/ljet.xpm'      
921472d151d9 handle commented lines (in colorSpec)
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   118
     XPMReader isValidImageFile:'bitmaps/gifImages/garfield.gif' 
550
254480517864 handle long line read error.
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   119
    "
254480517864 handle long line read error.
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   120
562
921472d151d9 handle commented lines (in colorSpec)
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   121
    "Modified: 24.4.1997 / 20:29:40 / cg"
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   122
! !
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   123
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   124
!XPMReader methodsFor:'reading from file'!
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   125
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   126
colorNameFrom:aStream
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   127
    "read either a color-name or value specified in X-notation
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   128
     (#rrggbb where rr, gg and bb are 2-digit hex numbers)"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   129
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   130
    |s|
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   131
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   132
    aStream peek == $# ifTrue:[
28
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
   133
	aStream next.
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
   134
	s := '#'.
24
6bc436eb4c4a *** empty log message ***
claus
parents: 22
diff changeset
   135
    ] ifFalse:[
28
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
   136
	s := ''.
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   137
    ].
28
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
   138
    [aStream peek isLetterOrDigit] whileTrue:[
8daff0234d2e *** empty log message ***
claus
parents: 24
diff changeset
   139
	s := s copyWith:aStream next
24
6bc436eb4c4a *** empty log message ***
claus
parents: 22
diff changeset
   140
    ].
6bc436eb4c4a *** empty log message ***
claus
parents: 22
diff changeset
   141
    ^ s
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   142
!
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   143
41
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   144
fromStream:aStream
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   145
    "read an XPM-image from aStream. Return the receiver 
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   146
     (with all relevant instance variables set for the image) 
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   147
     or nil on error"
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   148
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   149
    |line 
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   150
     srcIndex "{ Class: SmallInteger }"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   151
     dstIndex "{ Class: SmallInteger }"
470
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   152
     colorName monoName greyName grey4Name symbolicName colorMapSize redMap greenMap blueMap
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   153
     charsPerPixel xlation s bitsPerPixel char lineDone maskPixelValue
509
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   154
     state key|
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   155
41
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   156
    inStream := aStream.
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   157
41
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   158
    line := aStream nextLine.
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   159
    (line notNil and:[line startsWith:'/* XPM']) ifFalse:[
817
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   160
        ^ self fileFormatError:'format error (expected XPM)'.
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   161
    ].
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   162
41
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   163
    line := aStream nextLine.
107
Claus Gittinger <cg@exept.de>
parents: 99
diff changeset
   164
    [line notNil and:[(line startsWith:'/*') or:[line isBlank]]] whileTrue:[
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   165
        line := aStream nextLine.
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   166
    ].
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   167
    (line notNil and:[line startsWith:'static char']) ifFalse:[
817
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   168
        ^ self fileFormatError:'format error (expected static char)'.
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   169
    ].
41
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   170
    line := aStream nextLine.
107
Claus Gittinger <cg@exept.de>
parents: 99
diff changeset
   171
    (line notNil and:[line startsWith:'/*']) ifTrue:[
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   172
        [line notNil 
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   173
         and:[(line startsWith:'/*') or:[line startsWith:' *']]] whileTrue:[
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   174
            line := aStream nextLine.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   175
        ].
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   176
    ].
471
350583677b5b allow lines to begin with spaces
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
   177
    line notNil ifTrue:[
350583677b5b allow lines to begin with spaces
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
   178
        line := line withoutSeparators
350583677b5b allow lines to begin with spaces
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
   179
    ].
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   180
    (line notNil and:[line startsWith:'"']) ifFalse:[
817
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   181
        ^ self fileFormatError:'format error (expected "ww hh nn mm)'.
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   182
    ].
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   183
    s := ReadStream on:line.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   184
    s next.  "skip quote"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   185
    width := Integer readFrom:s.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   186
    height := Integer readFrom:s.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   187
    colorMapSize := Integer readFrom:s.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   188
    charsPerPixel := Integer readFrom:s.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   189
    charsPerPixel ~~ 1 ifTrue:[
509
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   190
        xlation := Dictionary new:colorMapSize.
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   191
    ] ifFalse:[
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   192
        xlation := Array new:256.
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   193
    ].
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   194
107
Claus Gittinger <cg@exept.de>
parents: 99
diff changeset
   195
    redMap := ByteArray new:colorMapSize.
Claus Gittinger <cg@exept.de>
parents: 99
diff changeset
   196
    greenMap := ByteArray new:colorMapSize.
Claus Gittinger <cg@exept.de>
parents: 99
diff changeset
   197
    blueMap := ByteArray new:colorMapSize.
36
3a7ec58dff8e *** empty log message ***
claus
parents: 32
diff changeset
   198
    colorMap := Colormap redVector:redMap greenVector:greenMap blueVector:blueMap.
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   199
    1 to:colorMapSize do:[:colorIndex |
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   200
        |index line color t word|
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   201
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   202
        line := aStream nextLine.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   203
        [line notNil and:[line startsWith:'/*']] whileTrue:[
562
921472d151d9 handle commented lines (in colorSpec)
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   204
            [line notNil and:[(line endsWith:'*/') not]] whileTrue:[
921472d151d9 handle commented lines (in colorSpec)
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   205
                line := aStream nextLine.
921472d151d9 handle commented lines (in colorSpec)
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   206
            ].
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   207
            line := aStream nextLine.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   208
        ].
471
350583677b5b allow lines to begin with spaces
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
   209
        line notNil ifTrue:[
350583677b5b allow lines to begin with spaces
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
   210
            line := line withoutSeparators
350583677b5b allow lines to begin with spaces
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
   211
        ].
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   212
        (line notNil and:[line startsWith:'"']) ifFalse:[
817
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   213
            ^ self fileFormatError:'format error (expected color spec)'.
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   214
        ].
24
6bc436eb4c4a *** empty log message ***
claus
parents: 22
diff changeset
   215
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   216
        s := ReadStream on:line.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   217
        s next. "skip quote"
509
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   218
        charsPerPixel ~~ 1 ifTrue:[
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   219
            key := s next:charsPerPixel.
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   220
            xlation at:key put:colorIndex - 1.
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   221
        ] ifFalse:[
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   222
            index := s next asciiValue.
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   223
            xlation at:index put:colorIndex - 1.
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   224
        ].
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   225
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   226
        lineDone := false.
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   227
        state := nil.
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   228
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   229
        [lineDone] whileFalse:[
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   230
            s skipSeparators.
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   231
            s peek == $# ifTrue:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   232
                word := self colorNameFrom:s
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   233
            ] ifFalse:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   234
                word := s nextAlphaNumericWord.
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   235
            ].
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   236
            word isNil ifTrue:[
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   237
                lineDone := true
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   238
            ] ifFalse:[
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   239
                word = 's' ifTrue:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   240
                    "/ symbolic name ...
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   241
                    state := $s. symbolicName := ''.
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   242
                ] ifFalse:[
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   243
                    word = 'm' ifTrue:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   244
                        "/ monochrome data
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   245
                        state := $m. monoName := ''.
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   246
                    ] ifFalse:[
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   247
                        word = 'g' ifTrue:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   248
                            "/ grey data
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   249
                            state := $g. greyName := ''.
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   250
                        ] ifFalse:[
470
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   251
                            word = 'g4' ifTrue:[
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   252
                                "/ grey data
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   253
                                state := $G. grey4Name := ''.
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   254
                            ] ifFalse:[
470
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   255
                                word = 'c' ifTrue:[
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   256
                                    "/ color data
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   257
                                    state := $c. colorName := ''.
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   258
                                ] ifFalse:[
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   259
                                    "/ append to name
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   260
                                    state isNil ifTrue:[
817
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   261
                                        ^ self fileFormatError:('format error got: ' 
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   262
                                                                , word printString 
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   263
                                                                , ' (expected ''c'',''m'',''g'' or ''s'')').
470
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   264
                                    ].
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   265
470
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   266
                                    state == $m ifTrue:[
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   267
                                        monoName := monoName , ' ' , word.
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   268
                                    ].
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   269
                                    state == $g ifTrue:[
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   270
                                        greyName := greyName , ' ' , word.
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   271
                                    ].
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   272
                                    state == $G ifTrue:[
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   273
                                        grey4Name := grey4Name , ' ' , word.
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   274
                                    ].
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   275
                                    state == $c ifTrue:[
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   276
                                        colorName := colorName , ' ' , word.
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   277
                                    ].
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   278
                                    state == $s ifTrue:[
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   279
                                        symbolicName := symbolicName , ' ' , word.
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   280
                                    ].
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   281
                                    (word startsWith:'#') ifTrue:[
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   282
                                        state := nil.
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   283
                                    ]
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   284
                                ]
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   285
                            ]
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   286
                        ]
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   287
                    ]
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   288
                ]
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   289
            ].
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   290
        ].
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   291
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   292
        colorName notNil ifTrue:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   293
            colorName := colorName withoutSeparators
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   294
        ].
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   295
        monoName notNil ifTrue:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   296
            monoName := monoName withoutSeparators
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   297
        ].
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   298
        greyName notNil ifTrue:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   299
            greyName := greyName withoutSeparators
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   300
        ].
470
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   301
        grey4Name notNil ifTrue:[
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   302
            grey4Name := grey4Name withoutSeparators
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   303
        ].
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   304
        symbolicName notNil ifTrue:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   305
            symbolicName := symbolicName withoutSeparators
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   306
        ].
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   307
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   308
        "/
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   309
        "/ for now - ignore everything, except
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   310
        "/ colorName (if there is one)
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   311
        "/
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   312
        colorName isNil ifTrue:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   313
            colorName := greyName.
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   314
            colorName isNil ifTrue:[
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   315
                colorName := monoName.
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   316
            ]
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   317
        ].
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   318
470
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   319
        ((colorName = 'none') 
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   320
        or:[colorName = 'None'
4709c3f524cd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   321
        or:[colorName = 'NONE']]) ifTrue:[
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   322
            color := Color noColor. "/ white
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   323
            redMap at:colorIndex put:0.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   324
            greenMap at:colorIndex put:0.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   325
            blueMap at:colorIndex put:0.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   326
            maskPixelValue := colorIndex-1.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   327
        ] ifFalse:[
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   328
            color := Color name:colorName.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   329
            redMap at:colorIndex put:(color red asFloat * 255.0 // 100).
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   330
            greenMap at:colorIndex put:(color green asFloat * 255.0 // 100).
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   331
            blueMap at:colorIndex put:(color blue asFloat * 255.0 // 100).
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   332
        ].
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   333
    ].
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   334
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   335
    "actually, could make it an image with less depth most of the time ..."
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   336
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   337
"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   338
    bitsPerPixel := ((colorMapSize - 1) log:2) truncated + 1.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   339
"
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   340
    bitsPerPixel := 8.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   341
    data := ByteArray new:(width * height).
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   342
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   343
    dstIndex := 1.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   344
    1 to:height do:[:row |
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   345
        line := aStream nextLine withoutSpaces.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   346
        [line notNil and:[line startsWith:'/*']] whileTrue:[
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   347
            line := aStream nextLine withoutSpaces.
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   348
        ].
471
350583677b5b allow lines to begin with spaces
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
   349
        line notNil ifTrue:[
350583677b5b allow lines to begin with spaces
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
   350
            line := line withoutSeparators
350583677b5b allow lines to begin with spaces
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
   351
        ].
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   352
        (line notNil and:[line startsWith:'"']) ifFalse:[
817
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   353
            ^ self fileFormatError:'format error (expected pixels)'.
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   354
        ].
509
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   355
        charsPerPixel ~~ 1 ifTrue:[
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   356
            s := line readStream.
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   357
            s next. "/ skip dquote
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   358
            1 to: width do:[:col |
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   359
                |key|
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   360
509
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   361
                key := s next:charsPerPixel.
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   362
                data at:dstIndex put:(xlation at:key).
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   363
                dstIndex := dstIndex + 1
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   364
            ]
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   365
        ] ifFalse:[
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   366
            srcIndex := 2.
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   367
            1 to: width do:[:col |
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   368
                |char|
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   369
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   370
                char := line at:srcIndex.
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   371
                data at:dstIndex put:(xlation at:char asciiValue).
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   372
                srcIndex := srcIndex + 1.
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   373
                dstIndex := dstIndex + 1
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   374
            ]
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   375
        ]
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   376
    ].
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   377
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   378
    photometric := #palette.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   379
    samplesPerPixel := 1.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   380
    bitsPerSample := Array with:bitsPerPixel.
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   381
316
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   382
    maskPixelValue notNil ifTrue:[
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   383
        self buildMaskFromColor:maskPixelValue
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   384
    ].
d39f3f8f7627 Support color 'none' (transparency masks).
Stefan Vogel <sv@exept.de>
parents: 259
diff changeset
   385
24
6bc436eb4c4a *** empty log message ***
claus
parents: 22
diff changeset
   386
    "
41
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   387
     XPMReader fromStream:('bitmaps/ljet.xpm' asFilename readStream)
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   388
     XPMReader fromStream:('bitmaps/magtape.xpm' asFilename readStream)
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   389
     XPMReader fromStream:('bitmaps/pixmap.xpm' asFilename readStream) 
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   390
     XPMReader fromStream:('bitmaps/SBrowser.xbm' asFilename readStream)
107
Claus Gittinger <cg@exept.de>
parents: 99
diff changeset
   391
    "
Claus Gittinger <cg@exept.de>
parents: 99
diff changeset
   392
817
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   393
    "Created: / 24.9.1995 / 06:20:06 / claus"
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   394
    "Modified: / 24.9.1995 / 07:07:33 / claus"
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   395
    "Modified: / 5.7.1996 / 17:27:59 / stefan"
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   396
    "Modified: / 3.2.1998 / 18:21:30 / cg"
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   397
! !
41
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   398
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   399
!XPMReader methodsFor:'writing to a file'!
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   400
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   401
colorNameOf:aColor
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   402
    #(white black red green blue
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   403
      yellow magenta cyan orange) do:[:aStandardColorName |
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   404
        aColor = (Color name:aStandardColorName) ifTrue:[
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   405
            ^ aStandardColorName.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   406
        ]
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   407
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   408
    ^ '#' 
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   409
     , (aColor redByte hexPrintString:2)
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   410
     , (aColor greenByte hexPrintString:2)
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   411
     , (aColor blueByte hexPrintString:2)
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   412
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   413
    "Created: 27.2.1997 / 11:48:40 / cg"
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   414
!
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   415
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   416
save:image onFile:aFileName
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   417
    "save image as XPM file on aFileName.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   418
     Caveat: currently, only a maximum of roughly 50 colors is handled
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   419
             (i.e. very simple images)"
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   420
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   421
    |usedColors nColorsUsed nColors nChars baseName map maskColorIndex
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   422
     isMasked imageMask|
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   423
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   424
    usedColors := image usedColors.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   425
    nColors := nColorsUsed := usedColors size.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   426
    (imageMask := image mask) notNil ifTrue:[
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   427
        nColors := nColors + 1.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   428
        maskColorIndex := nColors.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   429
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   430
    nColors > 256 ifTrue:[
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   431
        ^ Image cannotRepresentImageSignal 
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   432
            raiseWith:image
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   433
            errorString:('XPMReader cannot represent this image (too many colors)').
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   434
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   435
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   436
    map := ($a to: $z) asOrderedCollection.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   437
    map addAll:($A to: $Z) asOrderedCollection.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   438
    map addAll:($0 to: $9) asOrderedCollection.
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   439
    map addAll:#($. $, $` $^ $* $: $; $< $> $? $% $# $& $( $) $- $+ $=) asOrderedCollection.
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   440
    nChars := 1.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   441
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   442
    nColors > map size ifTrue:[
668
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   443
"/        ^ Image cannotRepresentImageSignal 
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   444
"/            raiseWith:image
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   445
"/            errorString:('XPMReader cannot represent this image (too many colors)').
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   446
        map := OrderedCollection new.
693
e228da8c7ddf Fix compiler warning.
Stefan Vogel <sv@exept.de>
parents: 668
diff changeset
   447
        $a to: $j do:[:c1 |
668
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   448
            map addAll:(($a to: $z) collect:[:c2 | c1 asString , c2 asString]).
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   449
        ].
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   450
        nChars := 2.
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   451
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   452
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   453
    outStream := FileStream newFileNamed:aFileName.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   454
    outStream isNil ifTrue:[
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   455
        ^ Image fileCreationErrorSignal 
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   456
            raiseWith:image
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   457
            errorString:('file creation error: ' , aFileName asString).
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   458
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   460
    baseName := aFileName asFilename baseName asFilename withoutSuffix asString.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   461
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   462
    outStream nextPutLine:'/* XPM */'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   463
    outStream nextPutLine:'static char *' , baseName , '_xpm[] = {'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   464
    outStream nextPutLine:'/* width height ncolors chars_per_pixel */'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   465
    outStream nextPutLine:'"' , image width printString , ' '
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   466
                              , image height printString , ' '
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   467
                              , nColors printString , ' '
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   468
                              , nChars printString , '",'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   469
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   470
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   471
    outStream nextPutLine:'/* colors */'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   472
    1 to:nColorsUsed do:[:idx |
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   473
        |clr|
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   474
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   475
        clr := usedColors at:idx.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   476
        outStream nextPutLine:'"' , (map at:idx) asString ,
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   477
                              ' ' , 'c ' , (self colorNameOf:clr) ,
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   478
                              '",'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   479
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   480
    maskColorIndex notNil ifTrue:[
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   481
        outStream nextPutLine:'"' , (map at:maskColorIndex) asString ,
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   482
                              ' c none",'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   483
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   484
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   485
    outStream nextPutLine:'/* pixels */'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   486
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   487
    maskColorIndex isNil ifTrue:[
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   488
        isMasked := false
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   489
    ].
560
4cce4f58bbbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   490
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   491
    0 to:image height-1 do:[:y |
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   492
        outStream nextPutAll:'"'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   493
        0 to:image width-1 do:[:x |
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   494
            |clr idx|
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   495
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   496
            maskColorIndex notNil ifTrue:[
560
4cce4f58bbbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   497
                isMasked := (imageMask pixelAtX:x y:y) == 0
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   498
            ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   499
            isMasked ifTrue:[
668
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   500
                outStream nextPutAll:(map at:maskColorIndex) asString
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   501
            ] ifFalse:[
564
8a31b6fbe9a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   502
                clr := image colorAtX:x y:y.
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   503
                idx := usedColors indexOf:clr.
668
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   504
                outStream nextPutAll:(map at:idx) asString
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   505
            ]
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   506
        ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   507
        outStream nextPutLine:'",'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   508
    ].
469
7b58a1bf581c dont forget to close the stream at the end
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   509
    outStream nextPutLine:'};'.
7b58a1bf581c dont forget to close the stream at the end
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   510
    outStream close.
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   511
668
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   512
    "Modified: 22.7.1997 / 10:30:27 / cg"
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   513
! !
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   514
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   515
!XPMReader class methodsFor:'documentation'!
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
   516
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
   517
version
817
dec0b7b06c79 use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   518
    ^ '$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.37 1998-02-03 17:21:40 cg Exp $'
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
   519
! !
41
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   520
XPMReader initialize!