gdiplus: Added GdipGetPenFillType.

oldstable
Nikolay Sivov 2008-12-03 18:22:55 +03:00 committed by Alexandre Julliard
parent 74acbf9c16
commit 9f25eb35b7
6 changed files with 95 additions and 1 deletions

View File

@ -360,7 +360,7 @@
@ stdcall GdipGetPenDashOffset(ptr ptr)
@ stdcall GdipGetPenDashStyle(ptr ptr)
@ stdcall GdipGetPenEndCap(ptr ptr)
@ stub GdipGetPenFillType
@ stdcall GdipGetPenFillType(ptr ptr)
@ stdcall GdipGetPenLineJoin(ptr ptr)
@ stdcall GdipGetPenMiterLimit(ptr ptr)
@ stdcall GdipGetPenMode(ptr ptr)

View File

@ -67,6 +67,24 @@ static DWORD gdip_to_gdi_join(GpLineJoin join)
}
}
static GpPenType bt_to_pt(GpBrushType bt)
{
switch(bt){
case BrushTypeSolidColor:
return PenTypeSolidColor;
case BrushTypeHatchFill:
return PenTypeHatchFill;
case BrushTypeTextureFill:
return PenTypeTextureFill;
case BrushTypePathGradient:
return PenTypePathGradient;
case BrushTypeLinearGradient:
return PenTypeLinearGradient;
default:
return PenTypeUnknown;
}
}
GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
{
TRACE("(%p, %p)\n", pen, clonepen);
@ -283,6 +301,18 @@ GpStatus WINGDIPAPI GdipGetPenEndCap(GpPen *pen, GpLineCap *endCap)
return Ok;
}
GpStatus WINGDIPAPI GdipGetPenFillType(GpPen *pen, GpPenType* type)
{
TRACE("(%p, %p)\n", pen, type);
if(!pen || !type)
return InvalidParameter;
*type = bt_to_pt(pen->brush->bt);
return Ok;
}
GpStatus WINGDIPAPI GdipGetPenLineJoin(GpPen *pen, GpLineJoin *lineJoin)
{
TRACE("(%p, %p)\n", pen, lineJoin);

View File

@ -275,6 +275,56 @@ static void test_customcap(void)
GdipDeletePen(pen);
}
static void test_penfilltype(void)
{
GpPen *pen;
GpSolidFill *solid;
GpLineGradient *line;
GpPointF a, b;
GpStatus status;
GpPenType type;
/* NULL */
status = GdipGetPenFillType(NULL, NULL);
expect(InvalidParameter, status);
status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
status = GdipGetPenFillType(pen, NULL);
expect(InvalidParameter, status);
/* created with GdipCreatePen1() */
status = GdipGetPenFillType(pen, &type);
expect(Ok, status);
expect(PenTypeSolidColor, type);
GdipDeletePen(pen);
/* based on SolidBrush */
status = GdipCreateSolidFill((ARGB)0xffff00ff, &solid);
expect(Ok, status);
status = GdipCreatePen2((GpBrush*)solid, 10.0f, UnitPixel, &pen);
expect(Ok, status);
status = GdipGetPenFillType(pen, &type);
expect(Ok, status);
expect(PenTypeSolidColor, type);
GdipDeletePen(pen);
GdipDeleteBrush((GpBrush*)solid);
/* based on LinearGradientBrush */
a.X = a.Y = 0.0;
b.X = b.Y = 10.0;
status = GdipCreateLineBrush(&a, &b, (ARGB)0xffff00ff, (ARGB)0xffff0000,
WrapModeTile, &line);
expect(Ok, status);
status = GdipCreatePen2((GpBrush*)line, 10.0f, UnitPixel, &pen);
expect(Ok, status);
status = GdipGetPenFillType(pen, &type);
expect(Ok, status);
expect(PenTypeLinearGradient, type);
GdipDeletePen(pen);
GdipDeleteBrush((GpBrush*)line);
}
START_TEST(pen)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -294,6 +344,7 @@ START_TEST(pen)
test_brushfill();
test_dasharray();
test_customcap();
test_penfilltype();
GdiplusShutdown(gdiplusToken);
}

View File

@ -76,6 +76,16 @@ enum PathPointType{
PathPointTypeBezier3 = 3
};
enum PenType
{
PenTypeSolidColor = BrushTypeSolidColor,
PenTypeHatchFill = BrushTypeHatchFill,
PenTypeTextureFill = BrushTypeTextureFill,
PenTypePathGradient = BrushTypePathGradient,
PenTypeLinearGradient = BrushTypeLinearGradient,
PenTypeUnknown = -1
};
enum LineJoin
{
LineJoinMiter = 0,
@ -384,6 +394,7 @@ typedef enum FlushIntention FlushIntention;
typedef enum CoordinateSpace CoordinateSpace;
typedef enum GpTestControlEnum GpTestControlEnum;
typedef enum MetafileFrameUnit MetafileFrameUnit;
typedef enum PenType PenType;
#endif /* end of c typedefs */

View File

@ -487,6 +487,7 @@ GpStatus WINGDIPAPI GdipSetPenDashCap197819(GpPen*,GpDashCap);
GpStatus WINGDIPAPI GdipSetPenDashOffset(GpPen*,REAL);
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen*,GpDashStyle);
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap);
GpStatus WINGDIPAPI GdipGetPenFillType(GpPen*,GpPenType*);
GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen*,GpLineCap,GpLineCap,GpDashCap);
GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen*,GpLineJoin);
GpStatus WINGDIPAPI GdipSetPenMode(GpPen*,GpPenAlignment);

View File

@ -90,5 +90,6 @@ typedef WrapMode GpWrapMode;
typedef Color GpColor;
typedef FlushIntention GpFlushIntention;
typedef CoordinateSpace GpCoordinateSpace;
typedef PenType GpPenType;
#endif