--- a/Image.st Mon May 05 15:21:43 2008 +0200
+++ b/Image.st Wed May 07 12:14:22 2008 +0200
@@ -9248,36 +9248,36 @@
maxX := minX := p1 x.
(t := p2 x) > maxX ifTrue:[
- maxX := t
+ maxX := t
] ifFalse:[
- t < minX ifTrue:[minX := t].
+ t < minX ifTrue:[minX := t].
].
(t := p3 x) > maxX ifTrue:[
- maxX := t
+ maxX := t
] ifFalse:[
- t < minX ifTrue:[minX := t].
+ t < minX ifTrue:[minX := t].
].
(t := p4 x) > maxX ifTrue:[
- maxX := t
+ maxX := t
] ifFalse:[
- t < minX ifTrue:[minX := t].
+ t < minX ifTrue:[minX := t].
].
maxY := minY := p1 y.
(t := p2 y) > maxY ifTrue:[
- maxY := t
+ maxY := t
] ifFalse:[
- t < minY ifTrue:[minY := t].
+ t < minY ifTrue:[minY := t].
].
(t := p3 y) > maxY ifTrue:[
- maxY := t
+ maxY := t
] ifFalse:[
- t < minY ifTrue:[minY := t].
+ t < minY ifTrue:[minY := t].
].
(t := p4 y) > maxY ifTrue:[
- maxY := t
+ maxY := t
] ifFalse:[
- t < minY ifTrue:[minY := t].
+ t < minY ifTrue:[minY := t].
].
@@ -9296,34 +9296,38 @@
newImage colorMap:colorMap copy.
newImage maskedPixelsAre0:maskedPixelsAre0.
mask notNil ifTrue:[
- newImage mask:(mask rotated:degrees)
+ newImage mask:(mask rotated:degrees)
] ifFalse:[
- self isMask ifFalse:[
- self depth ~~ 1 ifTrue:[
- m := ImageMask width:width height:height.
- m bits:(maskBits := ByteArray new:(m bytesPerRow * height)).
- maskBits atAllPut:16rFF.
- newImage mask:(m rotated:degrees)
- ]
- ]
- ].
-
- maskedPixelsAre0 ifTrue:[
- blackPixel := 0.
- ] ifFalse:[
- blackPixel := self valueFromColor:Color black.
- blackPixel isNil ifTrue:[
- blackPixel := self valueFromColor:Color white.
- blackPixel isNil ifTrue:[
- blackPixel := 0.
- ]
- ]
- ].
- self isMask ifTrue:[
- blackPixel := 0.
+ self isMask ifFalse:[
+ self depth ~~ 1 ifTrue:[
+ m := ImageMask width:width height:height.
+ m bits:(maskBits := ByteArray new:(m bytesPerRow * height)).
+ maskBits atAllPut:16rFF.
+ newImage mask:(m rotated:degrees)
+ ]
+ ]
].
myDepth := self depth.
+ myDepth == 1 ifTrue:[
+ blackPixel := 0.
+ ] ifFalse:[
+ maskedPixelsAre0 ifTrue:[
+ blackPixel := 0.
+ ] ifFalse:[
+ blackPixel := self valueFromColor:Color black.
+ blackPixel isNil ifTrue:[
+ blackPixel := self valueFromColor:Color white.
+ blackPixel isNil ifTrue:[
+ blackPixel := 0.
+ ]
+ ]
+ ].
+ self isMask ifTrue:[
+ blackPixel := 0.
+ ].
+ ].
+
newBits atAllPut:0.
"/ now, walk over destination pixels,
@@ -9364,583 +9368,583 @@
&& __isFloat(halfH)
&& __isByteArray(newBits)
&& __isByteArray(__INST(bytes))) {
- __srcBytes = __ByteArrayInstPtr(__INST(bytes))->ba_element;
- __dstBytes = __ByteArrayInstPtr(newBits)->ba_element;
- __nSrcBytes = __byteArraySize(__INST(bytes));
- __nDstBytes = __byteArraySize(newBits);
- __blackPixel = __intVal(blackPixel);
-
- __radians = __floatVal(radians);
- __radians = -__radians; /* sigh: clock-wise */
- __sin = sin(__radians);
- __cos = cos(__radians);
- __minX = __floatVal(minX);
- __minY = __floatVal(minY);
- __halfW = __floatVal(halfW);
- __halfH = __floatVal(halfH);
-
- __dstRowPtr = __dstBytes;
- __dstEndPtr = __dstBytes + __nDstBytes;
+ __srcBytes = __ByteArrayInstPtr(__INST(bytes))->ba_element;
+ __dstBytes = __ByteArrayInstPtr(newBits)->ba_element;
+ __nSrcBytes = __byteArraySize(__INST(bytes));
+ __nDstBytes = __byteArraySize(newBits);
+ __blackPixel = __intVal(blackPixel);
+
+ __radians = __floatVal(radians);
+ __radians = -__radians; /* sigh: clock-wise */
+ __sin = sin(__radians);
+ __cos = cos(__radians);
+ __minX = __floatVal(minX);
+ __minY = __floatVal(minY);
+ __halfW = __floatVal(halfW);
+ __halfH = __floatVal(halfH);
+
+ __dstRowPtr = __dstBytes;
+ __dstEndPtr = __dstBytes + __nDstBytes;
# define EARLY_OUT
# define FAST_ADVANCE 5
# define FAST_ADVANCE2
- switch (__depth) {
- case 8:
- for (__dstY = 0; __dstY < __newHeight; __dstY++) {
- double __pY, __sinPY, __cosPY;
+ switch (__depth) {
+ case 8:
+ for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+ double __pY, __sinPY, __cosPY;
#ifdef EARLY_OUT
- int didFetchInRow = 0;
+ int didFetchInRow = 0;
#endif
- __pY = (double)(__dstY + __minY);
-
- __sinPY = __sin * __pY;
- __cosPY = __cos * __pY;
-
- __dstPtr = __dstRowPtr;
- __dstRowPtr += __dstBytesPerRow;
-
- for (__dstX = 0; __dstX < __newWidth; __dstX++) {
- double __pX, __nX;
- unsigned __pix;
-
- /* translate X in destination (center to 0/0) */
- __pX = (double)(__dstX + __minX);
- /* rotate X */
- __nX = (__cos * __pX) - __sinPY;
-
- /* translate X in source (origin to 0/0) */
- __nX = __nX + __halfW + 0.5;
-
- /* inside ? */
- if (__nX < 0) {
+ __pY = (double)(__dstY + __minY);
+
+ __sinPY = __sin * __pY;
+ __cosPY = __cos * __pY;
+
+ __dstPtr = __dstRowPtr;
+ __dstRowPtr += __dstBytesPerRow;
+
+ for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+ double __pX, __nX;
+ unsigned __pix;
+
+ /* translate X in destination (center to 0/0) */
+ __pX = (double)(__dstX + __minX);
+ /* rotate X */
+ __nX = (__cos * __pX) - __sinPY;
+
+ /* translate X in source (origin to 0/0) */
+ __nX = __nX + __halfW + 0.5;
+
+ /* inside ? */
+ if (__nX < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE
- if (__blackPixel == 0) {
- do {
- /* try advance by FAST_ADVANCE pixels ... */
- __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nX = (__cos * __pX) - __sinPY;
- __nX = __nX + __halfW + 0.5;
- } while (__nX < 0);
- __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by FAST_ADVANCE pixels ... */
+ __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nX = (__cos * __pX) - __sinPY;
+ __nX = __nX + __halfW + 0.5;
+ } while (__nX < 0);
+ __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcX;
-
- __srcX = (int)__nX;
- /* inside ? */
- if (__srcX >= __width) {
+ __pix = __blackPixel;
+ } else {
+ int __srcX;
+
+ __srcX = (int)__nX;
+ /* inside ? */
+ if (__srcX >= __width) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE2
- if (__blackPixel == 0) {
- do {
- /* try advance by FAST_ADVANCE pixels ... */
- __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nX = (__cos * __pX) - __sinPY;
- __nX = __nX + __halfW + 0.5;
- __srcX = (int)__nX;
- } while (__srcX >= __width);
- __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by FAST_ADVANCE pixels ... */
+ __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nX = (__cos * __pX) - __sinPY;
+ __nX = __nX + __halfW + 0.5;
+ __srcX = (int)__nX;
+ } while (__srcX >= __width);
+ __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+ }
#endif
- __pix = __blackPixel;
- } else {
- double __nY;
-
- /* rotate Y */
- __nY = (__sin * __pX) + __cosPY;
- /* translate Y in source (origin to 0/0) */
- __nY = __nY + __halfH + 0.5;
-
- /* inside ? */
- if (__nY < 0) {
+ __pix = __blackPixel;
+ } else {
+ double __nY;
+
+ /* rotate Y */
+ __nY = (__sin * __pX) + __cosPY;
+ /* translate Y in source (origin to 0/0) */
+ __nY = __nY + __halfH + 0.5;
+
+ /* inside ? */
+ if (__nY < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE2
- if (__blackPixel == 0) {
- do {
- /* try advance by FAST_ADVANCE pixels ... */
- __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nY = (__sin * __pX) + __cosPY;
- __nY = __nY + __halfH + 0.5;
- } while (__nY < 0);
- __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by FAST_ADVANCE pixels ... */
+ __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nY = (__sin * __pX) + __cosPY;
+ __nY = __nY + __halfH + 0.5;
+ } while (__nY < 0);
+ __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcY;
-
- __srcY = (int)__nY;
- /* inside ? */
- if (__srcY >= __height) {
+ __pix = __blackPixel;
+ } else {
+ int __srcY;
+
+ __srcY = (int)__nY;
+ /* inside ? */
+ if (__srcY >= __height) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE
- if (__blackPixel == 0) {
- do {
- /* try advance by FAST_ADVANCE pixels ... */
- __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nY = (__sin * __pX) + __cosPY;
- __nY = __nY + __halfH + 0.5;
- __srcY = (int)__nY;
- } while (__srcY >= __height);
- __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by FAST_ADVANCE pixels ... */
+ __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nY = (__sin * __pX) + __cosPY;
+ __nY = __nY + __halfH + 0.5;
+ __srcY = (int)__nY;
+ } while (__srcY >= __height);
+ __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+ }
#endif
- __pix = __blackPixel;
- } else {
- /* fetch source pixel */
-
- int idx;
+ __pix = __blackPixel;
+ } else {
+ /* fetch source pixel */
+
+ int idx;
#ifdef EARLY_OUT
- didFetchInRow = 1;
+ didFetchInRow = 1;
#endif
- idx = __srcY * __srcBytesPerRow + __srcX;
- if ((unsigned)idx < __nSrcBytes) {
- __pix = __srcBytes[idx];
- } else {
- __pix = __blackPixel;
- }
- }
- }
- }
- }
-
- if (__pix != 0) {
- *__dstPtr = __pix;
- }
- __dstPtr++;
- }
- }
- break;
-
- case 1:
- for (__dstY = 0; __dstY < __newHeight; __dstY++) {
- double __pY, __sinPY, __cosPY;
+ idx = __srcY * __srcBytesPerRow + __srcX;
+ if ((unsigned)idx < __nSrcBytes) {
+ __pix = __srcBytes[idx];
+ } else {
+ __pix = __blackPixel;
+ }
+ }
+ }
+ }
+ }
+
+ if (__pix != 0) {
+ *__dstPtr = __pix;
+ }
+ __dstPtr++;
+ }
+ }
+ break;
+
+ case 1:
+ for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+ double __pY, __sinPY, __cosPY;
#ifdef EARLY_OUT
- int didFetchInRow = 0;
+ int didFetchInRow = 0;
#endif
- __pY = (double)(__dstY + __minY);
-
- __sinPY = __sin * __pY;
- __cosPY = __cos * __pY;
-
- __dstPtr = __dstRowPtr;
- __dstMask = 0x80;
- __dstRowPtr += __dstBytesPerRow;
-
- for (__dstX = 0; __dstX < __newWidth; __dstX++) {
- double __pX, __nX;
- int __pix;
-
- /* translate X in destination (center to 0/0) */
- __pX = (double)(__dstX + __minX);
- /* rotate X */
- __nX = (__cos * __pX) - __sinPY;
-
- /* translate X in source (origin to 0/0) */
- __nX = __nX + __halfW + 0.5;
-
- /* inside ? */
- if (__nX < 0) {
+ __pY = (double)(__dstY + __minY);
+
+ __sinPY = __sin * __pY;
+ __cosPY = __cos * __pY;
+
+ __dstPtr = __dstRowPtr;
+ __dstMask = 0x80;
+ __dstRowPtr += __dstBytesPerRow;
+
+ for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+ double __pX, __nX;
+ int __pix;
+
+ /* translate X in destination (center to 0/0) */
+ __pX = (double)(__dstX + __minX);
+ /* rotate X */
+ __nX = (__cos * __pX) - __sinPY;
+
+ /* translate X in source (origin to 0/0) */
+ __nX = __nX + __halfW + 0.5;
+
+ /* inside ? */
+ if (__nX < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE
- if (__blackPixel == 0) {
- do {
- /* try advance by 8 pixels ... */
- __dstX += 8; __dstPtr ++;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nX = (__cos * __pX) - __sinPY;
- __nX = __nX + __halfW + 0.5;
- } while (__nX < 0);
- __dstX -= 8; __dstPtr--;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by 8 pixels ... */
+ __dstX += 8; __dstPtr ++;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nX = (__cos * __pX) - __sinPY;
+ __nX = __nX + __halfW + 0.5;
+ } while (__nX < 0);
+ __dstX -= 8; __dstPtr--;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcX;
-
- __srcX = (int)__nX;
- /* inside ? */
- if (__srcX >= __width) {
+ __pix = __blackPixel;
+ } else {
+ int __srcX;
+
+ __srcX = (int)__nX;
+ /* inside ? */
+ if (__srcX >= __width) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE2
- if (__blackPixel == 0) {
- do {
- /* try advance by 8 pixels ... */
- __dstX += 8; __dstPtr++;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nX = (__cos * __pX) - __sinPY;
- __nX = __nX + __halfW + 0.5;
- __srcX = (int)__nX;
- } while (__srcX >= __width);
- __dstX -= 8; __dstPtr--;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by 8 pixels ... */
+ __dstX += 8; __dstPtr++;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nX = (__cos * __pX) - __sinPY;
+ __nX = __nX + __halfW + 0.5;
+ __srcX = (int)__nX;
+ } while (__srcX >= __width);
+ __dstX -= 8; __dstPtr--;
+ }
#endif
- __pix = __blackPixel;
- } else {
- double __nY;
-
- /* rotate Y */
- __nY = (__sin * __pX) + __cosPY;
- /* translate Y in source (origin to 0/0) */
- __nY = __nY + __halfH + 0.5;
-
- /* inside ? */
- if (__nY < 0) {
+ __pix = __blackPixel;
+ } else {
+ double __nY;
+
+ /* rotate Y */
+ __nY = (__sin * __pX) + __cosPY;
+ /* translate Y in source (origin to 0/0) */
+ __nY = __nY + __halfH + 0.5;
+
+ /* inside ? */
+ if (__nY < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE2
- if (__blackPixel == 0) {
- do {
- /* try advance by 8 pixels ... */
- __dstX += 8; __dstPtr++;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nY = (__sin * __pX) + __cosPY;
- __nY = __nY + __halfH + 0.5;
- } while (__nY < 0);
- __dstX -= 8; __dstPtr--;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by 8 pixels ... */
+ __dstX += 8; __dstPtr++;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nY = (__sin * __pX) + __cosPY;
+ __nY = __nY + __halfH + 0.5;
+ } while (__nY < 0);
+ __dstX -= 8; __dstPtr--;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcY;
-
- __srcY = (int)__nY;
- /* inside ? */
- if (__srcY >= __height) {
+ __pix = __blackPixel;
+ } else {
+ int __srcY;
+
+ __srcY = (int)__nY;
+ /* inside ? */
+ if (__srcY >= __height) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE
- if (__blackPixel == 0) {
- do {
- /* try advance by 8 pixels ... */
- __dstX += 8; __dstPtr++;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nY = (__sin * __pX) + __cosPY;
- __nY = __nY + __halfH + 0.5;
- __srcY = (int)__nY;
- } while (__srcY >= __height);
- __dstX -= 8; __dstPtr--;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by 8 pixels ... */
+ __dstX += 8; __dstPtr++;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nY = (__sin * __pX) + __cosPY;
+ __nY = __nY + __halfH + 0.5;
+ __srcY = (int)__nY;
+ } while (__srcY >= __height);
+ __dstX -= 8; __dstPtr--;
+ }
#endif
- __pix = __blackPixel;
- } else {
- /* fetch source pixel */
-
- int idx, pV;
+ __pix = __blackPixel;
+ } else {
+ /* fetch source pixel */
+
+ int idx, pV;
#ifdef EARLY_OUT
- didFetchInRow = 1;
+ didFetchInRow = 1;
#endif
- idx = __srcY * __srcBytesPerRow + (__srcX >> 3);
- if ((unsigned)idx < __nSrcBytes) {
- pV = __srcBytes[idx];
- __pix = (pV & (0x80 >> (__srcX & 7))) ? 1 : 0;
- } else {
- __pix = __blackPixel;
- }
- }
- }
- }
- }
-
- /* store pixel */
- if (__pix != 0) {
- *__dstPtr |= __dstMask;
- }
- __dstMask >>= 1;
- if (__dstMask == 0) {
- __dstMask = 0x80;
- __dstPtr++;
- }
- }
- }
- break;
-
- case 24:
- for (__dstY = 0; __dstY < __newHeight; __dstY++) {
- double __pY, __sinPY, __cosPY;
+ idx = __srcY * __srcBytesPerRow + (__srcX >> 3);
+ if ((unsigned)idx < __nSrcBytes) {
+ pV = __srcBytes[idx];
+ __pix = (pV & (0x80 >> (__srcX & 7))) ? 1 : 0;
+ } else {
+ __pix = __blackPixel;
+ }
+ }
+ }
+ }
+ }
+
+ /* store pixel */
+ if (__pix != 0) {
+ *__dstPtr |= __dstMask;
+ }
+ __dstMask >>= 1;
+ if (__dstMask == 0) {
+ __dstMask = 0x80;
+ __dstPtr++;
+ }
+ }
+ }
+ break;
+
+ case 24:
+ for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+ double __pY, __sinPY, __cosPY;
#ifdef EARLY_OUT
- int didFetchInRow = 0;
+ int didFetchInRow = 0;
#endif
- __pY = (double)(__dstY + __minY);
-
- __sinPY = __sin * __pY;
- __cosPY = __cos * __pY;
-
- __dstPtr = __dstRowPtr;
- __dstRowPtr += __dstBytesPerRow;
-
- for (__dstX = 0; __dstX < __newWidth; __dstX++) {
- double __pX, __nX;
- unsigned __pix;
-
- /* translate X in destination (center to 0/0) */
- __pX = (double)(__dstX + __minX);
- /* rotate X */
- __nX = (__cos * __pX) - __sinPY;
-
- /* translate X in source (origin to 0/0) */
- __nX = __nX + __halfW + 0.5;
-
- /* inside ? */
- if (__nX < 0) {
+ __pY = (double)(__dstY + __minY);
+
+ __sinPY = __sin * __pY;
+ __cosPY = __cos * __pY;
+
+ __dstPtr = __dstRowPtr;
+ __dstRowPtr += __dstBytesPerRow;
+
+ for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+ double __pX, __nX;
+ unsigned __pix;
+
+ /* translate X in destination (center to 0/0) */
+ __pX = (double)(__dstX + __minX);
+ /* rotate X */
+ __nX = (__cos * __pX) - __sinPY;
+
+ /* translate X in source (origin to 0/0) */
+ __nX = __nX + __halfW + 0.5;
+
+ /* inside ? */
+ if (__nX < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcX;
-
- __srcX = (int)__nX;
- /* inside ? */
- if (__srcX >= __width) {
+ __pix = __blackPixel;
+ } else {
+ int __srcX;
+
+ __srcX = (int)__nX;
+ /* inside ? */
+ if (__srcX >= __width) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = __blackPixel;
- } else {
- double __nY;
-
- /* rotate Y */
- __nY = (__sin * __pX) + __cosPY;
- /* translate Y in source (origin to 0/0) */
- __nY = __nY + __halfH + 0.5;
-
- /* inside ? */
- if (__nY < 0) {
+ __pix = __blackPixel;
+ } else {
+ double __nY;
+
+ /* rotate Y */
+ __nY = (__sin * __pX) + __cosPY;
+ /* translate Y in source (origin to 0/0) */
+ __nY = __nY + __halfH + 0.5;
+
+ /* inside ? */
+ if (__nY < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcY;
-
- __srcY = (int)__nY;
- /* inside ? */
- if (__srcY >= __height) {
+ __pix = __blackPixel;
+ } else {
+ int __srcY;
+
+ __srcY = (int)__nY;
+ /* inside ? */
+ if (__srcY >= __height) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = __blackPixel;
- } else {
- /* fetch source pixel */
-
- int idx;
+ __pix = __blackPixel;
+ } else {
+ /* fetch source pixel */
+
+ int idx;
#ifdef EARLY_OUT
- didFetchInRow = 1;
+ didFetchInRow = 1;
#endif
- idx = __srcY * __srcBytesPerRow + __srcX + __srcX + __srcX;
- if ((unsigned)idx < __nSrcBytes) {
- __pix = __srcBytes[idx];
- __pix = (__pix<<8) | __srcBytes[idx+1];
- __pix = (__pix<<8) | __srcBytes[idx+2];
- } else {
- __pix = __blackPixel;
- }
- }
- }
- }
- }
-
- /* store pixel */
- if (__pix != 0) {
- __dstPtr[0] = (__pix >> 16 & 0xFF);
- __dstPtr[1] = (__pix >> 8) & 0xFF;
- __dstPtr[2] = __pix & 0xFF;
- }
- __dstPtr += 3;
- }
- }
- break;
-
- default:
- for (__dstY = 0; __dstY < __newHeight; __dstY++) {
- double __pY, __sinPY, __cosPY;
+ idx = __srcY * __srcBytesPerRow + __srcX + __srcX + __srcX;
+ if ((unsigned)idx < __nSrcBytes) {
+ __pix = __srcBytes[idx];
+ __pix = (__pix<<8) | __srcBytes[idx+1];
+ __pix = (__pix<<8) | __srcBytes[idx+2];
+ } else {
+ __pix = __blackPixel;
+ }
+ }
+ }
+ }
+ }
+
+ /* store pixel */
+ if (__pix != 0) {
+ __dstPtr[0] = (__pix >> 16 & 0xFF);
+ __dstPtr[1] = (__pix >> 8) & 0xFF;
+ __dstPtr[2] = __pix & 0xFF;
+ }
+ __dstPtr += 3;
+ }
+ }
+ break;
+
+ default:
+ for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+ double __pY, __sinPY, __cosPY;
#ifdef EARLY_OUT
- int didFetchInRow = 0;
+ int didFetchInRow = 0;
#endif
- __pY = (double)(__dstY + __minY);
-
- __sinPY = __sin * __pY;
- __cosPY = __cos * __pY;
-
- __dstPtr = __dstRowPtr;
- __dstMask = 0x80;
- __dstRowPtr += __dstBytesPerRow;
-
- for (__dstX = 0; __dstX < __newWidth; __dstX++) {
- double __pX, __nX;
- OBJ __pix;
-
- /* translate X in destination (center to 0/0) */
- __pX = (double)(__dstX + __minX);
- /* rotate X */
- __nX = (__cos * __pX) - __sinPY;
-
- /* translate X in source (origin to 0/0) */
- __nX = __nX + __halfW + 0.5;
-
- /* inside ? */
- if (__nX < 0) {
+ __pY = (double)(__dstY + __minY);
+
+ __sinPY = __sin * __pY;
+ __cosPY = __cos * __pY;
+
+ __dstPtr = __dstRowPtr;
+ __dstMask = 0x80;
+ __dstRowPtr += __dstBytesPerRow;
+
+ for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+ double __pX, __nX;
+ OBJ __pix;
+
+ /* translate X in destination (center to 0/0) */
+ __pX = (double)(__dstX + __minX);
+ /* rotate X */
+ __nX = (__cos * __pX) - __sinPY;
+
+ /* translate X in source (origin to 0/0) */
+ __nX = __nX + __halfW + 0.5;
+
+ /* inside ? */
+ if (__nX < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = blackPixel;
- } else {
- int __srcX;
-
- __srcX = (int)__nX;
- /* inside ? */
- if (__srcX >= __width) {
+ __pix = blackPixel;
+ } else {
+ int __srcX;
+
+ __srcX = (int)__nX;
+ /* inside ? */
+ if (__srcX >= __width) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = blackPixel;
- } else {
- double __nY;
-
- /* rotate Y */
- __nY = (__sin * __pX) + __cosPY;
- /* translate Y in source (origin to 0/0) */
- __nY = __nY + __halfH + 0.5;
-
- /* inside ? */
- if (__nY < 0) {
+ __pix = blackPixel;
+ } else {
+ double __nY;
+
+ /* rotate Y */
+ __nY = (__sin * __pX) + __cosPY;
+ /* translate Y in source (origin to 0/0) */
+ __nY = __nY + __halfH + 0.5;
+
+ /* inside ? */
+ if (__nY < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = blackPixel;
- } else {
- int __srcY;
-
- __srcY = (int)__nY;
- /* inside ? */
- if (__srcY >= __height) {
+ __pix = blackPixel;
+ } else {
+ int __srcY;
+
+ __srcY = (int)__nY;
+ /* inside ? */
+ if (__srcY >= __height) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = blackPixel;
- } else {
- /* fetch source pixel */
-
- static struct inlineCache valAt = _ILC2;
+ __pix = blackPixel;
+ } else {
+ /* fetch source pixel */
+
+ static struct inlineCache valAt = _ILC2;
#ifdef EARLY_OUT
- didFetchInRow = 1;
+ didFetchInRow = 1;
#endif
- __pix = (*valAt.ilc_func)(self,
- @symbol(pixelAtX:y:),
- nil, &valAt,
- __MKSMALLINT(__srcX),
- __MKSMALLINT(__srcY));
- }
- }
- }
- }
-
- /* store pixel */
- {
- static struct inlineCache atPutVal = _ILC3;
-
- if (__pix != __MKSMALLINT(0)) {
- (*atPutVal.ilc_func)(newImage,
- @symbol(pixelAtX:y:put:),
- nil, &atPutVal,
- __MKSMALLINT(__dstX),
- __MKSMALLINT(__dstY),
- __pix
- );
- }
- }
- }
- }
- break;
- }
-
- bad = false;
+ __pix = (*valAt.ilc_func)(self,
+ @symbol(pixelAtX:y:),
+ nil, &valAt,
+ __MKSMALLINT(__srcX),
+ __MKSMALLINT(__srcY));
+ }
+ }
+ }
+ }
+
+ /* store pixel */
+ {
+ static struct inlineCache atPutVal = _ILC3;
+
+ if (__pix != __MKSMALLINT(0)) {
+ (*atPutVal.ilc_func)(newImage,
+ @symbol(pixelAtX:y:put:),
+ nil, &atPutVal,
+ __MKSMALLINT(__dstX),
+ __MKSMALLINT(__dstY),
+ __pix
+ );
+ }
+ }
+ }
+ }
+ break;
+ }
+
+ bad = false;
}
%}.
bad ifTrue:[
- "/ should not happen
- self primitiveFailed
+ "/ should not happen
+ self primitiveFailed
"/ sinRot := radians negated sin.
"/ cosRot := radians negated cos.
@@ -10007,9 +10011,9 @@
i := Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'.
Transcript showCR:(
- Time millisecondsToRun:[
- i rotated:45.
- ]
+ Time millisecondsToRun:[
+ i rotated:45.
+ ]
).
"
"
@@ -10020,12 +10024,12 @@
v openAndWait.
rot := 0.
[true] whileTrue:[
- rI := i rotated:rot.
- rI := rI onDevice:v device.
- v clear.
- v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
- rot := rot + 5.
- rI close.
+ rI := i rotated:rot.
+ rI := rI onDevice:v device.
+ v clear.
+ v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
+ rot := rot + 5.
+ rI close.
]
"
"
@@ -10036,12 +10040,12 @@
v openAndWait.
rot := 0.
[true] whileTrue:[
- rI := i rotated:rot.
- rI := rI onDevice:v device.
- v clear.
- v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
- rot := rot + 5.
- rI close.
+ rI := i rotated:rot.
+ rI := rI onDevice:v device.
+ v clear.
+ v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
+ rot := rot + 5.
+ rI close.
]
"
@@ -12998,7 +13002,7 @@
!Image class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.401 2008-04-22 16:17:30 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.402 2008-05-07 10:14:22 cg Exp $'
! !
Image initialize!