MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / ComputeTransparency

Function ComputeTransparency

src/Bitmap.c:345–356  ·  view source on GitHub ↗

Sets alpha to 0 for any pixels in the bitmap whose RGB is same as colorspace */

Source from the content-addressed store, hash-verified

343
344/* Sets alpha to 0 for any pixels in the bitmap whose RGB is same as colorspace */
345static 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
358static BitmapCol ExpandRGB(cc_uint8 bitsPerSample, int r, int g, int b) {
359 switch (bitsPerSample) {

Callers 1

Png_DecodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected