XPMReader.st
author Claus Gittinger <cg@exept.de>
Sat, 08 Aug 1998 13:42:06 +0200
changeset 1035 308004d24f3d
parent 1012 8dd3d70caedb
child 1400 8a7b55b08bf3
permissions -rw-r--r--
*** empty log message ***
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
917
66872b5bfdcb unused local
tz
parents: 817
diff changeset
   153
     charsPerPixel xlation s bitsPerPixel 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:[
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
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:[
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
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:[
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
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:[
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   172
	[line notNil 
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   173
	 and:[(line startsWith:'/*') or:[line startsWith:' *']]] whileTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   174
	    line := aStream nextLine.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
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:[
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   178
	line := line withoutSeparators
471
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:[
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
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:[
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   190
	xlation := Dictionary new:colorMapSize.
509
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   191
    ] ifFalse:[
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
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 |
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   200
	|index line color t word|
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   201
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   202
	line := aStream nextLine.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   203
	[line notNil and:[line startsWith:'/*']] whileTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   204
	    [line notNil and:[(line endsWith:'*/') not]] whileTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   205
		line := aStream nextLine.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   206
	    ].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   207
	    line := aStream nextLine.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   208
	].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   209
	line notNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   210
	    line := line withoutSeparators
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   211
	].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   212
	(line notNil and:[line startsWith:'"']) ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   213
	    ^ self fileFormatError:'format error (expected color spec)'.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   214
	].
24
6bc436eb4c4a *** empty log message ***
claus
parents: 22
diff changeset
   215
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   216
	s := ReadStream on:line.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   217
	s next. "skip quote"
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   218
	charsPerPixel ~~ 1 ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   219
	    key := s next:charsPerPixel.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   220
	    xlation at:key put:colorIndex - 1.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   221
	] ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   222
	    index := s next asciiValue.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   223
	    xlation at:index put:colorIndex - 1.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   224
	].
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   225
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   226
	lineDone := false.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   227
	state := nil.
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   228
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   229
	[lineDone] whileFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   230
	    s skipSeparators.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   231
	    s peek == $# ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   232
		word := self colorNameFrom:s
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   233
	    ] ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   234
		word := s nextAlphaNumericWord.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   235
	    ].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   236
	    word isNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   237
		lineDone := true
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   238
	    ] ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   239
		word = 's' ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   240
		    "/ symbolic name ...
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   241
		    state := $s. symbolicName := ''.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   242
		] ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   243
		    word = 'm' ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   244
			"/ monochrome data
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   245
			state := $m. monoName := ''.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   246
		    ] ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   247
			word = 'g' ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   248
			    "/ grey data
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   249
			    state := $g. greyName := ''.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   250
			] ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   251
			    word = 'g4' ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   252
				"/ grey data
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   253
				state := $G. grey4Name := ''.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   254
			    ] ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   255
				word = 'c' ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   256
				    "/ color data
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   257
				    state := $c. colorName := ''.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   258
				] ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   259
				    "/ append to name
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   260
				    state isNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   261
					^ self fileFormatError:('format error got: ' 
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   262
								, word printString 
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   263
								, ' (expected ''c'',''m'',''g'' or ''s'')').
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   264
				    ].
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   265
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   266
				    state == $m ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   267
					monoName := monoName , ' ' , word.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   268
				    ].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   269
				    state == $g ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   270
					greyName := greyName , ' ' , word.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   271
				    ].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   272
				    state == $G ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   273
					grey4Name := grey4Name , ' ' , word.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   274
				    ].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   275
				    state == $c ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   276
					colorName := colorName , ' ' , word.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   277
				    ].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   278
				    state == $s ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   279
					symbolicName := symbolicName , ' ' , word.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   280
				    ].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   281
				    (word startsWith:'#') ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   282
					state := nil.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   283
				    ]
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   284
				]
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   285
			    ]
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   286
			]
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   287
		    ]
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   288
		]
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   289
	    ].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   290
	].
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   291
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   292
	colorName notNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   293
	    colorName := colorName withoutSeparators
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   294
	].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   295
	monoName notNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   296
	    monoName := monoName withoutSeparators
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   297
	].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   298
	greyName notNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   299
	    greyName := greyName withoutSeparators
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   300
	].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   301
	grey4Name notNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   302
	    grey4Name := grey4Name withoutSeparators
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   303
	].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   304
	symbolicName notNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   305
	    symbolicName := symbolicName withoutSeparators
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   306
	].
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   307
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   308
	"/
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   309
	"/ for now - ignore everything, except
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   310
	"/ colorName (if there is one)
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   311
	"/
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   312
	colorName isNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   313
	    colorName := greyName.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   314
	    colorName isNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   315
		colorName := monoName.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   316
	    ]
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   317
	].
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   318
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   319
	((colorName = 'none') 
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   320
	or:[colorName = 'None'
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   321
	or:[colorName = 'NONE']]) ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   322
	    color := Color noColor. "/ white
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   323
	    redMap at:colorIndex put:0.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   324
	    greenMap at:colorIndex put:0.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   325
	    blueMap at:colorIndex put:0.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   326
	    maskPixelValue := colorIndex-1.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   327
	] ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   328
	    color := Color name:colorName ifIllegal:Color black.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   329
	    redMap at:colorIndex put:(color red asFloat * 255.0 // 100).
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   330
	    greenMap at:colorIndex put:(color green asFloat * 255.0 // 100).
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   331
	    blueMap at:colorIndex put:(color blue asFloat * 255.0 // 100).
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
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 |
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   345
	line := aStream nextLine withoutSpaces.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   346
	[line notNil and:[line startsWith:'/*']] whileTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   347
	    line := aStream nextLine withoutSpaces.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   348
	].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   349
	line notNil ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   350
	    line := line withoutSeparators
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   351
	].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   352
	(line notNil and:[line startsWith:'"']) ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   353
	    ^ self fileFormatError:'format error (expected pixels)'.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   354
	].
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   355
	charsPerPixel ~~ 1 ifTrue:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   356
	    s := line readStream.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   357
	    s next. "/ skip dquote
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   358
	    1 to: width do:[:col |
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   359
		|key|
22
24b4aff428c0 Initial revision
claus
parents:
diff changeset
   360
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   361
		key := s next:charsPerPixel.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   362
		data at:dstIndex put:(xlation at:key).
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   363
		dstIndex := dstIndex + 1
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   364
	    ]
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   365
	] ifFalse:[
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   366
	    srcIndex := 2.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   367
	    1 to: width do:[:col |
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   368
		|char|
509
df395b9c70c8 handle read of multiChar encodings
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
   369
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   370
		char := line at:srcIndex.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   371
		data at:dstIndex put:(xlation at:char asciiValue).
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   372
		srcIndex := srcIndex + 1.
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   373
		dstIndex := dstIndex + 1
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   374
	    ]
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
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:[
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   383
	self buildMaskFromColor:maskPixelValue
316
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"
1007
0b8d790b8e3b care for bad color names.
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
   396
    "Modified: / 27.7.1998 / 20:01:56 / 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
955
0fdf55c5cc7f comment
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   402
    "generate a name for a color. If its a standard color,
0fdf55c5cc7f comment
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   403
     return its name; otherwise return the hex representation."
0fdf55c5cc7f comment
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   404
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   405
    #(white black red green blue
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   406
      yellow magenta cyan orange) do:[:aStandardColorName |
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   407
        aColor = (Color name:aStandardColorName) ifTrue:[
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   408
            ^ aStandardColorName.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   409
        ]
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   410
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   411
    ^ '#' 
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   412
     , (aColor redByte hexPrintString:2)
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   413
     , (aColor greenByte hexPrintString:2)
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   414
     , (aColor blueByte hexPrintString:2)
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   415
955
0fdf55c5cc7f comment
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   416
    "Created: / 27.2.1997 / 11:48:40 / cg"
0fdf55c5cc7f comment
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   417
    "Modified: / 6.6.1998 / 20:58:49 / cg"
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   418
!
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   419
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   420
save:image onFile:aFileName
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   421
    "save image as XPM file on aFileName.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   422
     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
   423
             (i.e. very simple images)"
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   424
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   425
    |usedColors nColorsUsed nColors nChars baseName map maskColorIndex
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   426
     isMasked imageMask|
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   427
1012
8dd3d70caedb oops - usedColors returns a set.
Claus Gittinger <cg@exept.de>
parents: 1007
diff changeset
   428
    usedColors := image usedColors asArray.
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   429
    nColors := nColorsUsed := usedColors size.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   430
    (imageMask := image mask) notNil ifTrue:[
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   431
        nColors := nColors + 1.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   432
        maskColorIndex := nColors.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   433
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   434
    nColors > 256 ifTrue:[
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   435
        ^ Image cannotRepresentImageSignal 
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   436
            raiseWith:image
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   437
            errorString:('XPMReader cannot represent this image (too many colors)').
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   438
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   439
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   440
    map := ($a to: $z) asOrderedCollection.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   441
    map addAll:($A to: $Z) asOrderedCollection.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   442
    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
   443
    map addAll:#($. $, $` $^ $* $: $; $< $> $? $% $# $& $( $) $- $+ $=) asOrderedCollection.
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   444
    nChars := 1.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   445
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   446
    nColors > map size ifTrue:[
668
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   447
"/        ^ Image cannotRepresentImageSignal 
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   448
"/            raiseWith:image
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   449
"/            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
   450
        map := OrderedCollection new.
693
e228da8c7ddf Fix compiler warning.
Stefan Vogel <sv@exept.de>
parents: 668
diff changeset
   451
        $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
   452
            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
   453
        ].
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   454
        nChars := 2.
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   455
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   456
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   457
    outStream := FileStream newFileNamed:aFileName.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   458
    outStream isNil ifTrue:[
461
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   459
        ^ Image fileCreationErrorSignal 
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   460
            raiseWith:image
bacef118f54a more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   461
            errorString:('file creation error: ' , aFileName asString).
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   462
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   463
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   464
    baseName := aFileName asFilename baseName asFilename withoutSuffix asString.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   465
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   466
    outStream nextPutLine:'/* XPM */'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   467
    outStream nextPutLine:'static char *' , baseName , '_xpm[] = {'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   468
    outStream nextPutLine:'/* width height ncolors chars_per_pixel */'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   469
    outStream nextPutLine:'"' , image width printString , ' '
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   470
                              , image height printString , ' '
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   471
                              , nColors printString , ' '
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   472
                              , nChars printString , '",'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   473
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
    outStream nextPutLine:'/* colors */'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   476
    1 to:nColorsUsed do:[:idx |
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   477
        |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
        clr := usedColors at:idx.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   480
        outStream nextPutLine:'"' , (map at:idx) asString ,
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   481
                              ' ' , 'c ' , (self colorNameOf:clr) ,
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   482
                              '",'.
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
    maskColorIndex notNil ifTrue:[
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   485
        outStream nextPutLine:'"' , (map at:maskColorIndex) asString ,
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   486
                              ' c none",'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   487
    ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   488
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   489
    outStream nextPutLine:'/* pixels */'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   490
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   491
    maskColorIndex isNil ifTrue:[
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   492
        isMasked := false
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   493
    ].
560
4cce4f58bbbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   494
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   495
    0 to:image height-1 do:[:y |
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   496
        outStream nextPutAll:'"'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   497
        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
   498
            |clr idx|
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   499
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   500
            maskColorIndex notNil ifTrue:[
560
4cce4f58bbbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 550
diff changeset
   501
                isMasked := (imageMask pixelAtX:x y:y) == 0
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   502
            ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   503
            isMasked ifTrue:[
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:maskColorIndex) asString
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   505
            ] ifFalse:[
564
8a31b6fbe9a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   506
                clr := image colorAtX:x y:y.
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   507
                idx := usedColors indexOf:clr.
668
2c741725cc08 allow save of images with up-to 256 colors
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   508
                outStream nextPutAll:(map at:idx) asString
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   509
            ]
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   510
        ].
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   511
        outStream nextPutLine:'",'.
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   512
    ].
469
7b58a1bf581c dont forget to close the stream at the end
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   513
    outStream nextPutLine:'};'.
7b58a1bf581c dont forget to close the stream at the end
Claus Gittinger <cg@exept.de>
parents: 461
diff changeset
   514
    outStream close.
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   515
1012
8dd3d70caedb oops - usedColors returns a set.
Claus Gittinger <cg@exept.de>
parents: 1007
diff changeset
   516
    "Modified: / 28.7.1998 / 21:52:13 / cg"
459
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   517
! !
9cdd02f994a4 added image writing support
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   518
384
f139a7fc423b fixed color reading - color names may consist of multiple
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
   519
!XPMReader class methodsFor:'documentation'!
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
   520
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
   521
version
1012
8dd3d70caedb oops - usedColors returns a set.
Claus Gittinger <cg@exept.de>
parents: 1007
diff changeset
   522
    ^ '$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.41 1998-07-28 20:06:10 cg Exp $'
203
a38debd57097 commentary
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
   523
! !
41
66edc847b9c8 *** empty log message ***
claus
parents: 36
diff changeset
   524
XPMReader initialize!