Old NewPicture

I have a project I am looking at and it uses the old NewPicture which was removed before I started playing with Xojo. Could someone give me a quick current way of doing the following as I am not sure what the old NewPicture was doing so having a problem making it work with current Xojo. Thanks

dim tmp as Picture = NewPicture(tabPicture.Width, tabPicture.Height, 32)

It’s actually really simple. Someone else can fill you in on the technicals as to why the change was made, because I don’t recall them off the top of my head. You just use the Picture constructor with the width and height now, no need to handle the depth. Here’s how you update that:

dim tmp as Picture = new Picture(tabPicture.Width, tabPicture.Height)

Just put a space in between “New” and “Picture”.

dim tmp as Picture = New Picture(tabPicture.Width, tabPicture.Height, 32)

or, slightly more concise:

dim tmp as New Picture(tabPicture.Width, tabPicture.Height, 32)

Thanks Guys, that is perfect, I didn’t realise it was that simple :wink:

Just a heads up, from the docs:

Because of that, I tend to lean toward the constructor that doesn’t include the depth.

Thats for that, very useful to know.

Depth vs. no depth are two very different things. It’s the old masking/transparency vs. the new Alpha channel, I believe.