--- a/Depth4Image.st Fri Apr 11 01:41:12 2003 +0200
+++ b/Depth4Image.st Fri Apr 11 02:09:05 2003 +0200
@@ -178,7 +178,7 @@
|depth
colorValues
form imageBits bestFormat usedDeviceDepth usedDeviceBitsPerPixel
- usedDevicePadding usedDeviceBytesPerRow padd n|
+ usedDevicePadding usedDeviceBytesPerRow padd|
depth := aDevice depth.
@@ -207,16 +207,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;
- 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));
@@ -264,16 +281,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;
- 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));
@@ -319,15 +353,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;
- 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));
@@ -369,15 +420,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;
- 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));
@@ -442,8 +510,6 @@
"Created: 20.10.1995 / 22:05:10 / cg"
"Modified: 21.10.1995 / 19:30:26 / cg"
-
-
!
greyImageAsTrueColorFormOn:aDevice
@@ -973,5 +1039,5 @@
!Depth4Image class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.41 2003-04-10 14:24:41 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.42 2003-04-11 00:09:05 cg Exp $'
! !