Alpha-channel in the bitmap
-
How to know whether a bitmap has an alpha-channel or not? Best regards, Eugene Pustovoyt
-
How to know whether a bitmap has an alpha-channel or not? Best regards, Eugene Pustovoyt
I'm assuming you have this bitmap in memory - if it's in a file then other methods apply. bool BitmapHasAlpha (HBITMAP hBitmap) { //Vars Bitmap BITMAP; //Get info about the bitmap GetObject (hBitmap, &Bitmap, sizeof(Bitmap)); //Bitmaps with alpha channel use 32 bits per pixel return Bitmap.bmBitsPixel == 32; } Of course, there's no guarantee that the alpha channel is actually being used!
-
I'm assuming you have this bitmap in memory - if it's in a file then other methods apply. bool BitmapHasAlpha (HBITMAP hBitmap) { //Vars Bitmap BITMAP; //Get info about the bitmap GetObject (hBitmap, &Bitmap, sizeof(Bitmap)); //Bitmaps with alpha channel use 32 bits per pixel return Bitmap.bmBitsPixel == 32; } Of course, there's no guarantee that the alpha channel is actually being used!
Yes of cause. This method don't guaranted a result. May be better searching a value more then zero in the fourth byte of
COLORREF
? Best regards, Eugene Pustovoyt
ICQ UIN: 161325180
-
Yes of cause. This method don't guaranted a result. May be better searching a value more then zero in the fourth byte of
COLORREF
? Best regards, Eugene Pustovoyt
ICQ UIN: 161325180
Where does the bitmap come from?