Vincent Povirk : gdiplus: Implement GdipSetLineLinearBlend.
Alexandre Julliard
julliard at winehq.org
Mon Jul 13 07:55:00 CDT 2009
Module: wine
Branch: master
Commit: 2cdc48a4e5e532ae46d7951908b61d63cf2842f8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2cdc48a4e5e532ae46d7951908b61d63cf2842f8
Author: Vincent Povirk <madewokherd at gmail.com>
Date: Sat Jul 11 11:49:44 2009 -0500
gdiplus: Implement GdipSetLineLinearBlend.
---
dlls/gdiplus/brush.c | 29 ++++++++++++++++--
dlls/gdiplus/tests/brush.c | 66 ++++++++++++++++++++++++++++++++++++++++++++
include/gdiplusflat.h | 1 +
3 files changed, 92 insertions(+), 4 deletions(-)
diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
index 824ece0..bb19e43 100644
--- a/dlls/gdiplus/brush.c
+++ b/dlls/gdiplus/brush.c
@@ -1531,12 +1531,33 @@ GpStatus WINGDIPAPI GdipRotateTextureTransform(GpTexture* brush, REAL angle,
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus,
REAL scale)
{
- static int calls;
+ REAL factors[3];
+ REAL positions[3];
+ int num_points = 0;
- if(!(calls++))
- FIXME("not implemented\n");
+ TRACE("(%p,%.2f,%.2f)\n", brush, focus, scale);
- return NotImplemented;
+ if (!brush) return InvalidParameter;
+
+ if (focus != 0.0)
+ {
+ factors[num_points] = 0.0;
+ positions[num_points] = 0.0;
+ num_points++;
+ }
+
+ factors[num_points] = scale;
+ positions[num_points] = focus;
+ num_points++;
+
+ if (focus != 1.0)
+ {
+ factors[num_points] = 0.0;
+ positions[num_points] = 1.0;
+ num_points++;
+ }
+
+ return GdipSetLineBlend(brush, factors, positions, num_points);
}
GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
diff --git a/dlls/gdiplus/tests/brush.c b/dlls/gdiplus/tests/brush.c
index b6fbe30..7993d60 100644
--- a/dlls/gdiplus/tests/brush.c
+++ b/dlls/gdiplus/tests/brush.c
@@ -493,6 +493,71 @@ static void test_lineblend(void)
expect(Ok, status);
}
+static void test_linelinearblend(void)
+{
+ GpLineGradient *brush;
+ GpStatus status;
+ GpPointF pt1, pt2;
+ INT count=10;
+ REAL res_factors[3] = {0.3f};
+ REAL res_positions[3] = {0.3f};
+
+ status = GdipSetLineLinearBlend(NULL, 0.6, 0.8);
+ expect(InvalidParameter, status);
+
+ pt1.X = pt1.Y = 1.0;
+ pt2.X = pt2.Y = 100.0;
+ status = GdipCreateLineBrush(&pt1, &pt2, 0, 0, WrapModeTile, &brush);
+ expect(Ok, status);
+
+
+ status = GdipSetLineLinearBlend(brush, 0.6, 0.8);
+ expect(Ok, status);
+
+ status = GdipGetLineBlendCount(brush, &count);
+ expect(Ok, status);
+ expect(3, count);
+
+ status = GdipGetLineBlend(brush, res_factors, res_positions, 3);
+ expect(Ok, status);
+ expectf(0.0, res_factors[0]);
+ expectf(0.0, res_positions[0]);
+ expectf(0.8, res_factors[1]);
+ expectf(0.6, res_positions[1]);
+ expectf(0.0, res_factors[2]);
+ expectf(1.0, res_positions[2]);
+
+
+ status = GdipSetLineLinearBlend(brush, 0.0, 0.8);
+ expect(Ok, status);
+
+ status = GdipGetLineBlendCount(brush, &count);
+ expect(Ok, status);
+ expect(2, count);
+
+ status = GdipGetLineBlend(brush, res_factors, res_positions, 3);
+ expect(Ok, status);
+ expectf(0.8, res_factors[0]);
+ expectf(0.0, res_positions[0]);
+ expectf(0.0, res_factors[1]);
+ expectf(1.0, res_positions[1]);
+
+
+ status = GdipSetLineLinearBlend(brush, 1.0, 0.8);
+ expect(Ok, status);
+
+ status = GdipGetLineBlendCount(brush, &count);
+ expect(Ok, status);
+ expect(2, count);
+
+ status = GdipGetLineBlend(brush, res_factors, res_positions, 3);
+ expect(Ok, status);
+ expectf(0.0, res_factors[0]);
+ expectf(0.0, res_positions[0]);
+ expectf(0.8, res_factors[1]);
+ expectf(1.0, res_positions[1]);
+}
+
START_TEST(brush)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -515,6 +580,7 @@ START_TEST(brush)
test_texturewrap();
test_gradientgetrect();
test_lineblend();
+ test_linelinearblend();
GdiplusShutdown(gdiplusToken);
}
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 0c1e54f..2ee24bd 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -409,6 +409,7 @@ GpStatus WINGDIPAPI GdipGetLineBlendCount(GpLineGradient*,INT*);
GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient*,ARGB,ARGB);
GpStatus WINGDIPAPI GdipSetLineGammaCorrection(GpLineGradient*,BOOL);
GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient*,REAL,REAL);
+GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient*,REAL,REAL);
GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient*,GpWrapMode);
/* Matrix */
More information about the wine-cvs
mailing list