gdiplus: Added GdipSetPenLineJoin.

This commit is contained in:
Evan Stade 2007-07-12 19:42:47 -07:00 committed by Alexandre Julliard
parent 929be93411
commit bcd0eda687
5 changed files with 53 additions and 0 deletions

View File

@ -47,6 +47,8 @@ struct GpPen{
REAL width;
HPEN gdipen;
GpLineCap endcap;
GpLineJoin join;
REAL miterlimit;
};
struct GpGraphics{

View File

@ -27,6 +27,22 @@
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
static DWORD gdip_to_gdi_join(GpLineJoin join)
{
switch(join){
case LineJoinRound:
return PS_JOIN_ROUND;
case LineJoinBevel:
return PS_JOIN_BEVEL;
case LineJoinMiter:
case LineJoinMiterClipped:
return PS_JOIN_MITER;
default:
ERR("Not a member of GpLineJoin enumeration\n");
return 0;
}
}
GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
GpPen **pen)
{
@ -44,6 +60,8 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
gp_pen->width = width;
gp_pen->unit = unit;
gp_pen->endcap = LineCapFlat;
gp_pen->join = LineJoinMiter;
gp_pen->miterlimit = 10.0;
/* FIXME: Currently only solid lines supported. */
lb.lbStyle = BS_SOLID;
@ -81,3 +99,25 @@ GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
return Ok;
}
/* FIXME: Miter line joins behave a bit differently than they do in windows.
* Both kinds of miter joins clip if the angle is less than 11 degrees. */
GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen *pen, GpLineJoin join)
{
LOGBRUSH lb;
if(!pen) return InvalidParameter;
DeleteObject(pen->gdipen);
pen->join = join;
pen->style &= ~(PS_JOIN_ROUND | PS_JOIN_BEVEL | PS_JOIN_MITER);
pen->style |= gdip_to_gdi_join(join);
lb.lbStyle = BS_SOLID;
lb.lbColor = pen->color;
lb.lbHatch = 0;
pen->gdipen = ExtCreatePen(pen->style, (INT) pen->width, &lb, 0, NULL);
return Ok;
}

View File

@ -73,6 +73,14 @@ enum PathPointType{
PathPointTypeBezier3 = 3
};
enum LineJoin
{
LineJoinMiter = 0,
LineJoinBevel = 1,
LineJoinRound = 2,
LineJoinMiterClipped = 3
};
#ifndef __cplusplus
typedef enum Unit Unit;
@ -80,6 +88,7 @@ typedef enum BrushType BrushType;
typedef enum FillMode FillMode;
typedef enum LineCap LineCap;
typedef enum PathPointType PathPointType;
typedef enum LineJoin LineJoin;
#endif /* end of c typedefs */

View File

@ -30,6 +30,7 @@ extern "C" {
GpStatus WINGDIPAPI GdipCreatePen1(ARGB,REAL,GpUnit,GpPen**);
GpStatus WINGDIPAPI GdipDeletePen(GpPen*);
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap);
GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen*,GpLineJoin);
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC,GpGraphics**);
GpStatus WINGDIPAPI GdipCreateFromHWND(HWND,GpGraphics**);

View File

@ -47,5 +47,6 @@ typedef FillMode GpFillMode;
typedef PathData GpPathData;
typedef LineCap GpLineCap;
typedef RectF GpRectF;
typedef LineJoin GpLineJoin;
#endif