Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

IBITMAP_GetPixel() returns 20 (NO SUPPORTED), Why?

Using IDIB? I want to get pixel of mono-color bitmap, I dont know format of dib of mono-color bitmap.

If you're using a Windows B/W BMP, you can strip the BITMAPFILEHEADER structure in order to do something like:
1. Load your BMP into a byte* buf;
2. The pixels array start at buf + *((uint16*)(buf+10)), that is, the 10th byte is a word representing the offset of the pixel array;
3. Each byte in this array encodes 8 pixels, and it starts from bottom-right... With some and's and pointer arithmetics, you can get the pixel value;

If you're using a Windows B/W BMP, you can strip the BITMAPFILEHEADER structure in order to do something like:
1. Load your BMP into a byte* buf;
2. The pixels array start at buf + *((uint16*)(buf+10)), that is, the 10th byte is a word representing the offset of the pixel array;
3. Each byte in this array encodes 8 pixels, and it starts from bottom-right... With some and's and pointer arithmetics, you can get the pixel value;

If you've already got the IDIB, getting the values of specific pixels is not difficult. The format of the IDIB structure is documented in the API docs.

If you've already got the IDIB, getting the values of specific pixels is not difficult. The format of the IDIB structure is documented in the API docs.

IDIB->pBmp points to pixel data.

IDIB->pBmp points to pixel data.