Page 1 of 1

ImageConvertToAlphaChannel

Posted: Wed Dec 16, 2009 11:49 am
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.

Re: ImageConvertToAlphaChannel

Posted: Wed Dec 16, 2009 12:11 pm
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.

Re: ImageConvertToAlphaChannel

Posted: Wed Dec 16, 2009 12:30 pm
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".