Vincent Povirk : gdiplus: Do some actual color blending when drawing path gradients.
Alexandre Julliard
julliard at winehq.org
Wed Mar 14 13:56:10 CDT 2012
Module: wine
Branch: master
Commit: 5ed5daf4da747a20979d107fa9efd73f0a45a555
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5ed5daf4da747a20979d107fa9efd73f0a45a555
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Wed Feb 22 15:10:04 2012 -0600
gdiplus: Do some actual color blending when drawing path gradients.
---
dlls/gdiplus/graphics.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 72c6f01..56a61a7 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -1191,6 +1191,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
REAL min_yf, max_yf, line1_xf, line2_xf;
INT min_y, max_y, min_x, max_x;
INT x, y;
+ ARGB outer_color=0xffffffff;
stat = GdipClonePath(fill->path, &flat_path);
@@ -1225,6 +1226,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
{
int start_center_line=0, end_center_line=0;
int seen_start=0, seen_end=0, seen_center=0;
+ REAL center_distance;
type = flat_path->pathdata.Types[i];
@@ -1258,6 +1260,10 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
else
max_y = (INT)ceil(max_yf);
+ /* This is proportional to the distance from start-end line to center point. */
+ center_distance = (end_point.Y - start_point.Y) * (start_point.X - center_point.X) +
+ (end_point.X - start_point.X) * (center_point.Y - start_point.Y);
+
for (y=min_y; y<max_y; y++)
{
REAL yf = (REAL)y;
@@ -1306,7 +1312,17 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
max_x = fill_area->X + fill_area->Width;
for (x=min_x; x<max_x; x++)
- argb_pixels[(x-fill_area->X) + (y-fill_area->Y)*cdwStride] = fill->centercolor;
+ {
+ REAL distance;
+
+ distance = (end_point.Y - start_point.Y) * (start_point.X - (REAL)x) +
+ (end_point.X - start_point.X) * (yf - start_point.Y);
+
+ distance = distance / center_distance;
+
+ argb_pixels[(x-fill_area->X) + (y-fill_area->Y)*cdwStride] =
+ blend_colors(outer_color, fill->centercolor, distance);
+ }
}
}
More information about the wine-cvs
mailing list