As scraggle suggested, remove anything that isn't pure green. All you have to change to your existing code is this:
if (currentvalueR <> 0 and currentvalueG <> 255 and currentvalueB <> 30)
Might get rough edges, but all the magenta will be gone. Also noticed your "green" is really rgb(0,255,30).
But, if you really want the edges to have AA and simply remove that slight bit of magenta from it, then we could do that too!
I'll state that this method only works as simply as it does here because only two solid colors are involved in the overall makeup of the image, and we know what those two colors are.
Using linear interpolation, determine the amount the green has faded into the magenta to result in the particular color we see. For pure magenta, green has faded completely so we replace those pixels with green with an alpha value of 0. As for the edges, some green will be there resulting in values between 0 and 1. Replace those edge pixels with solid green and adjust their alpha accordingly.
Try this.
Rem Project: Dark Basic Pro Project
Rem Created: Tuesday, October 16, 2012
Rem ***** Main Source File *****
color backdrop 0,rgb(0,0,0)
//set image colorkey 255,0,255
load image "d:\cool.png",1
// make memblock from image
make memblock from image 1,1
// get memblock image values
screenWidth = memblock dword(1,0)
screenHeight = memblock dword(1,4)
bytes = memblock dword(1,8)/8
// loop through the memblock and take out the color 255,0,255
for row = 0 to screenHeight-1
for col = 0 to screenWidth-1
// make sure it gets x,y of screen
post = col*bytes + row*bytes*screenWidth
// get the color data from the memblock
currentvalueB = memblock byte(1,post)
currentvalueG = memblock byte(1,post+1)
currentvalueR = memblock byte(1,post+2)
currentvalueA = memblock byte(1,post+3)
color = rgb(currentvalueR, currentvalueG, currentvalueB)
rem If color is anything but green (in this case rgb[0,255,30] is green)
if (currentvalueR <> 0 and currentvalueG <> 255 and currentvalueB <> 30)
i# = 1.0 - (255.0 - currentvalueG) / -(0-255.0)
currentvalueR = 0
currentvalueG = 255
currentvalueB = 30
currentvalueA = 255*i#
//write the values to update it
write memblock byte 1, post, currentvalueB
write memblock byte 1, post+1, currentvalueG
write memblock byte 1, post+2, currentvalueR
write memblock byte 1, post+3, currentvalueA
endif
next col
next row
// make a object
make object cube 1,10
// delete the image before we apply the update from the memblock
delete image 1
// now update the image from memblock
make image from memblock 1,1
// put it on sprite to see the results
sprite 1,100,0,1
set sprite 1,0,1
//update
sync
wait key
delete memblock 1
end
"You're not going crazy. You're going sane in a crazy world!" ~Tick