176 Supports true color devices with depths: 8, 16, 24 and 32" |
176 Supports true color devices with depths: 8, 16, 24 and 32" |
177 |
177 |
178 |depth |
178 |depth |
179 colorValues |
179 colorValues |
180 form imageBits bestFormat usedDeviceDepth usedDeviceBitsPerPixel |
180 form imageBits bestFormat usedDeviceDepth usedDeviceBitsPerPixel |
181 usedDevicePadding usedDeviceBytesPerRow padd n| |
181 usedDevicePadding usedDeviceBytesPerRow padd| |
182 |
182 |
183 depth := aDevice depth. |
183 depth := aDevice depth. |
184 |
184 |
185 "/ gather r/g/b values for all colors in the map ... |
185 "/ gather r/g/b values for all colors in the map ... |
186 |
186 |
205 |
205 |
206 "/ now, walk over the image and replace |
206 "/ now, walk over the image and replace |
207 "/ colorMap indices by color values in the bits array |
207 "/ colorMap indices by color values in the bits array |
208 |
208 |
209 %{ |
209 %{ |
|
210 unsigned char *srcPtr = 0; |
|
211 unsigned char *dstPtr = 0; |
|
212 OBJ _bytes = __INST(bytes); |
|
213 |
|
214 if (__isByteArray(_bytes)) { |
|
215 srcPtr = _ByteArrayInstPtr(_bytes)->ba_element; |
|
216 } else { |
|
217 if (__isExternalBytesLike(_bytes)) { |
|
218 srcPtr = __externalBytesAddress(_bytes); |
|
219 } |
|
220 } |
|
221 if (__isByteArray(imageBits)) { |
|
222 dstPtr = _ByteArrayInstPtr(imageBits)->ba_element; |
|
223 } else { |
|
224 if (__isExternalBytesLike(imageBits)) { |
|
225 dstPtr = __externalBytesAddress(imageBits); |
|
226 } |
|
227 } |
|
228 |
210 if (__bothSmallInteger(_INST(height), _INST(width)) |
229 if (__bothSmallInteger(_INST(height), _INST(width)) |
211 && __isArray(colorValues) |
230 && __isArray(colorValues) |
212 && __isByteArray(_INST(bytes)) |
231 && srcPtr |
213 && __isByteArray(imageBits)) { |
232 && dstPtr) { |
214 int r,p; |
233 int r,p; |
215 int x, y, w, h, nPix; |
234 int x, y, w, h, nPix; |
216 int byte; |
235 int byte; |
217 |
236 |
218 unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
|
219 unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element; |
|
220 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
237 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
221 |
238 |
222 w = __intVal(_INST(width)); |
239 w = __intVal(_INST(width)); |
223 h = __intVal(_INST(height)); |
240 h = __intVal(_INST(height)); |
224 r = 0; |
241 r = 0; |
262 |
279 |
263 "/ now, walk over the image and replace |
280 "/ now, walk over the image and replace |
264 "/ colorMap indices by color values in the bits array |
281 "/ colorMap indices by color values in the bits array |
265 |
282 |
266 %{ |
283 %{ |
|
284 unsigned char *srcPtr = 0; |
|
285 unsigned char *dstPtr = 0; |
|
286 OBJ _bytes = __INST(bytes); |
|
287 |
|
288 if (__isByteArray(_bytes)) { |
|
289 srcPtr = _ByteArrayInstPtr(_bytes)->ba_element; |
|
290 } else { |
|
291 if (__isExternalBytesLike(_bytes)) { |
|
292 srcPtr = __externalBytesAddress(_bytes); |
|
293 } |
|
294 } |
|
295 if (__isByteArray(imageBits)) { |
|
296 dstPtr = _ByteArrayInstPtr(imageBits)->ba_element; |
|
297 } else { |
|
298 if (__isExternalBytesLike(imageBits)) { |
|
299 dstPtr = __externalBytesAddress(imageBits); |
|
300 } |
|
301 } |
|
302 |
267 if (__bothSmallInteger(_INST(height), _INST(width)) |
303 if (__bothSmallInteger(_INST(height), _INST(width)) |
268 && __isArray(colorValues) |
304 && __isArray(colorValues) |
269 && __isByteArray(_INST(bytes)) |
305 && srcPtr |
270 && __isByteArray(imageBits)) { |
306 && dstPtr) { |
271 int x, y, w, h, nPix; |
307 int x, y, w, h, nPix; |
272 int r,p; |
308 int r,p; |
273 int byte; |
309 int byte; |
274 |
310 |
275 unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
|
276 unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element; |
|
277 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
311 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
278 |
312 |
279 w = __intVal(_INST(width)); |
313 w = __intVal(_INST(width)); |
280 h = __intVal(_INST(height)); |
314 h = __intVal(_INST(height)); |
281 r = 0; |
315 r = 0; |
317 |
351 |
318 "/ now, walk over the image and replace |
352 "/ now, walk over the image and replace |
319 "/ colorMap indices by color values in the bits array |
353 "/ colorMap indices by color values in the bits array |
320 |
354 |
321 %{ |
355 %{ |
|
356 unsigned char *srcPtr = 0; |
|
357 unsigned char *dstPtr = 0; |
|
358 OBJ _bytes = __INST(bytes); |
|
359 |
|
360 if (__isByteArray(_bytes)) { |
|
361 srcPtr = _ByteArrayInstPtr(_bytes)->ba_element; |
|
362 } else { |
|
363 if (__isExternalBytesLike(_bytes)) { |
|
364 srcPtr = __externalBytesAddress(_bytes); |
|
365 } |
|
366 } |
|
367 if (__isByteArray(imageBits)) { |
|
368 dstPtr = _ByteArrayInstPtr(imageBits)->ba_element; |
|
369 } else { |
|
370 if (__isExternalBytesLike(imageBits)) { |
|
371 dstPtr = __externalBytesAddress(imageBits); |
|
372 } |
|
373 } |
|
374 |
322 if (__bothSmallInteger(_INST(height), _INST(width)) |
375 if (__bothSmallInteger(_INST(height), _INST(width)) |
323 && __isArray(colorValues) |
376 && __isArray(colorValues) |
324 && __isByteArray(_INST(bytes)) |
377 && srcPtr |
325 && __isByteArray(imageBits)) { |
378 && dstPtr) { |
326 int x, y, w, h, nPix; |
379 int x, y, w, h, nPix; |
327 int r,p, byte; |
380 int r,p, byte; |
328 |
381 |
329 unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
|
330 unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element; |
|
331 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
382 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
332 |
383 |
333 w = __intVal(_INST(width)); |
384 w = __intVal(_INST(width)); |
334 h = __intVal(_INST(height)); |
385 h = __intVal(_INST(height)); |
335 r = 0; |
386 r = 0; |
367 |
418 |
368 "/ now, walk over the image and replace |
419 "/ now, walk over the image and replace |
369 "/ colorMap indices by color values in the bits array |
420 "/ colorMap indices by color values in the bits array |
370 |
421 |
371 %{ |
422 %{ |
|
423 unsigned char *srcPtr = 0; |
|
424 unsigned char *dstPtr = 0; |
|
425 OBJ _bytes = __INST(bytes); |
|
426 |
|
427 if (__isByteArray(_bytes)) { |
|
428 srcPtr = _ByteArrayInstPtr(_bytes)->ba_element; |
|
429 } else { |
|
430 if (__isExternalBytesLike(_bytes)) { |
|
431 srcPtr = __externalBytesAddress(_bytes); |
|
432 } |
|
433 } |
|
434 if (__isByteArray(imageBits)) { |
|
435 dstPtr = _ByteArrayInstPtr(imageBits)->ba_element; |
|
436 } else { |
|
437 if (__isExternalBytesLike(imageBits)) { |
|
438 dstPtr = __externalBytesAddress(imageBits); |
|
439 } |
|
440 } |
|
441 |
372 if (__bothSmallInteger(_INST(height), _INST(width)) |
442 if (__bothSmallInteger(_INST(height), _INST(width)) |
373 && __isArray(colorValues) |
443 && __isArray(colorValues) |
374 && __isByteArray(_INST(bytes)) |
444 && srcPtr |
375 && __isByteArray(imageBits)) { |
445 && dstPtr) { |
376 int x, y, w, h, nPix; |
446 int x, y, w, h, nPix; |
377 int r, p, byte; |
447 int r, p, byte; |
378 |
448 |
379 unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
|
380 unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element; |
|
381 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
449 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
382 |
450 |
383 w = __intVal(_INST(width)); |
451 w = __intVal(_INST(width)); |
384 h = __intVal(_INST(height)); |
452 h = __intVal(_INST(height)); |
385 r = 0; |
453 r = 0; |
440 |
508 |
441 ^ form |
509 ^ form |
442 |
510 |
443 "Created: 20.10.1995 / 22:05:10 / cg" |
511 "Created: 20.10.1995 / 22:05:10 / cg" |
444 "Modified: 21.10.1995 / 19:30:26 / cg" |
512 "Modified: 21.10.1995 / 19:30:26 / cg" |
445 |
|
446 |
|
447 ! |
513 ! |
448 |
514 |
449 greyImageAsTrueColorFormOn:aDevice |
515 greyImageAsTrueColorFormOn:aDevice |
450 "return a true-color device-form for the grey-image receiver. |
516 "return a true-color device-form for the grey-image receiver. |
451 Supports true color devices with depths: 8, 16, 24 and 32" |
517 Supports true color devices with depths: 8, 16, 24 and 32" |