Depth24Image.st
changeset 2346 7d018cf65a14
parent 2301 60f9cf7dd066
child 2401 025c115d121a
equal deleted inserted replaced
2345:2a39ca8e8b77 2346:7d018cf65a14
  1098 	    imageBits := ByteArray uninitializedNew:(width * height * 3).
  1098 	    imageBits := ByteArray uninitializedNew:(width * height * 3).
  1099 	    usedDevicePadding := 8.
  1099 	    usedDevicePadding := 8.
  1100 
  1100 
  1101 	    "/ now, walk over the image and compose 24bit values from the r/g/b triples
  1101 	    "/ now, walk over the image and compose 24bit values from the r/g/b triples
  1102 %{
  1102 %{
       
  1103 		unsigned char *srcPtr = 0;
       
  1104 		unsigned char *dstPtr = 0;
       
  1105 
       
  1106 		if (__isByteArray(__INST(bytes))) {
       
  1107 		    srcPtr = _ByteArrayInstPtr(__INST(bytes))->ba_element;
       
  1108 		} else {
       
  1109 		    if (__isExternalBytes(__INST(bytes))) {
       
  1110 			srcPtr = __externalBytesAddress(__INST(bytes));
       
  1111 		    }
       
  1112 		}
       
  1113 		if (__isByteArray(imageBits)) {
       
  1114 		    dstPtr = _ByteArrayInstPtr(imageBits)->ba_element;
       
  1115 		} else {
       
  1116 		    if (__isExternalBytes(imageBits)) {
       
  1117 			dstPtr = __externalBytesAddress(imageBits);
       
  1118 		    }
       
  1119 		}
       
  1120 
  1103 		if (__bothSmallInteger(_INST(height), _INST(width))
  1121 		if (__bothSmallInteger(_INST(height), _INST(width))
  1104 		 && __bothSmallInteger(rightShiftR, shiftRed)
  1122 		 && __bothSmallInteger(rightShiftR, shiftRed)
  1105 		 && __bothSmallInteger(rightShiftG, shiftGreen)
  1123 		 && __bothSmallInteger(rightShiftG, shiftGreen)
  1106 		 && __bothSmallInteger(rightShiftB, shiftBlue)
  1124 		 && __bothSmallInteger(rightShiftB, shiftBlue)
  1107 		 && __isByteArray(_INST(bytes))
  1125 		 && srcPtr
  1108 		 && __isByteArray(imageBits)) {
  1126 		 && dstPtr) {
  1109 		    int rShRed = __intVal(rightShiftR),
  1127 		    int rShRed = __intVal(rightShiftR),
  1110 			rShGreen = __intVal(rightShiftG),
  1128 			rShGreen = __intVal(rightShiftG),
  1111 			rShBlue = __intVal(rightShiftB),
  1129 			rShBlue = __intVal(rightShiftB),
  1112 			lShRed = __intVal(shiftRed),
  1130 			lShRed = __intVal(shiftRed),
  1113 			lShGreen = __intVal(shiftGreen),
  1131 			lShGreen = __intVal(shiftGreen),
  1114 			lShBlue = __intVal(shiftBlue);
  1132 			lShBlue = __intVal(shiftBlue);
  1115 		    int x, y, w;
  1133 		    int x, y, w;
  1116 
       
  1117 		    unsigned char *srcPtr = _ByteArrayInstPtr(_INST(bytes))->ba_element;
       
  1118 		    unsigned char *dstPtr = _ByteArrayInstPtr(imageBits)->ba_element;
       
  1119 
  1134 
  1120 		    w = __intVal(_INST(width));
  1135 		    w = __intVal(_INST(width));
  1121 		    if ((rShRed == 0) && (rShGreen == 0) && (rShBlue == 0)) {
  1136 		    if ((rShRed == 0) && (rShGreen == 0) && (rShBlue == 0)) {
  1122 			for (y=__intVal(_INST(height)); y > 0; y--) {
  1137 			for (y=__intVal(_INST(height)); y > 0; y--) {
  1123 			    for (x=w; x > 0; x--) {
  1138 			    for (x=w; x > 0; x--) {
  2405 ! !
  2420 ! !
  2406 
  2421 
  2407 !Depth24Image class methodsFor:'documentation'!
  2422 !Depth24Image class methodsFor:'documentation'!
  2408 
  2423 
  2409 version
  2424 version
  2410     ^ '$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.65 1998-09-08 10:00:41 cg Exp $'
  2425     ^ '$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.66 1998-09-18 11:44:03 cg Exp $'
  2411 ! !
  2426 ! !