We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have implement screenshot in C, and I found a way not need flip_rows on windows.
flip_rows
BITMAPINFOHEADER bih = {0}; bih.biBitCount = bmp.bmBitsPixel; bih.biCompression = BI_RGB; bih.biHeight = - bmp.bmHeight; // set this to negative
and there need to convert bgra to rgba
unsigned char* bgra2rgba(unsigned char* buf, DWORD size) { if(0 == size % 4) { unsigned char* ret = new unsigned char[size]; // new alloc is only need for my own project memcpy(ret, buf, size); DWORD all_chunks = size / 4; for(DWORD i = 0; i< all_chunks; ++i) { ret[i*4+2] = buf[i*4]; // swap b, r ret[i*4] = buf[i*4+2]; ret[i*4+3] = 255; // alpha channel: XP need this } return ret; } return 0; }
The text was updated successfully, but these errors were encountered:
Just set BITMAPINFOHEADER.biHeight to negative and do
fn bgra2rgba(input: &mut [u8], width: i32, height: i32) { let mut offset = 0; for _ in 0..height * width { let tmp = input[offset]; input[offset] = input[offset + 2]; input[offset + 2] = tmp; offset += 4; } }
Sorry, something went wrong.
No branches or pull requests
I have implement screenshot in C, and I found a way not need
flip_rows
on windows.and there need to convert bgra to rgba
The text was updated successfully, but these errors were encountered: