Commit bcd0eda6 authored by Evan Stade's avatar Evan Stade Committed by Alexandre Julliard

gdiplus: Added GdipSetPenLineJoin.

parent 929be934
...@@ -47,6 +47,8 @@ struct GpPen{ ...@@ -47,6 +47,8 @@ struct GpPen{
REAL width; REAL width;
HPEN gdipen; HPEN gdipen;
GpLineCap endcap; GpLineCap endcap;
GpLineJoin join;
REAL miterlimit;
}; };
struct GpGraphics{ struct GpGraphics{
......
...@@ -27,6 +27,22 @@ ...@@ -27,6 +27,22 @@
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); 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, GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
GpPen **pen) GpPen **pen)
{ {
...@@ -44,6 +60,8 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit, ...@@ -44,6 +60,8 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
gp_pen->width = width; gp_pen->width = width;
gp_pen->unit = unit; gp_pen->unit = unit;
gp_pen->endcap = LineCapFlat; gp_pen->endcap = LineCapFlat;
gp_pen->join = LineJoinMiter;
gp_pen->miterlimit = 10.0;
/* FIXME: Currently only solid lines supported. */ /* FIXME: Currently only solid lines supported. */
lb.lbStyle = BS_SOLID; lb.lbStyle = BS_SOLID;
...@@ -81,3 +99,25 @@ GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap) ...@@ -81,3 +99,25 @@ GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
return Ok; 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;
}
...@@ -73,6 +73,14 @@ enum PathPointType{ ...@@ -73,6 +73,14 @@ enum PathPointType{
PathPointTypeBezier3 = 3 PathPointTypeBezier3 = 3
}; };
enum LineJoin
{
LineJoinMiter = 0,
LineJoinBevel = 1,
LineJoinRound = 2,
LineJoinMiterClipped = 3
};
#ifndef __cplusplus #ifndef __cplusplus
typedef enum Unit Unit; typedef enum Unit Unit;
...@@ -80,6 +88,7 @@ typedef enum BrushType BrushType; ...@@ -80,6 +88,7 @@ typedef enum BrushType BrushType;
typedef enum FillMode FillMode; typedef enum FillMode FillMode;
typedef enum LineCap LineCap; typedef enum LineCap LineCap;
typedef enum PathPointType PathPointType; typedef enum PathPointType PathPointType;
typedef enum LineJoin LineJoin;
#endif /* end of c typedefs */ #endif /* end of c typedefs */
......
...@@ -30,6 +30,7 @@ extern "C" { ...@@ -30,6 +30,7 @@ extern "C" {
GpStatus WINGDIPAPI GdipCreatePen1(ARGB,REAL,GpUnit,GpPen**); GpStatus WINGDIPAPI GdipCreatePen1(ARGB,REAL,GpUnit,GpPen**);
GpStatus WINGDIPAPI GdipDeletePen(GpPen*); GpStatus WINGDIPAPI GdipDeletePen(GpPen*);
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap); GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap);
GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen*,GpLineJoin);
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC,GpGraphics**); GpStatus WINGDIPAPI GdipCreateFromHDC(HDC,GpGraphics**);
GpStatus WINGDIPAPI GdipCreateFromHWND(HWND,GpGraphics**); GpStatus WINGDIPAPI GdipCreateFromHWND(HWND,GpGraphics**);
......
...@@ -47,5 +47,6 @@ typedef FillMode GpFillMode; ...@@ -47,5 +47,6 @@ typedef FillMode GpFillMode;
typedef PathData GpPathData; typedef PathData GpPathData;
typedef LineCap GpLineCap; typedef LineCap GpLineCap;
typedef RectF GpRectF; typedef RectF GpRectF;
typedef LineJoin GpLineJoin;
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment