112 Dithering can be controlled by the DitherAlgorithm classVariable: |
112 Dithering can be controlled by the DitherAlgorithm classVariable: |
113 |
113 |
114 DitherAlgorithm: |
114 DitherAlgorithm: |
115 |
115 |
116 nil a simple threshold algorithm |
116 nil a simple threshold algorithm |
117 (i.e. for mono, p<0.5 -> black, p>=0.5 -> white) |
117 (i.e. for mono, p<0.5 -> black, p>=0.5 -> white) |
118 |
118 |
119 #pattern patterned dither |
119 #pattern patterned dither |
120 (for p, take dithered color to fill pixel; |
120 (for p, take dithered color to fill pixel; |
121 uses dithering in color-class) |
121 uses dithering in color-class) |
122 |
122 |
123 #error error diffusion dither (Floyd-Steinberg) |
123 #error error diffusion dither (Floyd-Steinberg) |
124 planned - not yet implemented. |
124 planned - not yet implemented. |
125 |
125 |
126 |
126 |
127 Notice: |
127 Notice: |
128 the set of attributes and the way they are stored originated initially |
128 the set of attributes and the way they are stored originated initially |
129 from the need to represent tiff images. These turned out to use a relatively |
129 from the need to represent tiff images. These turned out to use a relatively |
130 large set of atributes, of which many are unused in other image formats. |
130 large set of atributes, of which many are unused in other image formats. |
131 (so it was sufficient). |
131 (so it was sufficient). |
132 Later, some VisualWorks compatibility protocol was added (mapped palettes, for |
132 Later, some VisualWorks compatibility protocol was added (mapped palettes, for |
133 example), and some stuff could well be redefined in simpler ways. |
133 example), and some stuff could well be redefined in simpler ways. |
134 We may do that, if we are bored and there is nothing else to improve... ;-) |
134 We may do that, if we are bored and there is nothing else to improve... ;-) |
135 |
135 |
136 |
136 |
137 [instance variables:] |
137 [instance variables:] |
138 |
138 |
139 width <Integer> the width in pixels |
139 width <Integer> the width in pixels |
140 height <Integer> the height in pixels |
140 height <Integer> the height in pixels |
141 bytes <ByteArray> the full image information |
141 bytes <ByteArray> the full image information |
142 photometric <Symbol> #rgb, #palette, #blackIs0 or #whiteIs0 |
142 photometric <Symbol> #rgb, #palette, #blackIs0 or #whiteIs0 |
143 samplesPerPixel <Integer> the number of planes |
143 samplesPerPixel <Integer> the number of planes |
144 bitsPerSample <Array> the number of bits per plane |
144 bitsPerSample <Array> the number of bits per plane |
145 |
145 |
146 colorMap <Array> only if photometric is #palette; |
146 colorMap <Array> only if photometric is #palette; |
147 maps pixel values to r/g/b values. |
147 maps pixel values to r/g/b values. |
148 |
148 |
149 device <Workstation> the device on which deviceForm, |
149 device <Workstation> the device on which deviceForm, |
150 monoDeviceForm and lowResDeviceForm are |
150 monoDeviceForm and lowResDeviceForm are |
151 |
151 |
152 deviceForm <Form> the device form which gives the best |
152 deviceForm <Form> the device form which gives the best |
153 possible aproximation of the image on |
153 possible aproximation of the image on |
154 device using standard colors. |
154 device using standard colors. |
155 |
155 |
156 monoDeviceForm <Form> the device form which gives a monochrome |
156 monoDeviceForm <Form> the device form which gives a monochrome |
157 aproximation of the image on device. |
157 aproximation of the image on device. |
158 |
158 |
159 fullColorDeviceForm <Form> the device form which gives the best |
159 fullColorDeviceForm <Form> the device form which gives the best |
160 possible aproximation of the image on |
160 possible aproximation of the image on |
161 device using private colors. |
161 device using private colors. |
162 (not yet implemented) |
162 (not yet implemented) |
163 |
163 |
164 mask <ImageMask> an optional mask; |
164 mask <ImageMask> an optional mask; |
165 if non-nil, only pixels for which the |
165 if non-nil, only pixels for which the |
166 corresponding mask bit is non-zero |
166 corresponding mask bit is non-zero |
167 are drawn. |
167 are drawn. |
168 |
168 |
169 maskedPixelsAre0 <Boolean> a hint for image processors and drawers |
169 maskedPixelsAre0 <Boolean> a hint for image processors and drawers |
170 if true, masked pixels are known to be |
170 if true, masked pixels are known to be |
171 zero in the pixel bytes. |
171 zero in the pixel bytes. |
172 |
172 |
173 fileName <String> the name of the file from which the |
173 fileName <String> the name of the file from which the |
174 image was loaded - nil otherwise. |
174 image was loaded - nil otherwise. |
175 Useful for image save functions |
175 Useful for image save functions |
176 and for the UIPainter utility. |
176 and for the UIPainter utility. |
177 |
177 |
178 imageSequence the imageSequence, of which the |
178 imageSequence the imageSequence, of which the |
179 instance is a frame or nil, |
179 instance is a frame or nil, |
180 if its not part of a sequence. |
180 if its not part of a sequence. |
181 |
181 |
182 bitsPerPixel obsolete - not used in ST/X (kept for a while for subclasses) |
182 bitsPerPixel obsolete - not used in ST/X (kept for a while for subclasses) |
183 depth - these have been added in instVar-slots |
183 depth - these have been added in instVar-slots |
184 maxPixelValue - according to the ST-80's image class. |
184 maxPixelValue - according to the ST-80's image class. |
185 rowByteSize - to allow loading of st-80 images |
185 rowByteSize - to allow loading of st-80 images |
186 - (which are stored as instVarAt:put: expressions) |
186 - (which are stored as instVarAt:put: expressions) |
187 |
187 |
188 [class variables:] |
188 [class variables:] |
189 |
189 |
190 Lobby <Registry> keeps track of known images |
190 Lobby <Registry> keeps track of known images |
191 (for resource freeing with garbage collector) |
191 (for resource freeing with garbage collector) |
192 |
192 |
193 DitherAlgorithm <Symbol> defines how to dither |
193 DitherAlgorithm <Symbol> defines how to dither |
194 |
194 |
195 NumberOfDitherColors <Integer> defines, how many dither colors to use |
195 NumberOfDitherColors <Integer> defines, how many dither colors to use |
196 |
196 |
197 FileFormats <Dictionary> associates filename extensions to |
197 FileFormats <Dictionary> associates filename extensions to |
198 image reader classes (now set-up in startup-file) |
198 image reader classes (now set-up in startup-file) |
199 |
199 |
200 CollectGarbageWhenRunningOutOfColors |
200 CollectGarbageWhenRunningOutOfColors |
201 <Boolean> if true, and we run out of available |
201 <Boolean> if true, and we run out of available |
202 device colors during creation of a |
202 device colors during creation of a |
203 device image, collect garbage for |
203 device image, collect garbage for |
204 possible image reclamation. |
204 possible image reclamation. |
205 If false, proceed immediately. |
205 If false, proceed immediately. |
206 Default is true. |
206 Default is true. |
207 |
207 |
208 ImageNotFoundQuerySignal |
208 ImageNotFoundQuerySignal |
209 <QuerySignal> raised, if an image could not be loaded |
209 <QuerySignal> raised, if an image could not be loaded |
210 from a file. The parameter is the images |
210 from a file. The parameter is the images |
211 fileName. |
211 fileName. |
212 A handler may return a replacement |
212 A handler may return a replacement |
213 image or proceed with nil. |
213 image or proceed with nil. |
214 If unhandled, a nil is returned from the |
214 If unhandled, a nil is returned from the |
215 image creation. |
215 image creation. |
216 |
216 |
217 BadImageFormatQuerySignal |
217 BadImageFormatQuerySignal |
218 <QuerySignal> raised, if an image could not be loaded |
218 <QuerySignal> raised, if an image could not be loaded |
219 from a file due to a file error or |
219 from a file due to a file error or |
220 unsupported format. |
220 unsupported format. |
221 A handler may return a replacement |
221 A handler may return a replacement |
222 image or proceed with nil. |
222 image or proceed with nil. |
223 If unhandled, a nil is returned from the |
223 If unhandled, a nil is returned from the |
224 image creation. |
224 image creation. |
225 |
225 |
226 ImageSaveErrorSignal |
226 ImageSaveErrorSignal |
227 <Signal> parent of errors below. |
227 <Signal> parent of errors below. |
228 |
228 |
229 FileCreationErrorSignal |
229 FileCreationErrorSignal |
230 <Signal> file could not be created when saving an |
230 <Signal> file could not be created when saving an |
231 image. |
231 image. |
232 |
232 |
233 CannotRepresentImageSignal |
233 CannotRepresentImageSignal |
234 <Signal> the specified ImageReader cannot represent |
234 <Signal> the specified ImageReader cannot represent |
235 the given image. |
235 the given image. |
236 |
236 |
237 InformationLostQuerySignal |
237 InformationLostQuerySignal |
238 <Signal> the specified ImageReader can represent |
238 <Signal> the specified ImageReader can represent |
239 the given image, but some information |
239 the given image, but some information |
240 (typically color resolution) is lost. |
240 (typically color resolution) is lost. |
241 If unhandled, the save proceeds as usual. |
241 If unhandled, the save proceeds as usual. |
242 |
242 |
243 |
243 |
244 caveat: |
244 caveat: |
245 the information in |
245 the information in |
246 photometric, bitsPerPixel, bitsPerSample, samplesPerPixel, depth , colorMap and maxPixelValue |
246 photometric, bitsPerPixel, bitsPerSample, samplesPerPixel, depth , colorMap and maxPixelValue |
247 is partially redundant and its handling stupid (not to say: braindamaged ;-). |
247 is partially redundant and its handling stupid (not to say: braindamaged ;-). |
248 The only excuse is that it grew over time, had to incorporate various alien/older schemes for |
248 The only excuse is that it grew over time, had to incorporate various alien/older schemes for |
249 compatibility reasons (mostly coming from tiff format, which was the very first supported format). |
249 compatibility reasons (mostly coming from tiff format, which was the very first supported format). |
250 All of the above belongs into the single colorMap which must migrate from |
250 All of the above belongs into the single colorMap which must migrate from |
251 a stupid seqColl to a color-aware real colorMap. |
251 a stupid seqColl to a color-aware real colorMap. |
252 (we are in the process of doing so...) |
252 (we are in the process of doing so...) |
253 |
253 |
254 todo: |
254 todo: |
255 support alpha masks |
255 support alpha masks |
256 cleanup the dithering & conversion code |
256 cleanup the dithering & conversion code |
257 cleanup the color/photometric mess |
257 cleanup the color/photometric mess |
258 |
258 |
259 [See also:] |
259 [See also:] |
260 Form Icon ImageReader |
260 Form Icon ImageReader |
261 |
261 |
262 [author:] |
262 [author:] |
263 Claus Gittinger |
263 Claus Gittinger |
264 " |
264 " |
265 ! |
265 ! |
266 |
266 |
267 examples |
267 examples |
268 " |
268 " |