mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-19 15:47:40 +03:00
Fixed 1bpp inversion
This commit is contained in:
parent
432cd66ca4
commit
0218b6bde5
@ -130,9 +130,7 @@ uint8_t* loadBMP(const char* filename, int& width, int& height) {
|
|||||||
int byteIndex = x / 8;
|
int byteIndex = x / 8;
|
||||||
int bitIndex = 7 - (x % 8); // MSB first in BMP file format
|
int bitIndex = 7 - (x % 8); // MSB first in BMP file format
|
||||||
|
|
||||||
// In 1-bit BMPs, bit value 1 typically means black and 0 means white
|
isBlack = (rowBuffer[byteIndex] & (1 << bitIndex)) == 0;
|
||||||
// Check if the bit is set (1) at the specified position
|
|
||||||
isBlack = (rowBuffer[byteIndex] & (1 << bitIndex)) != 0;
|
|
||||||
} else { // 24-bit
|
} else { // 24-bit
|
||||||
// For 24-bit BMPs, convert RGB to grayscale
|
// For 24-bit BMPs, convert RGB to grayscale
|
||||||
// BMP stores colors as BGR (Blue, Green, Red)
|
// BMP stores colors as BGR (Blue, Green, Red)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user