You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

jerrry94087

Beginner

  • "jerrry94087" is male
  • "jerrry94087" started this thread

Posts: 5

Location: California, USA

  • Send private message

1

Wednesday, April 4th 2012, 6:38am

Why QPixmap::loadFromData fails to load an alpha channel from BMP?

I have an RGBA image in memory that I want to paint on QGLWIdget.
In order to do this, I form BMP image with an alpha channel in memory, and pass it to QPixmap::loadFromData:

pixmap = new QPixmap(szx, szy);
pixmap->loadFromData(bmp_data, sz_bmp, "BMP");

Resulting pixmap doesn't have an alpha channel (hasAlpha returns false), and paints as if there is no alpha.

When I save the same bmp into a file, gimp shows it with an alpha channel.

Why QPixmap::loadFromData doesn't load an alpha channel?
How can I display the computed bitmap with an alpha channel?

2

Wednesday, April 4th 2012, 11:23am

how are you sure bmp_data is an "aalpha image" ?

jerrry94087

Beginner

  • "jerrry94087" is male
  • "jerrry94087" started this thread

Posts: 5

Location: California, USA

  • Send private message

3

Wednesday, April 4th 2012, 6:10pm

how are you sure bmp_data is an "aalpha image" ?

gimp shows that the same binary image has alpha.

Similar threads

Used tags

QPixmap alpha