Sets alpha to 0 for any pixels in the bitmap whose RGB is same as colorspace */
| 343 | |
| 344 | /* Sets alpha to 0 for any pixels in the bitmap whose RGB is same as colorspace */ |
| 345 | static void ComputeTransparency(struct Bitmap* bmp, BitmapCol col) { |
| 346 | BitmapCol trnsRGB = col & BITMAPCOLOR_RGB_MASK; |
| 347 | int x, y, width = bmp->width, height = bmp->height; |
| 348 | |
| 349 | for (y = 0; y < height; y++) { |
| 350 | BitmapCol* row = Bitmap_GetRow(bmp, y); |
| 351 | for (x = 0; x < width; x++) { |
| 352 | BitmapCol rgb = row[x] & BITMAPCOLOR_RGB_MASK; |
| 353 | row[x] = (rgb == trnsRGB) ? trnsRGB : row[x]; |
| 354 | } |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | static BitmapCol ExpandRGB(cc_uint8 bitsPerSample, int r, int g, int b) { |
| 359 | switch (bitsPerSample) { |