gdiplus: Added GdipSetPenDashStyle.

This commit is contained in:
Evan Stade 2007-07-16 19:45:16 -07:00 committed by Alexandre Julliard
parent 1182162dac
commit daf00ab72a
6 changed files with 60 additions and 2 deletions

View File

@ -549,7 +549,7 @@
@ stub GdipSetPenDashArray @ stub GdipSetPenDashArray
@ stub GdipSetPenDashCap197819 @ stub GdipSetPenDashCap197819
@ stub GdipSetPenDashOffset @ stub GdipSetPenDashOffset
@ stub GdipSetPenDashStyle @ stdcall GdipSetPenDashStyle(ptr long)
@ stdcall GdipSetPenEndCap(ptr long) @ stdcall GdipSetPenEndCap(ptr long)
@ stdcall GdipSetPenLineCap197819(ptr long long long) @ stdcall GdipSetPenLineCap197819(ptr long long long)
@ stdcall GdipSetPenLineJoin(ptr long) @ stdcall GdipSetPenLineJoin(ptr long)

View File

@ -23,7 +23,7 @@
#include "windef.h" #include "windef.h"
#include "gdiplus.h" #include "gdiplus.h"
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_ENDCAP_FLAT | PS_JOIN_MITER) #define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
#define MAX_ARC_PTS (13) #define MAX_ARC_PTS (13)
COLORREF ARGB2COLORREF(ARGB color); COLORREF ARGB2COLORREF(ARGB color);
@ -51,6 +51,7 @@ struct GpPen{
GpDashCap dashcap; GpDashCap dashcap;
GpLineJoin join; GpLineJoin join;
REAL miterlimit; REAL miterlimit;
GpDashStyle dash;
}; };
struct GpGraphics{ struct GpGraphics{

View File

@ -27,6 +27,28 @@
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
static DWORD gdip_to_gdi_dash(GpDashStyle dash)
{
switch(dash){
case DashStyleSolid:
return PS_SOLID;
case DashStyleDash:
return PS_DASH;
case DashStyleDot:
return PS_DOT;
case DashStyleDashDot:
return PS_DASHDOT;
case DashStyleDashDotDot:
return PS_DASHDOTDOT;
case DashStyleCustom:
FIXME("DashStyleCustom not implemented\n");
return PS_SOLID;
default:
ERR("Not a member of GpDashStyle enumeration\n");
return 0;
}
}
static DWORD gdip_to_gdi_join(GpLineJoin join) static DWORD gdip_to_gdi_join(GpLineJoin join)
{ {
switch(join){ switch(join){
@ -91,6 +113,28 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
return Ok; return Ok;
} }
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
{
LOGBRUSH lb;
if(!pen)
return InvalidParameter;
DeleteObject(pen->gdipen);
pen->dash = dash;
pen->style &= ~(PS_ALTERNATE | PS_SOLID | PS_DASH | PS_DOT | PS_DASHDOT |
PS_DASHDOTDOT | PS_NULL | PS_USERSTYLE | PS_INSIDEFRAME);
pen->style |= gdip_to_gdi_dash(dash);
lb.lbStyle = BS_SOLID;
lb.lbColor = pen->color;
lb.lbHatch = 0;
pen->gdipen = ExtCreatePen(pen->style, (INT) pen->width, &lb, 0, NULL);
return Ok;
}
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap) GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
{ {
if(!pen) return InvalidParameter; if(!pen) return InvalidParameter;

View File

@ -141,6 +141,16 @@ enum DashCap
DashCapTriangle = 3 DashCapTriangle = 3
}; };
enum DashStyle
{
DashStyleSolid,
DashStyleDash,
DashStyleDot,
DashStyleDashDot,
DashStyleDashDotDot,
DashStyleCustom
};
#ifndef __cplusplus #ifndef __cplusplus
typedef enum Unit Unit; typedef enum Unit Unit;
@ -155,6 +165,7 @@ typedef enum CompositingQuality CompositingQuality;
typedef enum InterpolationMode InterpolationMode; typedef enum InterpolationMode InterpolationMode;
typedef enum PixelOffsetMode PixelOffsetMode; typedef enum PixelOffsetMode PixelOffsetMode;
typedef enum DashCap DashCap; typedef enum DashCap DashCap;
typedef enum DashStyle DashStyle;
#endif /* end of c typedefs */ #endif /* end of c typedefs */

View File

@ -29,6 +29,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 GdipSetPenDashStyle(GpPen*,GpDashStyle);
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap); GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen*,GpLineCap);
GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen*,GpLineCap,GpLineCap,GpDashCap); GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen*,GpLineCap,GpLineCap,GpDashCap);
GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen*,GpLineJoin); GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen*,GpLineJoin);

View File

@ -51,5 +51,6 @@ typedef LineCap GpLineCap;
typedef RectF GpRectF; typedef RectF GpRectF;
typedef LineJoin GpLineJoin; typedef LineJoin GpLineJoin;
typedef DashCap GpDashCap; typedef DashCap GpDashCap;
typedef DashStyle GpDashStyle;
#endif #endif