Transparent for Pictures with alpha channel

Hello, before the new pictures, to change the white of an image in transparent I made
thepicture.transparent = 1
I searched in the documentation and in the forum without finding, how do we do now?
Thanks
Marc

create a mask

But in the Dev Center I read :
In the Picture class, support for alpha channels means that the use of masks is no longer required

Yes, but transparent works only on the old picture type, which means pictures with a mask – see the LR.
You can convert your picture to an old type – say you have a picture with alpha channel named pic:

Dim oldPic As New Picture (pic.width, pic.height, 32) oldPic.Graphics.DrawPicture pic, 0,0 oldPic.Transparent = 1

With an alpha channel, you specify transparency in the color. &cRRGGBBAA, where AA is the alpha (transparency) value. 00 is opaque, FF is fully transparent.

Tim, how would you set ‘transparency in the color’?

oldPic.graphics.forecolor = &cFFFFFFFF

I have an picture, read or built in xojo, and I just want to make the white transparent (or not), as before.
And not turning it into an old format …

So either use the conversion like written above and then convert it back to a picture with alpha channel the same way or use RGBSurface, loop through the pixel data and create another picture from it, replacing each white pixel with a transparent color.
I would guess the first version is faster, but I have not tested it.

I played with both ; copying the picture to a 32 bit depth and applying transparent is WAY faster.

Yes, it works, many thanks - but not with a resolution other than 72
This code creates an image 4 times too small if the original image has a resolution of 300dpi :

dim oldPic As New Picture (pic.width, pic.height, 32)
oldPic.HorizontalResolution = pic.HorizontalResolution
oldPic.VerticalResolution = pic.VerticalResolution
oldPic.Graphics.DrawPicture pic, 0,0
oldPic.Transparent = 1

Yes, the code was a bit sloppy, not taking different resolutions into account.
Extend the line before the last:

oldPic.Graphics.DrawPicture pic, 0, 0, pic.Width, pic.Height, 0, 0, oldpic.Width, oldpic.Height

it’s ok !

But, I am surprised that the new picture format does not allow a function as simple as the previous one …