gdiplus: Implement GdipSetLineLinearBlend.
This commit is contained in:
parent
849af30eb8
commit
2cdc48a4e5
|
@ -1531,12 +1531,33 @@ GpStatus WINGDIPAPI GdipRotateTextureTransform(GpTexture* brush, REAL angle,
|
||||||
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus,
|
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus,
|
||||||
REAL scale)
|
REAL scale)
|
||||||
{
|
{
|
||||||
static int calls;
|
REAL factors[3];
|
||||||
|
REAL positions[3];
|
||||||
|
int num_points = 0;
|
||||||
|
|
||||||
if(!(calls++))
|
TRACE("(%p,%.2f,%.2f)\n", brush, focus, scale);
|
||||||
FIXME("not implemented\n");
|
|
||||||
|
|
||||||
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,
|
GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
|
||||||
|
|
|
@ -493,6 +493,71 @@ static void test_lineblend(void)
|
||||||
expect(Ok, status);
|
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)
|
START_TEST(brush)
|
||||||
{
|
{
|
||||||
struct GdiplusStartupInput gdiplusStartupInput;
|
struct GdiplusStartupInput gdiplusStartupInput;
|
||||||
|
@ -515,6 +580,7 @@ START_TEST(brush)
|
||||||
test_texturewrap();
|
test_texturewrap();
|
||||||
test_gradientgetrect();
|
test_gradientgetrect();
|
||||||
test_lineblend();
|
test_lineblend();
|
||||||
|
test_linelinearblend();
|
||||||
|
|
||||||
GdiplusShutdown(gdiplusToken);
|
GdiplusShutdown(gdiplusToken);
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,6 +409,7 @@ GpStatus WINGDIPAPI GdipGetLineBlendCount(GpLineGradient*,INT*);
|
||||||
GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient*,ARGB,ARGB);
|
GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient*,ARGB,ARGB);
|
||||||
GpStatus WINGDIPAPI GdipSetLineGammaCorrection(GpLineGradient*,BOOL);
|
GpStatus WINGDIPAPI GdipSetLineGammaCorrection(GpLineGradient*,BOOL);
|
||||||
GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient*,REAL,REAL);
|
GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient*,REAL,REAL);
|
||||||
|
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient*,REAL,REAL);
|
||||||
GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient*,GpWrapMode);
|
GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient*,GpWrapMode);
|
||||||
|
|
||||||
/* Matrix */
|
/* Matrix */
|
||||||
|
|
Loading…
Reference in New Issue