- Sync headers with Wine head
[reactos.git] / reactos / dll / win32 / gdiplus / pen.c
index 104d9de..f41185a 100644 (file)
@@ -67,8 +67,28 @@ 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);
+
     if(!pen || !clonepen)
         return InvalidParameter;
 
@@ -90,6 +110,8 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit,
     GpBrush *brush;
     GpStatus status;
 
+    TRACE("(%x, %.2f, %d, %p)\n", color, width, unit, pen);
+
     GdipCreateSolidFill(color, (GpSolidFill **)(&brush));
     status = GdipCreatePen2(brush, width, unit, pen);
     GdipDeleteBrush(brush);
@@ -102,6 +124,8 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
     GpPen *gp_pen;
     GpBrush *clone_brush;
 
+    TRACE("(%p, %.2f, %d, %p)\n", brush, width, unit, pen);
+
     if(!pen || !brush)
         return InvalidParameter;
 
@@ -135,6 +159,8 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
 
 GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
 {
+    TRACE("(%p)\n", pen);
+
     if(!pen)    return InvalidParameter;
 
     GdipDeleteBrush(pen->brush);
@@ -148,6 +174,8 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
 
 GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen *pen, GpBrush **brush)
 {
+    TRACE("(%p, %p)\n", pen, brush);
+
     if(!pen || !brush)
         return InvalidParameter;
 
@@ -156,6 +184,8 @@ GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen *pen, GpBrush **brush)
 
 GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb)
 {
+    TRACE("(%p, %p)\n", pen, argb);
+
     if(!pen || !argb)
         return InvalidParameter;
 
@@ -167,6 +197,8 @@ GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb)
 
 GpStatus WINGDIPAPI GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap** customCap)
 {
+    TRACE("(%p, %p)\n", pen, customCap);
+
     if(!pen || !customCap)
         return InvalidParameter;
 
@@ -180,6 +212,8 @@ GpStatus WINGDIPAPI GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap** customC
 
 GpStatus WINGDIPAPI GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap** customCap)
 {
+    TRACE("(%p, %p)\n", pen, customCap);
+
     if(!pen || !customCap)
         return InvalidParameter;
 
@@ -193,6 +227,8 @@ GpStatus WINGDIPAPI GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap** custo
 
 GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count)
 {
+    TRACE("(%p, %p, %d)\n", pen, dash, count);
+
     if(!pen || !dash || count > pen->numdashes)
         return InvalidParameter;
 
@@ -207,6 +243,8 @@ GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count)
 
 GpStatus WINGDIPAPI GdipGetPenDashCap197819(GpPen *pen, GpDashCap *dashCap)
 {
+    TRACE("(%p, %p)\n", pen, dashCap);
+
     if(!pen || !dashCap)
         return InvalidParameter;
 
@@ -217,6 +255,8 @@ GpStatus WINGDIPAPI GdipGetPenDashCap197819(GpPen *pen, GpDashCap *dashCap)
 
 GpStatus WINGDIPAPI GdipGetPenDashCount(GpPen *pen, INT *count)
 {
+    TRACE("(%p, %p)\n", pen, count);
+
     if(!pen || !count)
         return InvalidParameter;
 
@@ -227,6 +267,8 @@ GpStatus WINGDIPAPI GdipGetPenDashCount(GpPen *pen, INT *count)
 
 GpStatus WINGDIPAPI GdipGetPenDashOffset(GpPen *pen, REAL *offset)
 {
+    TRACE("(%p, %p)\n", pen, offset);
+
     if(!pen || !offset)
         return InvalidParameter;
 
@@ -237,6 +279,8 @@ GpStatus WINGDIPAPI GdipGetPenDashOffset(GpPen *pen, REAL *offset)
 
 GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash)
 {
+    TRACE("(%p, %p)\n", pen, dash);
+
     if(!pen || !dash)
         return InvalidParameter;
 
@@ -247,6 +291,8 @@ GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash)
 
 GpStatus WINGDIPAPI GdipGetPenEndCap(GpPen *pen, GpLineCap *endCap)
 {
+    TRACE("(%p, %p)\n", pen, endCap);
+
     if(!pen || !endCap)
         return InvalidParameter;
 
@@ -255,8 +301,22 @@ 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);
+
     if(!pen || !lineJoin)
         return InvalidParameter;
 
@@ -267,6 +327,8 @@ GpStatus WINGDIPAPI GdipGetPenLineJoin(GpPen *pen, GpLineJoin *lineJoin)
 
 GpStatus WINGDIPAPI GdipGetPenMode(GpPen *pen, GpPenAlignment *mode)
 {
+    TRACE("(%p, %p)\n", pen, mode);
+
     if(!pen || !mode)
         return InvalidParameter;
 
@@ -277,6 +339,8 @@ GpStatus WINGDIPAPI GdipGetPenMode(GpPen *pen, GpPenAlignment *mode)
 
 GpStatus WINGDIPAPI GdipGetPenMiterLimit(GpPen *pen, REAL *miterLimit)
 {
+    TRACE("(%p, %p)\n", pen, miterLimit);
+
     if(!pen || !miterLimit)
         return InvalidParameter;
 
@@ -287,6 +351,8 @@ GpStatus WINGDIPAPI GdipGetPenMiterLimit(GpPen *pen, REAL *miterLimit)
 
 GpStatus WINGDIPAPI GdipGetPenStartCap(GpPen *pen, GpLineCap *startCap)
 {
+    TRACE("(%p, %p)\n", pen, startCap);
+
     if(!pen || !startCap)
         return InvalidParameter;
 
@@ -297,6 +363,8 @@ GpStatus WINGDIPAPI GdipGetPenStartCap(GpPen *pen, GpLineCap *startCap)
 
 GpStatus WINGDIPAPI GdipGetPenUnit(GpPen *pen, GpUnit *unit)
 {
+    TRACE("(%p, %p)\n", pen, unit);
+
     if(!pen || !unit)
         return InvalidParameter;
 
@@ -307,6 +375,8 @@ GpStatus WINGDIPAPI GdipGetPenUnit(GpPen *pen, GpUnit *unit)
 
 GpStatus WINGDIPAPI GdipGetPenWidth(GpPen *pen, REAL *width)
 {
+    TRACE("(%p, %p)\n", pen, width);
+
     if(!pen || !width)
         return InvalidParameter;
 
@@ -317,6 +387,8 @@ GpStatus WINGDIPAPI GdipGetPenWidth(GpPen *pen, REAL *width)
 
 GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen *pen, GpBrush *brush)
 {
+    TRACE("(%p, %p)\n", pen, brush);
+
     if(!pen || !brush)
         return InvalidParameter;
 
@@ -326,6 +398,8 @@ GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen *pen, GpBrush *brush)
 
 GpStatus WINGDIPAPI GdipSetPenColor(GpPen *pen, ARGB argb)
 {
+    TRACE("(%p, %x)\n", pen, argb);
+
     if(!pen)
         return InvalidParameter;
 
@@ -335,11 +409,24 @@ GpStatus WINGDIPAPI GdipSetPenColor(GpPen *pen, ARGB argb)
     return GdipSetSolidFillColor(((GpSolidFill*)pen->brush), argb);
 }
 
+GpStatus WINGDIPAPI GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *dash,
+    INT count)
+{
+    FIXME("(%p, %p, %i): stub", pen, dash, count);
+
+    if (!pen || !dash || count < 2 || count%2 == 1)
+        return InvalidParameter;
+
+    return NotImplemented;
+}
+
 GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap)
 {
     GpCustomLineCap * cap;
     GpStatus ret;
 
+    TRACE("(%p, %p)\n", pen, customCap);
+
     /* native crashes on pen == NULL, customCap != NULL */
     if(!customCap) return InvalidParameter;
 
@@ -357,6 +444,8 @@ GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* custom
     GpCustomLineCap * cap;
     GpStatus ret;
 
+    TRACE("(%p, %p)\n", pen, customCap);
+
     /* native crashes on pen == NULL, customCap != NULL */
     if(!customCap) return InvalidParameter;
 
@@ -375,6 +464,8 @@ GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
     INT i;
     REAL sum = 0;
 
+    TRACE("(%p, %p, %d)\n", pen, dash, count);
+
     if(!pen || !dash)
         return InvalidParameter;
 
@@ -409,6 +500,8 @@ GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
 
 GpStatus WINGDIPAPI GdipSetPenDashCap197819(GpPen *pen, GpDashCap dashCap)
 {
+    TRACE("(%p, %d)\n", pen, dashCap);
+
     if(!pen)
         return InvalidParameter;
 
@@ -420,6 +513,8 @@ GpStatus WINGDIPAPI GdipSetPenDashCap197819(GpPen *pen, GpDashCap dashCap)
 /* FIXME: dash offset not used */
 GpStatus WINGDIPAPI GdipSetPenDashOffset(GpPen *pen, REAL offset)
 {
+    TRACE("(%p, %.2f)\n", pen, offset);
+
     if(!pen)
         return InvalidParameter;
 
@@ -430,6 +525,8 @@ GpStatus WINGDIPAPI GdipSetPenDashOffset(GpPen *pen, REAL offset)
 
 GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
 {
+    TRACE("(%p, %d)\n", pen, dash);
+
     if(!pen)
         return InvalidParameter;
 
@@ -449,6 +546,8 @@ GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
 
 GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
 {
+    TRACE("(%p, %d)\n", pen, cap);
+
     if(!pen)    return InvalidParameter;
 
     /* The old custom cap gets deleted even if the new style is LineCapCustom. */
@@ -463,6 +562,8 @@ GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
 GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen *pen, GpLineCap start,
     GpLineCap end, GpDashCap dash)
 {
+    TRACE("%p, %d, %d, %d)\n", pen, start, end, dash);
+
     if(!pen)
         return InvalidParameter;
 
@@ -482,6 +583,8 @@ GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen *pen, GpLineCap start,
  * Both kinds of miter joins clip if the angle is less than 11 degrees. */
 GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen *pen, GpLineJoin join)
 {
+    TRACE("(%p, %d)\n", pen, join);
+
     if(!pen)    return InvalidParameter;
 
     pen->join = join;
@@ -493,6 +596,8 @@ GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen *pen, GpLineJoin join)
 
 GpStatus WINGDIPAPI GdipSetPenMiterLimit(GpPen *pen, REAL limit)
 {
+    TRACE("(%p, %.2f)\n", pen, limit);
+
     if(!pen)
         return InvalidParameter;
 
@@ -503,6 +608,8 @@ GpStatus WINGDIPAPI GdipSetPenMiterLimit(GpPen *pen, REAL limit)
 
 GpStatus WINGDIPAPI GdipSetPenStartCap(GpPen *pen, GpLineCap cap)
 {
+    TRACE("(%p, %d)\n", pen, cap);
+
     if(!pen)    return InvalidParameter;
 
     GdipDeleteCustomLineCap(pen->customstart);
@@ -514,6 +621,8 @@ GpStatus WINGDIPAPI GdipSetPenStartCap(GpPen *pen, GpLineCap cap)
 
 GpStatus WINGDIPAPI GdipSetPenWidth(GpPen *pen, REAL width)
 {
+    TRACE("(%p, %.2f)\n", pen, width);
+
     if(!pen)    return InvalidParameter;
 
     pen->width = width;
@@ -523,6 +632,8 @@ GpStatus WINGDIPAPI GdipSetPenWidth(GpPen *pen, REAL width)
 
 GpStatus WINGDIPAPI GdipSetPenMode(GpPen *pen, GpPenAlignment mode)
 {
+    TRACE("(%p, %d)\n", pen, mode);
+
     if(!pen)    return InvalidParameter;
 
     pen->align = mode;