Changeset d723a80 in mainline
- Timestamp:
- 2018-10-18T18:55:40Z (6 years ago)
- Children:
- 14ad75c
- Parents:
- 8a1afd2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/softrend/compose.c
r8a1afd2 rd723a80 53 53 pixel_t compose_over(pixel_t fg, pixel_t bg) 54 54 { 55 uint16_t mf;56 uint16_t mb;57 58 55 uint8_t res_a; 59 56 uint8_t res_r; 60 57 uint8_t res_g; 61 58 uint8_t res_b; 59 uint32_t res_a_inv; 62 60 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; 61 res_a_inv = ALPHA(bg) * (255 - ALPHA(fg)); 62 res_a = ALPHA(fg) + (res_a_inv / 255); 66 63 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;64 res_r = (RED(fg) * ALPHA(fg) / 255) + (RED(bg) * res_a_inv) / (255 * 255); 65 res_g = (GREEN(fg) * ALPHA(fg) / 255) + (GREEN(bg) * res_a_inv) / (255 * 255); 66 res_b = (BLUE(fg) * ALPHA(fg) / 255) + (BLUE(bg) * res_a_inv) / (255 * 255); 70 67 71 68 return PIXEL(res_a, res_r, res_g, res_b);
Note:
See TracChangeset
for help on using the changeset viewer.