DarkShadow44

Untitled

Aug 20th, 2021
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. void test1(void)
  2. {
  3. BITMAPINFO bitmap_info =
  4. {
  5. .bmiHeader.biSize = sizeof(BITMAPINFO),
  6. .bmiHeader.biWidth = 32,
  7. .bmiHeader.biHeight = 1,
  8. .bmiHeader.biPlanes = 1,
  9. .bmiHeader.biBitCount = 1,
  10. };
  11. unsigned char bitmap_data[4] = {1, 2, 3, 4};
  12. unsigned char bitmap_data_out[4] = {0};
  13.  
  14. HDC dc = CreateCompatibleDC(0);
  15. HBITMAP bitmap = CreateBitmap(32, 1, 1, 1, NULL);
  16.  
  17. SetDIBits(dc, bitmap, 0, 1, bitmap_data, &bitmap_info, DIB_RGB_COLORS);
  18. GetDIBits(dc, bitmap, 0, 1, bitmap_data_out, &bitmap_info, DIB_RGB_COLORS);
  19.  
  20. ok(memcmp(bitmap_data_out, bitmap_data, 4) == 0, "Got %x %x %x %x\n", bitmap_data_out[0], bitmap_data_out[1], bitmap_data_out[2], bitmap_data_out[3]);
  21.  
  22. DeleteObject(bitmap);
  23. DeleteDC(dc);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment