Hi,
REALbasic 2007r1 Pro for Mac OS X 10.4.8
I use the following code to remove Green and Blue from the passed Picture (and
get a cyan image! [1])
surf = Pict.RGBSurface
If surf = Nil Then
// Stop here
Return // Exit silently
End If
// Only let the Blue map
For MapLoop = 0 To 255
RedMap(MapLoop) = MapLoop
GreenMap(MapLoop) = 255
BlueMap(MapLoop) = 255
Next
// Apply the change
surf.Transform RedMap,GreenMap,BlueMap
I use the following code to transform a color image to get a GreyScale image:
surf = Pict.RGBSurface
If surf = Nil Then
// Stop here
Return // Exit silently
End If
For y = h DownTo 0 // scan line after line
For x = w DownTo 0 // pixel after pixel
// Get the Pixel color
aColor = surf.Pixel(x,y)
// Get the RGB atoms
aRed = aColor.Red
aGreen = aColor.Green
aBlue = aColor.Blue
// 'Create' the Grey pixel
aGrey = (aRed + aGreen + aBlue) / 3
// Change the color pixel by a grey pixel
surf.Pixel(x,y) = RGB(aGrey,aGrey,aGrey)
Next
Next
I have also a similar method to remove the GreyScale pixels from the passed
Picture and there too, I do not know how to do.
Since under Linux this kind of methods takes forever to run, I _have_ to use
Map() / .Transform.
How can I do that with a Map ?
a. No, I do not make any tests,
b. Yes, I do not understand how Map() / .Transform works, but I try to use them.
TIA,
Emile
[1] The result is not the one I was expecting: I wanted to remove Green and
Blue to get all Red pixels, but I get cyan pixels! That's life ;) (or :(,
depends of the point of view)
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>