--- a/Depth2Image.st Fri Apr 11 01:41:12 2003 +0200
+++ b/Depth2Image.st Fri Apr 11 02:09:05 2003 +0200
@@ -163,7 +163,7 @@
|depth
colorValues
form imageBits bestFormat usedDeviceDepth usedDeviceBitsPerPixel
- usedDevicePadding usedDeviceBytesPerRow padd n|
+ usedDevicePadding usedDeviceBytesPerRow padd|
depth := aDevice depth.
@@ -192,16 +192,33 @@
"/ colorMap indices by color values in the bits array
%{
+ unsigned char *srcPtr = 0;
+ unsigned char *dstPtr = 0;
+ OBJ _bytes = __INST(bytes);
+
+ if (__isByteArray(_bytes)) {
+ srcPtr = _ByteArrayInstPtr(_bytes)->ba_element;
+ } else {
+ if (__isExternalBytesLike(_bytes)) {
+ srcPtr = __externalBytesAddress(_bytes);
+ }
+ }
+ if (__isByteArray(imageBits)) {
+ dstPtr = _ByteArrayInstPtr(imageBits)->ba_element;
+ } else {
+ if (__isExternalBytesLike(imageBits)) {
+ dstPtr = __externalBytesAddress(imageBits);
+ }
+ }
+
if (__bothSmallInteger(_INST(height), _INST(width))
&& __isArray(colorValues)
- && __isByteArray(_INST(bytes))
- && __isByteArray(imageBits)) {
+ && srcPtr
+ && dstPtr) {
int r,p;
int x, y, w, h, nPix;
int byte, shift;
- unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element;
- unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
w = __intVal(_INST(width));
@@ -253,16 +270,33 @@
"/ colorMap indices by color values in the bits array
%{
+ unsigned char *srcPtr = 0;
+ unsigned char *dstPtr = 0;
+ OBJ _bytes = __INST(bytes);
+
+ if (__isByteArray(_bytes)) {
+ srcPtr = _ByteArrayInstPtr(_bytes)->ba_element;
+ } else {
+ if (__isExternalBytesLike(_bytes)) {
+ srcPtr = __externalBytesAddress(_bytes);
+ }
+ }
+ if (__isByteArray(imageBits)) {
+ dstPtr = _ByteArrayInstPtr(imageBits)->ba_element;
+ } else {
+ if (__isExternalBytesLike(imageBits)) {
+ dstPtr = __externalBytesAddress(imageBits);
+ }
+ }
+
if (__bothSmallInteger(_INST(height), _INST(width))
&& __isArray(colorValues)
- && __isByteArray(_INST(bytes))
- && __isByteArray(imageBits)) {
+ && srcPtr
+ && dstPtr) {
int x, y, w, h, nPix;
int r,p;
int byte, shift;
- unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element;
- unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
w = __intVal(_INST(width));
@@ -312,15 +346,32 @@
"/ colorMap indices by color values in the bits array
%{
+ unsigned char *srcPtr = 0;
+ unsigned char *dstPtr = 0;
+ OBJ _bytes = __INST(bytes);
+
+ if (__isByteArray(_bytes)) {
+ srcPtr = _ByteArrayInstPtr(_bytes)->ba_element;
+ } else {
+ if (__isExternalBytesLike(_bytes)) {
+ srcPtr = __externalBytesAddress(_bytes);
+ }
+ }
+ if (__isByteArray(imageBits)) {
+ dstPtr = _ByteArrayInstPtr(imageBits)->ba_element;
+ } else {
+ if (__isExternalBytesLike(imageBits)) {
+ dstPtr = __externalBytesAddress(imageBits);
+ }
+ }
+
if (__bothSmallInteger(_INST(height), _INST(width))
&& __isArray(colorValues)
- && __isByteArray(_INST(bytes))
- && __isByteArray(imageBits)) {
+ && srcPtr
+ && dstPtr) {
int x, y, w, h, nPix;
int r,p, byte, shift;
- unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element;
- unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
w = __intVal(_INST(width));
@@ -365,15 +416,32 @@
"/ colorMap indices by color values in the bits array
%{
+ unsigned char *srcPtr = 0;
+ unsigned char *dstPtr = 0;
+ OBJ _bytes = __INST(bytes);
+
+ if (__isByteArray(_bytes)) {
+ srcPtr = _ByteArrayInstPtr(_bytes)->ba_element;
+ } else {
+ if (__isExternalBytesLike(_bytes)) {
+ srcPtr = __externalBytesAddress(_bytes);
+ }
+ }
+ if (__isByteArray(imageBits)) {
+ dstPtr = _ByteArrayInstPtr(imageBits)->ba_element;
+ } else {
+ if (__isExternalBytesLike(imageBits)) {
+ dstPtr = __externalBytesAddress(imageBits);
+ }
+ }
+
if (__bothSmallInteger(_INST(height), _INST(width))
&& __isArray(colorValues)
- && __isByteArray(_INST(bytes))
- && __isByteArray(imageBits)) {
+ && srcPtr
+ && dstPtr) {
int x, y, w, h, nPix;
int r, p, byte, shift;
- unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element;
- unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
w = __intVal(_INST(width));
@@ -441,10 +509,6 @@
"Created: 20.10.1995 / 22:05:10 / cg"
"Modified: 21.10.1995 / 19:30:26 / cg"
-
-
-
-
!
greyImageAsTrueColorFormOn:aDevice
@@ -942,5 +1006,5 @@
!Depth2Image class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Depth2Image.st,v 1.42 2003-04-10 14:24:35 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Depth2Image.st,v 1.43 2003-04-11 00:08:58 cg Exp $'
! !