gdiplus: Implemented GdipGetPathData with test.
This commit is contained in:
parent
f620b663a7
commit
3bacdaf664
|
@ -323,7 +323,7 @@
|
||||||
@ stub GdipGetNearestColor
|
@ stub GdipGetNearestColor
|
||||||
@ stdcall GdipGetPageScale(ptr ptr)
|
@ stdcall GdipGetPageScale(ptr ptr)
|
||||||
@ stdcall GdipGetPageUnit(ptr ptr)
|
@ stdcall GdipGetPageUnit(ptr ptr)
|
||||||
@ stub GdipGetPathData
|
@ stdcall GdipGetPathData(ptr ptr)
|
||||||
@ stdcall GdipGetPathFillMode(ptr ptr)
|
@ stdcall GdipGetPathFillMode(ptr ptr)
|
||||||
@ stub GdipGetPathGradientBlend
|
@ stub GdipGetPathGradientBlend
|
||||||
@ stub GdipGetPathGradientBlendCount
|
@ stub GdipGetPathGradientBlendCount
|
||||||
|
|
|
@ -479,6 +479,28 @@ GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
|
||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GpStatus WINGDIPAPI GdipGetPathData(GpPath *path, GpPathData* pathData)
|
||||||
|
{
|
||||||
|
if(!path || !pathData)
|
||||||
|
return InvalidParameter;
|
||||||
|
|
||||||
|
pathData->Count = path->pathdata.Count;
|
||||||
|
|
||||||
|
pathData->Points = GdipAlloc(sizeof(PointF) * pathData->Count);
|
||||||
|
if(!pathData->Points)
|
||||||
|
return OutOfMemory;
|
||||||
|
|
||||||
|
pathData->Types = GdipAlloc(pathData->Count);
|
||||||
|
if(!pathData->Points)
|
||||||
|
return OutOfMemory;
|
||||||
|
|
||||||
|
/* copy data */
|
||||||
|
memcpy(pathData->Points, path->pathdata.Points, sizeof(PointF) * pathData->Count);
|
||||||
|
memcpy(pathData->Types , path->pathdata.Types , pathData->Count);
|
||||||
|
|
||||||
|
return Ok;
|
||||||
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath *path, GpFillMode *fillmode)
|
GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath *path, GpFillMode *fillmode)
|
||||||
{
|
{
|
||||||
if(!path || !fillmode)
|
if(!path || !fillmode)
|
||||||
|
|
|
@ -149,6 +149,28 @@ static void test_constructor_destructor(void)
|
||||||
expect(Ok, status);
|
expect(Ok, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_getpathdata(void)
|
||||||
|
{
|
||||||
|
GpPath *path;
|
||||||
|
GpPathData data;
|
||||||
|
GpStatus status;
|
||||||
|
|
||||||
|
GdipCreatePath(FillModeAlternate, &path);
|
||||||
|
status = GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
|
||||||
|
expect(Ok, status);
|
||||||
|
|
||||||
|
status = GdipGetPathData(path, &data);
|
||||||
|
expect(Ok, status);
|
||||||
|
expect((data.Count == 2), TRUE);
|
||||||
|
expect((data.Points[0].X == 5.0) && (data.Points[0].Y == 5.0) &&
|
||||||
|
(data.Points[1].X == 100.0) && (data.Points[1].Y == 50.0), TRUE);
|
||||||
|
expect((data.Types[0] == PathPointTypeStart) && (data.Types[1] == PathPointTypeLine), TRUE);
|
||||||
|
|
||||||
|
GdipFree(data.Points);
|
||||||
|
GdipFree(data.Types);
|
||||||
|
GdipDeletePath(path);
|
||||||
|
}
|
||||||
|
|
||||||
static path_test_t line2_path[] = {
|
static path_test_t line2_path[] = {
|
||||||
{0.0, 50.0, PathPointTypeStart, 0, 0}, /*0*/
|
{0.0, 50.0, PathPointTypeStart, 0, 0}, /*0*/
|
||||||
{5.0, 45.0, PathPointTypeLine, 0, 0}, /*1*/
|
{5.0, 45.0, PathPointTypeLine, 0, 0}, /*1*/
|
||||||
|
@ -605,6 +627,7 @@ START_TEST(graphicspath)
|
||||||
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
||||||
|
|
||||||
test_constructor_destructor();
|
test_constructor_destructor();
|
||||||
|
test_getpathdata();
|
||||||
test_line2();
|
test_line2();
|
||||||
test_arc();
|
test_arc();
|
||||||
test_worldbounds();
|
test_worldbounds();
|
||||||
|
|
|
@ -225,6 +225,7 @@ GpStatus WINGDIPAPI GdipCreatePath2(GDIPCONST GpPointF*,GDIPCONST BYTE*,INT,
|
||||||
GpFillMode,GpPath**);
|
GpFillMode,GpPath**);
|
||||||
GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint*,GDIPCONST BYTE*,INT,GpFillMode,GpPath**);
|
GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint*,GDIPCONST BYTE*,INT,GpFillMode,GpPath**);
|
||||||
GpStatus WINGDIPAPI GdipDeletePath(GpPath*);
|
GpStatus WINGDIPAPI GdipDeletePath(GpPath*);
|
||||||
|
GpStatus WINGDIPAPI GdipGetPathData(GpPath*,GpPathData*);
|
||||||
GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath*,GpFillMode*);
|
GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath*,GpFillMode*);
|
||||||
GpStatus WINGDIPAPI GdipGetPathPoints(GpPath*,GpPointF*,INT);
|
GpStatus WINGDIPAPI GdipGetPathPoints(GpPath*,GpPointF*,INT);
|
||||||
GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath*,GpPoint*,INT);
|
GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath*,GpPoint*,INT);
|
||||||
|
|
Loading…
Reference in New Issue