a function to determine if a pixel in a bitmap is transparent
| 1353 | } |
| 1354 | // a function to determine if a pixel in a bitmap is transparent |
| 1355 | bool bm_pixel_transparent(int bm_handle, int x, int y) { |
| 1356 | if ((bm_data(bm_handle, 0)) == NULL) |
| 1357 | return 0; // only check 16bit stuff |
| 1358 | uint16_t *data = bm_data(bm_handle, 0); |
| 1359 | data = data + (bm_w(bm_handle, 0) * y) + x; |
| 1360 | if (GameBitmaps[bm_handle].format == BITMAP_FORMAT_4444) { |
| 1361 | int pix = *data; |
| 1362 | if (!(pix >> 12)) |
| 1363 | return true; |
| 1364 | } else { |
| 1365 | if (!(*data & OPAQUE_FLAG)) |
| 1366 | return true; |
| 1367 | } |
| 1368 | return false; |
| 1369 | } |
| 1370 | // a function to determine if a pixel in a bitmap is transparent |
| 1371 | uint16_t bm_pixel(int bm_handle, int x, int y) { |
| 1372 | if ((bm_data(bm_handle, 0)) == NULL) |
no test coverage detected