You are not logged in.

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