ImageConvertToAlphaChannel

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
jamirokwai
Enthusiast
Enthusiast
Posts: 796
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

ImageConvertToAlphaChannel

Post by jamirokwai »

Hi,

I'd like to suggest an easy to use function like ImageConvertToAlphaChannel(#SourceImageID, #DestImageID)

This should then add an alphachannel to a loaded image (like I asked in http://www.purebasic.fr/english/viewtop ... =5&t=40307).
Yes, I know, I may display an non-transparent-image with DisplayAlphaImage() and add the Layer. Would be nicer to have a small function for this...

Also possible ImageChangeDepth(#SourceImageID, Depth). So you would change from e.g. 24Bits to 32Bits in a millisecond, and your picture gets the needed transparency-layer.
Regards,
JamiroKwai
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: ImageConvertToAlphaChannel

Post by Kaeru Gaman »

in a millisecond...

but you are aware, that for changing the depth a completely new image object has to be created,
meaning to allocate new mem,
copy the image information partwise (e.g. 3 to 4 byte),
delete the old image,
and by this change the Image-ID ... ?

it is simply not possible to create a new image with the same ID,
and it is not possible to change the depth without creating a new image.
oh... and have a nice day.
jamirokwai
Enthusiast
Enthusiast
Posts: 796
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: ImageConvertToAlphaChannel

Post by jamirokwai »

Kaeru Gaman wrote:in a millisecond...

but you are aware, that for changing the depth a completely new image object has to be created,
meaning to allocate new mem,
copy the image information partwise (e.g. 3 to 4 byte),
delete the old image,
and by this change the Image-ID ... ?

it is simply not possible to create a new image with the same ID,
and it is not possible to change the depth without creating a new image.
Yes. I am aware of this.
What you explained is what I did partially.
The link I proposed shows a code-fragment of a possible solution doing the conversion "manually".
Regards,
JamiroKwai
Post Reply