Vincent Povirk : gdiplus: Implement bilinear interpolation.

Alexandre Julliard julliard at winehq.org
Fri Mar 11 10:23:37 CST 2011


Module: wine
Branch: master
Commit: 8b6dafda459d4a4a69123b9928c3c4fc4afa83a7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8b6dafda459d4a4a69123b9928c3c4fc4afa83a7

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu Mar 10 11:03:39 2011 -0600

gdiplus: Implement bilinear interpolation.

---

 dlls/gdiplus/graphics.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 3b7b7ba..07239e0 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -538,6 +538,40 @@ static ARGB resample_bitmap_pixel(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT
         if (!fixme++)
             FIXME("Unimplemented interpolation %i\n", interpolation);
         /* fall-through */
+    case InterpolationModeBilinear:
+    {
+        REAL leftxf, topyf;
+        INT leftx, rightx, topy, bottomy;
+        ARGB topleft, topright, bottomleft, bottomright;
+        ARGB top, bottom;
+        float x_offset;
+
+        leftxf = floorf(point->X);
+        leftx = (INT)leftxf;
+        rightx = (INT)ceilf(point->X);
+        topyf = floorf(point->Y);
+        topy = (INT)topyf;
+        bottomy = (INT)ceilf(point->Y);
+
+        if (leftx == rightx && topy == bottomy)
+            return sample_bitmap_pixel(src_rect, bits, width, height,
+                leftx, topy, attributes);
+
+        topleft = sample_bitmap_pixel(src_rect, bits, width, height,
+            leftx, topy, attributes);
+        topright = sample_bitmap_pixel(src_rect, bits, width, height,
+            rightx, topy, attributes);
+        bottomleft = sample_bitmap_pixel(src_rect, bits, width, height,
+            leftx, bottomy, attributes);
+        bottomright = sample_bitmap_pixel(src_rect, bits, width, height,
+            rightx, bottomy, attributes);
+
+        x_offset = point->X - leftxf;
+        top = blend_colors(topleft, topright, x_offset);
+        bottom = blend_colors(bottomleft, bottomright, x_offset);
+
+        return blend_colors(top, bottom, point->Y - topyf);
+    }
     case InterpolationModeNearestNeighbor:
         return sample_bitmap_pixel(src_rect, bits, width, height,
             roundr(point->X), roundr(point->Y), attributes);




More information about the wine-cvs mailing list