retrieving alpha channel value

Greetings,

Will this code retrieve the alpha channel value?

It seems not to. I can get red, green and blue values.
Please advise,

Thanks!

OPEN Event
dim alphaValue as integer
dim Pic as picture
Pic=new picture(canvas.width, canvas.height)
canvas.DrawInto(Pic.Graphics, 0, 0)
dim rgbs as RGBSurface
rgbs=Pic.RGBSurface

MouseDown Event
Dim PixelColor As Color
pixelColor=rgbs.Pixel(xPixel, yPixel) <---- does this pick up the alpha channel?
alphaValue=pixelColor.alpha

The problem is that you’re working the wrong way around. Store your Picture, read the alpha value from that via RGBSurface and use the Picture to draw onto your canvas when you want to display it.

Here’s a little example, give it a run, click on the pink rectangle and take a look at the debug output.

https://www.dropbox.com/s/7mt275t3jep6dd7/TestGetAlphaValue.xojo_binary_project?dl=1