FS-7550 quick and dirty tweak for overlay, maybe need furthur tweaks but this should work with most transparent pngs

This commit is contained in:
Seven Du authored and Michael Jerris committed 2015-05-28 12:47:32 -05:00
1 parent 81ef7703bd
commit 8e1dc361e0
1 file changed
+9 -3
+9 -3
View File
@@ -480,9 +480,15 @@ SWITCH_DECLARE(void) switch_img_overlay(switch_image_t *IMG, switch_image_t *img
switch_img_get_rgb_pixel(IMG, &RGB, x + j, i);
switch_img_get_rgb_pixel(img, &rgb, j + xoff, i - y + yoff);
c.r = ((RGB.r * (255 - alpha)) >> 8) + ((rgb.r * alpha) >> 8);
c.g = ((RGB.g * (255 - alpha)) >> 8) + ((rgb.g * alpha) >> 8);
c.b = ((RGB.b * (255 - alpha)) >> 8) + ((rgb.b * alpha) >> 8);
if (rgb.a > 0) {
c.r = ((RGB.r * (255 - alpha)) >> 8) + ((rgb.r * alpha) >> 8);
c.g = ((RGB.g * (255 - alpha)) >> 8) + ((rgb.g * alpha) >> 8);
c.b = ((RGB.b * (255 - alpha)) >> 8) + ((rgb.b * alpha) >> 8);
} else {
c.r = RGB.r;
c.g = RGB.g;
c.b = RGB.b;
}
switch_img_draw_pixel(IMG, x + j, i, &c);
}