Changes in uspace/lib/softrend/compose.c [6d5e378:b22b449d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/softrend/compose.c
r6d5e378 rb22b449d 53 53 pixel_t compose_over(pixel_t fg, pixel_t bg) 54 54 { 55 double mul;56 double mul_cmp;55 uint16_t mf; 56 uint16_t mb; 57 57 58 doubleres_a;59 doubleres_r;60 doubleres_g;61 doubleres_b;58 uint8_t res_a; 59 uint8_t res_r; 60 uint8_t res_g; 61 uint8_t res_b; 62 62 63 if (ALPHA(bg) == 255) { 64 res_a = 1; 65 mul = ((double) ALPHA(fg)) / 255.0; 66 mul_cmp = 1 - mul; 67 } else { 68 double fg_a = ((double) ALPHA(fg)) / 255.0; 69 double bg_a = ((double) ALPHA(bg)) / 255.0; 63 res_a = (ALPHA(fg) * 255 + (255 - ALPHA(fg)) * ALPHA(bg)) / 255; 64 mf = ALPHA(fg); 65 mb = (255 * 255 - ALPHA(fg) * ALPHA(bg)) / 255; 70 66 71 res_a = 1 - (1 - fg_a) * (1 - bg_a); 72 mul = fg_a / res_a; 73 mul_cmp = 1 - mul; 74 } 67 res_r = (mf * RED(fg) + mb * RED(bg)) / 255; 68 res_g = (mf * GREEN(fg) + mb * GREEN(bg)) / 255; 69 res_b = (mf * BLUE(fg) + mb * BLUE(bg)) / 255; 75 70 76 res_r = mul * ((double) RED(fg)) + mul_cmp * ((double) RED(bg)); 77 res_g = mul * ((double) GREEN(fg)) + mul_cmp * ((double) GREEN(bg)); 78 res_b = mul * ((double) BLUE(fg)) + mul_cmp * ((double) BLUE(bg)); 79 80 return PIXEL((unsigned) (res_a * 255), 81 (unsigned) res_r, (unsigned) res_g, (unsigned) res_b); 71 return PIXEL(res_a, res_r, res_g, res_b); 82 72 } 83 73
Note:
See TracChangeset
for help on using the changeset viewer.