Page 1 of 1

Problem creating png with alpha channel.

Posted: Sat Nov 17, 2007 4:37 pm
by bertrand
I want to use GFLSDK (v2.70) for create png file with alpha channel from DIB on window.
Here is my code:

Code: Select all

------------------------------
                    GFLC_SAVE_PARAMS save_option;
	GFL_ERROR gflError;
	save_option.setFormat(gflGetFormatIndexByName("png"));
	GFLC_BITMAP * bitmap = new GFLC_BITMAP();
	gflError = bitmap->create(GFL_RGBA,128,128);   
//This GFLC_BITMAP is OK with type: GFL_RGBA
	HDIB hdib3d=BitmapToDIB(ghBitmap3d,NULL);
//This DIB is also with 32 bits by pixel
	if (hdib3d) {
		gflError = bitmap->setHBITMAP(hdib3d);  
// Then, the GFLC_BITMAP became a GFL_BGR type (3 components by pixel)!
		bitmap->setTransparentIndex(0);  
 -----------------------
My png file is in RGB, without alpha channel and then no transparency.

I am new on this library, something must be wrong, but what?
Thanks for any answer.
aditional code:

Code: Select all

GFL_ERROR GFLC_BITMAP::setHBITMAP(HDIB hDIB)
{
	ERROR_Check(m_gflBitmap, ""); 
	return  gflConvertDIBIntoBitmap     (hDIB, &m_gflBitmap ); 
} 

Re: Problem creating png with alpha channel.

Posted: Mon Nov 19, 2007 8:17 am
by xnview
Which function do you use for BitmapToDIB?

Re: Problem creating png with alpha channel.

Posted: Mon Nov 19, 2007 9:30 am
by bertrand
xnview wrote:Which function do you use for BitmapToDIB?
I use GetDIBits, but it seems to be OK, the DIB was 32 bits/pixels, and I also trie directly "gflConvertDDBIntoBitmap" with the HBITMAP ghBitmap3d, without success.
Bertrand

Re: Problem creating png with alpha channel.

Posted: Mon Nov 19, 2007 1:09 pm
by xnview
bertrand wrote:
xnview wrote:Which function do you use for BitmapToDIB?
I use GetDIBits, but it seems to be OK, the DIB was 32 bits/pixels, and I also trie directly "gflConvertDDBIntoBitmap" with the HBITMAP ghBitmap3d, without success.
Bertrand
Could you send me your email by PM, i'll send you a fixed version