--- a/Image.st Tue Mar 27 15:41:44 2018 +0200
+++ b/Image.st Tue Mar 27 15:42:06 2018 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
@@ -3595,7 +3593,8 @@
rgbValueAt:aPoint
"retrieve a pixel's rgb value at x/y;
- return a 24bit rgbValue (rrggbb, red is MSB).
+ return a 24bit rgbValue (rrggbb, red is MSB),
+ or 32bit for alpha images (aarrggbb, alpha is MSB).
Pixels start at 0@0 for the upper left pixel,
and end at (width-1)@(height-1) for the lower right pixel."
@@ -3606,7 +3605,8 @@
rgbValueAtX:x y:y
"retrieve a pixel's rgb value at x/y;
- return a 24bit rgbValue (rrggbb, red is MSB).
+ return a 24bit rgbValue (rrggbb, red is MSB),
+ or 32bit for alpha images (aarrggbb, alpha is MSB).
Pixels start at 0@0 for the upper left pixel,
and end at (width-1)@(height-1) for the lower right pixel."
@@ -3619,6 +3619,9 @@
!
rgbValueAtX:x y:y put:newRGBValue
+ "expects a 24bit rgbValue (rrggbb, red is MSB),
+ or 32bit for alpha images (aarrggbb, alpha is MSB)."
+
|value|
value := self valueFromRGB:newRGBValue.
@@ -3631,6 +3634,7 @@
"retrieve an array filled with pixel values from a single row.
(eg. a horizontal span)
Notice: row/column coordinates start at 0.
+ The interpretation of the pixel values depends on the photometric.
This is a slow fallBack method, which works with any depth;
concrete image subclasses should redefine this for more performance."
@@ -3659,6 +3663,7 @@
rowAt:y into:aPixelBuffer
"fill aBuffer with pixel values retrieved from a single row.
(eg. a horizontal span)
+ The interpretation of the pixel values depends on the photometric.
Notice: row/column coordinates start at 0."
^ self rowAt:y into:aPixelBuffer startingAt:1
@@ -3670,6 +3675,7 @@
rowAt:y into:aPixelBuffer startingAt:startIndex
"fill aBuffer with pixel values retrieved from a single row.
(eg. a horizontal span)
+ The interpretation of the pixel values depends on the photometric.
Notice: row/column coordinates start at 0.
This is a slow fallBack method, which works with any depth;
concrete image subclasses should redefine this for more performance."
@@ -3688,18 +3694,20 @@
rowAt:y putAll:pixelArray
"store a single row's pixels from bits in the argument;
(eg. a horizontal span)
+ The interpretation of the pixel values depends on the photometric.
Notice: row/column coordinates start at 0.
This is a slow fallBack method, which works with any depth;
concrete image subclasses should redefine this for more performance."
- ^ self rowAt:y putAll:pixelArray startingAt:1
+ self rowAt:y putAll:pixelArray startingAt:1
"Modified: 24.4.1997 / 15:51:58 / cg"
!
rowAt:y putAll:pixelArray startingAt:startIndex
"store a single row's pixels from bits in the pixelArray argument;
- (eg. a horizontal span)
+ (eg. a horizontal span)
+ The interpretation of the pixel values depends on the photometric.
Notice: row/column coordinates start at 0.
This is a slow fallBack method, which works with any depth;
concrete image subclasses should redefine this for more performance."
@@ -3710,7 +3718,6 @@
0 to:w do:[:col |
self pixelAtX:col y:y put:(pixelArray at:(col + startIndex))
].
- ^ pixelArray
"Modified: 24.4.1997 / 17:05:57 / cg"
!
@@ -12362,6 +12369,10 @@
value srcRow pixelArray shrink|
(photometric == #rgb or:[photometric == #rgba]) ifFalse:[
+ "/ have only implemented this for RGB images;
+ "/ palette and other images are converted first to this,
+ "/ then magnified. We'll see if we need more work for grayscale images..
+
"/ self assert:false message:'only works with rgb images'.
^ (Depth32Image fromImage:self photometric:#rgb)
hardSmoothingMagnifiedBy:scaleArg
@@ -12381,7 +12392,8 @@
"/ shrinking in both directions
shrink := false.
] ifFalse:[
- "/ mixed - do it in two steps
+ "/ mixed shrink in one, grow in another direction.
+ "/ - do it in two steps
mX > 0 ifTrue:[
^ (self hardSmoothingMagnifiedBy:(mX @ 1) )
hardSmoothingMagnifiedBy:(1 @ mY)
@@ -12450,7 +12462,7 @@
green := (sumGreen / sumWeight) rounded.
blue := (sumBlue / sumWeight) rounded.
rgb := (((red bitShift:8) bitOr:green) bitShift:8) bitOr:blue.
- pixelArray at:col+1 put:rgb.
+ pixelArray at:col+1 put:(self valueFromRGB:rgb).
].
newImage rowAt:row putAll:pixelArray.
].
@@ -12758,7 +12770,7 @@
mag := (anExtent / self extent).
aBoolean ifTrue:[
- ^ self smoothingMagnifiedBy:mag
+ ^ self hardSmoothingMagnifiedBy:mag
].
^ self magnifiedBy:mag