From 2f0a893bca3729169d0c14455f24e2d1869e5edb Mon Sep 17 00:00:00 2001 From: handa Date: Mon, 16 Jan 2006 06:45:15 +0000 Subject: [PATCH] (gd_render): Use gdImageColorResolveAlpha instead of simulating anti-aliasing. --- src/m17n-gd.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/m17n-gd.c b/src/m17n-gd.c index 981ccf5..97a5351 100644 --- a/src/m17n-gd.c +++ b/src/m17n-gd.c @@ -324,24 +324,13 @@ gd_render (MDrawWindow win, int x, int y, { xoff = x + ft_face->glyph->bitmap_left + from->xoff; for (j = 0; j < width; j++, xoff++) - if (bmp[j]) + if (bmp[j] > 0) { - int f = bmp[j] >> 5; int pixel1 = pixel; + int alpha = gdAlphaTransparent * (255 - bmp[j]) / 255; - if (f < 7) - { - int r1, g1, b1, color1; - - pixel1 = gdImageGetPixel (img, xoff, yoff); - r1 = gdImageRed (img, pixel1); - g1 = gdImageGreen (img, pixel1); - b1 = gdImageBlue (img, pixel1); - color1 = ((((r * f + r1 * (7 - f)) / 7) << 16) - | (((g * f + g1 * (7 - f)) / 7) << 8) - | ((b * f + b1 * (7 - f)) / 7)); - pixel1 = RESOLVE_COLOR (img, color1); - } + if (alpha > 0) + pixel1 = gdImageColorResolveAlpha (img, r, g, b, alpha); gdImageSetPixel (img, xoff, yoff, pixel1); } } -- 1.7.10.4