2007-06-11 20:51:15 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Google (Evan Stade)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
2007-08-01 04:15:48 +02:00
|
|
|
|
|
|
|
#include "objbase.h"
|
|
|
|
|
2007-06-11 20:51:15 +02:00
|
|
|
#include "gdiplus.h"
|
|
|
|
#include "gdiplus_private.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
|
|
|
|
|
2007-07-17 04:45:16 +02:00
|
|
|
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:
|
2007-07-28 01:07:39 +02:00
|
|
|
return PS_USERSTYLE;
|
2007-07-17 04:45:16 +02:00
|
|
|
default:
|
|
|
|
ERR("Not a member of GpDashStyle enumeration\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-13 04:42:47 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-03 16:22:55 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-18 04:30:50 +02:00
|
|
|
GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
|
|
|
|
{
|
2013-08-14 23:34:25 +02:00
|
|
|
GpStatus stat;
|
|
|
|
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, clonepen);
|
|
|
|
|
2007-07-18 04:30:50 +02:00
|
|
|
if(!pen || !clonepen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2015-10-05 00:22:34 +02:00
|
|
|
*clonepen = heap_alloc_zero(sizeof(GpPen));
|
2007-07-18 04:30:50 +02:00
|
|
|
if(!*clonepen) return OutOfMemory;
|
|
|
|
|
2008-02-29 23:06:47 +01:00
|
|
|
**clonepen = *pen;
|
2007-07-18 04:30:50 +02:00
|
|
|
|
2013-08-14 23:34:25 +02:00
|
|
|
(*clonepen)->customstart = NULL;
|
|
|
|
(*clonepen)->customend = NULL;
|
|
|
|
(*clonepen)->brush = NULL;
|
2013-08-14 23:35:11 +02:00
|
|
|
(*clonepen)->dashes = NULL;
|
2013-08-14 23:34:25 +02:00
|
|
|
|
|
|
|
stat = GdipCloneBrush(pen->brush, &(*clonepen)->brush);
|
|
|
|
|
|
|
|
if (stat == Ok && pen->customstart)
|
|
|
|
stat = GdipCloneCustomLineCap(pen->customstart, &(*clonepen)->customstart);
|
|
|
|
|
|
|
|
if (stat == Ok && pen->customend)
|
|
|
|
stat = GdipCloneCustomLineCap(pen->customend, &(*clonepen)->customend);
|
|
|
|
|
2013-08-14 23:35:11 +02:00
|
|
|
if (stat == Ok && pen->dashes)
|
|
|
|
{
|
2015-10-05 00:22:34 +02:00
|
|
|
(*clonepen)->dashes = heap_alloc_zero(pen->numdashes * sizeof(REAL));
|
2013-08-14 23:35:11 +02:00
|
|
|
if ((*clonepen)->dashes)
|
|
|
|
memcpy((*clonepen)->dashes, pen->dashes, pen->numdashes * sizeof(REAL));
|
|
|
|
else
|
|
|
|
stat = OutOfMemory;
|
|
|
|
}
|
|
|
|
|
2013-08-14 23:34:25 +02:00
|
|
|
if (stat != Ok)
|
|
|
|
{
|
|
|
|
GdipDeletePen(*clonepen);
|
|
|
|
*clonepen = NULL;
|
|
|
|
return stat;
|
|
|
|
}
|
2007-07-18 04:30:50 +02:00
|
|
|
|
2009-12-18 22:24:51 +01:00
|
|
|
TRACE("<-- %p\n", *clonepen);
|
|
|
|
|
2007-07-18 04:30:50 +02:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-03 00:53:23 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit,
|
2007-06-11 20:51:15 +02:00
|
|
|
GpPen **pen)
|
2007-12-28 22:08:09 +01:00
|
|
|
{
|
|
|
|
GpBrush *brush;
|
2008-06-19 13:16:20 +02:00
|
|
|
GpStatus status;
|
|
|
|
|
2022-02-10 08:43:13 +01:00
|
|
|
TRACE("(%lx, %.2f, %d, %p)\n", color, width, unit, pen);
|
2008-11-06 18:44:10 +01:00
|
|
|
|
2007-12-28 22:08:09 +01:00
|
|
|
GdipCreateSolidFill(color, (GpSolidFill **)(&brush));
|
2008-06-19 13:16:20 +02:00
|
|
|
status = GdipCreatePen2(brush, width, unit, pen);
|
|
|
|
GdipDeleteBrush(brush);
|
|
|
|
return status;
|
2007-12-28 22:08:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
|
|
|
|
GpPen **pen)
|
2007-06-11 20:51:15 +02:00
|
|
|
{
|
|
|
|
GpPen *gp_pen;
|
2008-06-19 13:16:20 +02:00
|
|
|
GpBrush *clone_brush;
|
2007-06-11 20:51:15 +02:00
|
|
|
|
2008-11-11 11:59:42 +01:00
|
|
|
TRACE("(%p, %.2f, %d, %p)\n", brush, width, unit, pen);
|
2008-11-06 18:44:10 +01:00
|
|
|
|
2007-12-28 22:08:09 +01:00
|
|
|
if(!pen || !brush)
|
2007-06-23 04:24:50 +02:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2015-10-05 00:22:34 +02:00
|
|
|
gp_pen = heap_alloc_zero(sizeof(GpPen));
|
2007-06-23 04:24:50 +02:00
|
|
|
if(!gp_pen) return OutOfMemory;
|
2007-06-11 20:51:15 +02:00
|
|
|
|
|
|
|
gp_pen->style = GP_DEFAULT_PENSTYLE;
|
|
|
|
gp_pen->width = width;
|
|
|
|
gp_pen->unit = unit;
|
2007-07-06 03:37:52 +02:00
|
|
|
gp_pen->endcap = LineCapFlat;
|
2007-07-13 04:42:47 +02:00
|
|
|
gp_pen->join = LineJoinMiter;
|
|
|
|
gp_pen->miterlimit = 10.0;
|
2007-07-18 04:31:01 +02:00
|
|
|
gp_pen->dash = DashStyleSolid;
|
2007-08-09 04:42:03 +02:00
|
|
|
gp_pen->offset = 0.0;
|
2008-08-01 11:39:48 +02:00
|
|
|
gp_pen->customstart = NULL;
|
|
|
|
gp_pen->customend = NULL;
|
2016-01-31 11:55:31 +01:00
|
|
|
GdipSetMatrixElements(&gp_pen->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
2007-06-11 20:51:15 +02:00
|
|
|
|
2007-07-25 02:18:54 +02:00
|
|
|
if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
|
2007-06-13 13:18:02 +02:00
|
|
|
FIXME("UnitWorld, UnitPixel only supported units\n");
|
2015-10-05 00:22:34 +02:00
|
|
|
heap_free(gp_pen);
|
2007-06-11 20:51:15 +02:00
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2008-06-19 13:16:20 +02:00
|
|
|
GdipCloneBrush(brush, &clone_brush);
|
|
|
|
gp_pen->brush = clone_brush;
|
|
|
|
|
2007-06-11 20:51:15 +02:00
|
|
|
*pen = gp_pen;
|
|
|
|
|
2009-12-18 22:24:51 +01:00
|
|
|
TRACE("<-- %p\n", *pen);
|
|
|
|
|
2007-06-11 20:51:15 +02:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p)\n", pen);
|
|
|
|
|
2007-06-11 20:51:15 +02:00
|
|
|
if(!pen) return InvalidParameter;
|
2007-07-20 03:22:43 +02:00
|
|
|
|
2007-07-20 03:22:59 +02:00
|
|
|
GdipDeleteBrush(pen->brush);
|
2007-07-20 03:22:43 +02:00
|
|
|
GdipDeleteCustomLineCap(pen->customstart);
|
|
|
|
GdipDeleteCustomLineCap(pen->customend);
|
2015-10-05 00:22:34 +02:00
|
|
|
heap_free(pen->dashes);
|
|
|
|
heap_free(pen);
|
2007-06-11 20:51:15 +02:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
2007-07-06 03:37:52 +02:00
|
|
|
|
2007-07-24 05:24:07 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen *pen, GpBrush **brush)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, brush);
|
|
|
|
|
2007-07-24 05:24:07 +02:00
|
|
|
if(!pen || !brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
return GdipCloneBrush(pen->brush, brush);
|
|
|
|
}
|
|
|
|
|
2007-07-24 05:24:00 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, argb);
|
|
|
|
|
2007-07-24 05:24:00 +02:00
|
|
|
if(!pen || !argb)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2007-07-24 05:24:29 +02:00
|
|
|
if(pen->brush->bt != BrushTypeSolidColor)
|
|
|
|
return NotImplemented;
|
|
|
|
|
|
|
|
return GdipGetSolidFillColor(((GpSolidFill*)pen->brush), argb);
|
2007-07-24 05:24:00 +02:00
|
|
|
}
|
|
|
|
|
2008-08-01 11:39:48 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap** customCap)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, customCap);
|
|
|
|
|
2008-08-01 11:39:48 +02:00
|
|
|
if(!pen || !customCap)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(!pen->customend){
|
|
|
|
*customCap = NULL;
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GdipCloneCustomLineCap(pen->customend, customCap);
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap** customCap)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, customCap);
|
|
|
|
|
2008-08-01 11:39:48 +02:00
|
|
|
if(!pen || !customCap)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(!pen->customstart){
|
|
|
|
*customCap = NULL;
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GdipCloneCustomLineCap(pen->customstart, customCap);
|
|
|
|
}
|
|
|
|
|
2007-07-26 04:15:38 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p, %d)\n", pen, dash, count);
|
|
|
|
|
2007-07-26 04:15:38 +02:00
|
|
|
if(!pen || !dash || count > pen->numdashes)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
/* note: if you pass a negative value for count, it crashes native gdiplus. */
|
|
|
|
if(count < 0)
|
|
|
|
return GenericError;
|
|
|
|
|
|
|
|
memcpy(dash, pen->dashes, count * sizeof(REAL));
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-06-27 01:27:18 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenDashCap197819(GpPen *pen, GpDashCap *dashCap)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, dashCap);
|
|
|
|
|
2008-06-27 01:27:18 +02:00
|
|
|
if(!pen || !dashCap)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*dashCap = pen->dashcap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-07-10 21:17:17 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenDashCount(GpPen *pen, INT *count)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, count);
|
|
|
|
|
2008-07-10 21:17:17 +02:00
|
|
|
if(!pen || !count)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*count = pen->numdashes;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-09 04:42:03 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenDashOffset(GpPen *pen, REAL *offset)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, offset);
|
|
|
|
|
2007-08-09 04:42:03 +02:00
|
|
|
if(!pen || !offset)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*offset = pen->offset;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-07-18 04:31:01 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, dash);
|
|
|
|
|
2007-07-18 04:31:01 +02:00
|
|
|
if(!pen || !dash)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*dash = pen->dash;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-06-27 01:26:43 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenEndCap(GpPen *pen, GpLineCap *endCap)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, endCap);
|
|
|
|
|
2008-06-27 01:26:43 +02:00
|
|
|
if(!pen || !endCap)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*endCap = pen->endcap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-12-03 16:22:55 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2008-06-27 01:26:49 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenLineJoin(GpPen *pen, GpLineJoin *lineJoin)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, lineJoin);
|
|
|
|
|
2008-06-27 01:26:49 +02:00
|
|
|
if(!pen || !lineJoin)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*lineJoin = pen->join;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-07-31 07:08:32 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenMode(GpPen *pen, GpPenAlignment *mode)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, mode);
|
|
|
|
|
2008-07-31 07:08:32 +02:00
|
|
|
if(!pen || !mode)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*mode = pen->align;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-06-27 01:26:49 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenMiterLimit(GpPen *pen, REAL *miterLimit)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, miterLimit);
|
|
|
|
|
2008-06-27 01:26:49 +02:00
|
|
|
if(!pen || !miterLimit)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*miterLimit = pen->miterlimit;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-06-27 01:26:57 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenStartCap(GpPen *pen, GpLineCap *startCap)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, startCap);
|
|
|
|
|
2008-06-27 01:26:57 +02:00
|
|
|
if(!pen || !startCap)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*startCap = pen->startcap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-06-27 01:27:03 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenUnit(GpPen *pen, GpUnit *unit)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, unit);
|
|
|
|
|
2008-06-27 01:27:03 +02:00
|
|
|
if(!pen || !unit)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*unit = pen->unit;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-06-27 01:27:09 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenWidth(GpPen *pen, REAL *width)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, width);
|
|
|
|
|
2008-06-27 01:27:09 +02:00
|
|
|
if(!pen || !width)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*width = pen->width;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-12-27 19:33:21 +01:00
|
|
|
GpStatus WINGDIPAPI GdipResetPenTransform(GpPen *pen)
|
|
|
|
{
|
2009-12-18 23:30:26 +01:00
|
|
|
TRACE("(%p)\n", pen);
|
|
|
|
|
2008-12-27 19:33:21 +01:00
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2016-02-05 08:20:47 +01:00
|
|
|
GdipSetMatrixElements(&pen->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
2008-12-27 19:33:21 +01:00
|
|
|
|
2016-02-05 08:20:47 +01:00
|
|
|
return Ok;
|
2008-12-27 19:33:21 +01:00
|
|
|
}
|
|
|
|
|
2010-06-20 00:56:42 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPenTransform(GpPen *pen, GpMatrix *matrix)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", pen, matrix);
|
|
|
|
|
|
|
|
if(!pen || !matrix)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(!(calls++))
|
2016-02-05 08:20:46 +01:00
|
|
|
FIXME("(%p,%p) Semi-stub\n", pen, matrix);
|
2010-06-20 00:56:42 +02:00
|
|
|
|
2016-02-05 08:20:46 +01:00
|
|
|
pen->transform = *matrix;
|
|
|
|
|
|
|
|
return Ok;
|
2010-06-20 00:56:42 +02:00
|
|
|
}
|
|
|
|
|
2010-06-20 01:00:49 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenTransform(GpPen *pen, GpMatrix *matrix)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", pen, matrix);
|
|
|
|
|
|
|
|
if(!pen || !matrix)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2016-01-31 11:55:31 +01:00
|
|
|
*matrix = pen->transform;
|
2010-06-20 01:00:49 +02:00
|
|
|
|
2016-01-31 11:55:31 +01:00
|
|
|
return Ok;
|
2010-06-20 01:00:49 +02:00
|
|
|
}
|
|
|
|
|
2010-07-02 22:36:21 +02:00
|
|
|
GpStatus WINGDIPAPI GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%0.2f,%0.2f,%u)\n", pen, dx, dy, order);
|
|
|
|
|
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2018-03-24 14:10:12 +01:00
|
|
|
return GdipTranslateMatrix(&pen->transform, dx, dy, order);
|
2010-07-02 22:36:21 +02:00
|
|
|
}
|
|
|
|
|
2008-12-27 19:35:40 +01:00
|
|
|
GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrixOrder order)
|
|
|
|
{
|
2009-12-18 23:30:26 +01:00
|
|
|
TRACE("(%p,%0.2f,%0.2f,%u)\n", pen, sx, sy, order);
|
|
|
|
|
2008-12-27 19:35:40 +01:00
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2018-10-16 09:04:28 +02:00
|
|
|
return GdipScaleMatrix(&pen->transform, sx, sy, order);
|
2008-12-27 19:35:40 +01:00
|
|
|
}
|
|
|
|
|
2010-06-20 00:58:54 +02:00
|
|
|
GpStatus WINGDIPAPI GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%0.2f,%u)\n", pen, angle, order);
|
|
|
|
|
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2018-10-23 23:04:18 +02:00
|
|
|
return GdipRotateMatrix(&pen->transform, angle, order);
|
2010-06-20 00:58:54 +02:00
|
|
|
}
|
|
|
|
|
2010-06-20 00:54:49 +02:00
|
|
|
GpStatus WINGDIPAPI GdipMultiplyPenTransform(GpPen *pen, GDIPCONST GpMatrix *matrix,
|
|
|
|
GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p,%u)\n", pen, matrix, order);
|
|
|
|
|
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2018-10-19 19:02:39 +02:00
|
|
|
return GdipMultiplyMatrix(&pen->transform, matrix, order);
|
2010-06-20 00:54:49 +02:00
|
|
|
}
|
|
|
|
|
2007-07-24 05:23:52 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen *pen, GpBrush *brush)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, brush);
|
|
|
|
|
2007-07-24 05:23:52 +02:00
|
|
|
if(!pen || !brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
GdipDeleteBrush(pen->brush);
|
2007-07-25 02:18:54 +02:00
|
|
|
return GdipCloneBrush(brush, &pen->brush);
|
2007-07-24 05:23:52 +02:00
|
|
|
}
|
|
|
|
|
2007-07-24 05:24:29 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPenColor(GpPen *pen, ARGB argb)
|
|
|
|
{
|
2022-02-10 08:43:13 +01:00
|
|
|
TRACE("(%p, %lx)\n", pen, argb);
|
2008-11-06 18:44:10 +01:00
|
|
|
|
2007-07-24 05:24:29 +02:00
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(pen->brush->bt != BrushTypeSolidColor)
|
|
|
|
return NotImplemented;
|
|
|
|
|
|
|
|
return GdipSetSolidFillColor(((GpSolidFill*)pen->brush), argb);
|
|
|
|
}
|
|
|
|
|
2010-06-20 00:52:39 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPenCompoundCount(GpPen *pen, INT *count)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p): stub\n", pen, count);
|
|
|
|
|
|
|
|
if (!pen || !count)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2008-12-04 21:30:47 +01:00
|
|
|
GpStatus WINGDIPAPI GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *dash,
|
|
|
|
INT count)
|
|
|
|
{
|
2008-12-08 09:27:40 +01:00
|
|
|
FIXME("(%p, %p, %i): stub\n", pen, dash, count);
|
2008-12-04 21:30:47 +01:00
|
|
|
|
|
|
|
if (!pen || !dash || count < 2 || count%2 == 1)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2007-07-20 03:22:43 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap)
|
|
|
|
{
|
|
|
|
GpCustomLineCap * cap;
|
|
|
|
GpStatus ret;
|
|
|
|
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, customCap);
|
|
|
|
|
2008-08-01 11:39:48 +02:00
|
|
|
/* native crashes on pen == NULL, customCap != NULL */
|
|
|
|
if(!customCap) return InvalidParameter;
|
2007-07-20 03:22:43 +02:00
|
|
|
|
|
|
|
if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
|
|
|
|
GdipDeleteCustomLineCap(pen->customend);
|
|
|
|
pen->endcap = LineCapCustom;
|
|
|
|
pen->customend = cap;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* customCap)
|
|
|
|
{
|
|
|
|
GpCustomLineCap * cap;
|
|
|
|
GpStatus ret;
|
|
|
|
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p)\n", pen, customCap);
|
|
|
|
|
2008-08-01 11:39:48 +02:00
|
|
|
/* native crashes on pen == NULL, customCap != NULL */
|
|
|
|
if(!customCap) return InvalidParameter;
|
2007-07-20 03:22:43 +02:00
|
|
|
|
|
|
|
if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
|
|
|
|
GdipDeleteCustomLineCap(pen->customstart);
|
|
|
|
pen->startcap = LineCapCustom;
|
|
|
|
pen->customstart = cap;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-07-26 04:15:38 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
|
|
|
|
INT count)
|
|
|
|
{
|
2007-07-28 01:07:47 +02:00
|
|
|
INT i;
|
|
|
|
REAL sum = 0;
|
|
|
|
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %p, %d)\n", pen, dash, count);
|
|
|
|
|
2007-07-26 04:15:38 +02:00
|
|
|
if(!pen || !dash)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2008-05-13 00:35:17 +02:00
|
|
|
if(count <= 0)
|
|
|
|
return OutOfMemory;
|
|
|
|
|
2007-07-28 01:07:47 +02:00
|
|
|
for(i = 0; i < count; i++){
|
|
|
|
sum += dash[i];
|
2020-02-15 22:51:37 +01:00
|
|
|
if(dash[i] <= 0.0)
|
2007-07-28 01:07:47 +02:00
|
|
|
return InvalidParameter;
|
|
|
|
}
|
|
|
|
|
2015-10-05 00:22:34 +02:00
|
|
|
heap_free(pen->dashes);
|
2007-07-26 04:15:38 +02:00
|
|
|
pen->dashes = NULL;
|
|
|
|
|
|
|
|
if(count > 0)
|
2015-10-05 00:22:34 +02:00
|
|
|
pen->dashes = heap_alloc_zero(count * sizeof(REAL));
|
2007-07-26 04:15:38 +02:00
|
|
|
if(!pen->dashes){
|
|
|
|
pen->numdashes = 0;
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
2007-07-28 01:07:39 +02:00
|
|
|
GdipSetPenDashStyle(pen, DashStyleCustom);
|
2007-07-26 04:15:38 +02:00
|
|
|
memcpy(pen->dashes, dash, count * sizeof(REAL));
|
|
|
|
pen->numdashes = count;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-07-10 21:16:41 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPenDashCap197819(GpPen *pen, GpDashCap dashCap)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %d)\n", pen, dashCap);
|
|
|
|
|
2008-07-10 21:16:41 +02:00
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
pen->dashcap = dashCap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-09 04:42:03 +02:00
|
|
|
/* FIXME: dash offset not used */
|
|
|
|
GpStatus WINGDIPAPI GdipSetPenDashOffset(GpPen *pen, REAL offset)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %.2f)\n", pen, offset);
|
|
|
|
|
2007-08-09 04:42:03 +02:00
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
pen->offset = offset;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-07-17 04:45:16 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %d)\n", pen, dash);
|
|
|
|
|
2007-07-17 04:45:16 +02:00
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2007-07-26 04:15:38 +02:00
|
|
|
if(dash != DashStyleCustom){
|
2015-10-05 00:22:34 +02:00
|
|
|
heap_free(pen->dashes);
|
2007-07-26 04:15:38 +02:00
|
|
|
pen->dashes = NULL;
|
|
|
|
pen->numdashes = 0;
|
|
|
|
}
|
|
|
|
|
2007-07-17 04:45:16 +02:00
|
|
|
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);
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-07-06 03:37:52 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %d)\n", pen, cap);
|
|
|
|
|
2007-07-06 03:37:52 +02:00
|
|
|
if(!pen) return InvalidParameter;
|
|
|
|
|
2007-07-20 03:22:43 +02:00
|
|
|
/* The old custom cap gets deleted even if the new style is LineCapCustom. */
|
|
|
|
GdipDeleteCustomLineCap(pen->customend);
|
|
|
|
pen->customend = NULL;
|
2007-07-06 03:37:52 +02:00
|
|
|
pen->endcap = cap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
2007-07-13 04:42:47 +02:00
|
|
|
|
2007-07-17 04:44:50 +02:00
|
|
|
/* FIXME: startcap, dashcap not used. */
|
|
|
|
GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen *pen, GpLineCap start,
|
|
|
|
GpLineCap end, GpDashCap dash)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("%p, %d, %d, %d)\n", pen, start, end, dash);
|
|
|
|
|
2007-07-17 04:44:50 +02:00
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2007-07-20 03:22:43 +02:00
|
|
|
GdipDeleteCustomLineCap(pen->customend);
|
|
|
|
GdipDeleteCustomLineCap(pen->customstart);
|
|
|
|
pen->customend = NULL;
|
|
|
|
pen->customstart = NULL;
|
|
|
|
|
2007-07-17 04:44:50 +02:00
|
|
|
pen->startcap = start;
|
|
|
|
pen->endcap = end;
|
|
|
|
pen->dashcap = dash;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-07-13 04:42:47 +02:00
|
|
|
/* 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)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %d)\n", pen, join);
|
|
|
|
|
2007-07-13 04:42:47 +02:00
|
|
|
if(!pen) return InvalidParameter;
|
|
|
|
|
|
|
|
pen->join = join;
|
|
|
|
pen->style &= ~(PS_JOIN_ROUND | PS_JOIN_BEVEL | PS_JOIN_MITER);
|
|
|
|
pen->style |= gdip_to_gdi_join(join);
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
2007-07-17 04:44:58 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetPenMiterLimit(GpPen *pen, REAL limit)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %.2f)\n", pen, limit);
|
|
|
|
|
2007-07-17 04:44:58 +02:00
|
|
|
if(!pen)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
pen->miterlimit = limit;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
2007-07-20 03:23:13 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetPenStartCap(GpPen *pen, GpLineCap cap)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %d)\n", pen, cap);
|
|
|
|
|
2007-07-20 03:23:13 +02:00
|
|
|
if(!pen) return InvalidParameter;
|
|
|
|
|
|
|
|
GdipDeleteCustomLineCap(pen->customstart);
|
|
|
|
pen->customstart = NULL;
|
|
|
|
pen->startcap = cap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
2007-08-02 02:55:54 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetPenWidth(GpPen *pen, REAL width)
|
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %.2f)\n", pen, width);
|
|
|
|
|
2007-08-02 02:55:54 +02:00
|
|
|
if(!pen) return InvalidParameter;
|
|
|
|
|
|
|
|
pen->width = width;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
2008-01-30 05:46:25 +01:00
|
|
|
|
2008-07-31 07:08:32 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPenMode(GpPen *pen, GpPenAlignment mode)
|
2008-01-30 05:46:25 +01:00
|
|
|
{
|
2008-11-06 18:44:10 +01:00
|
|
|
TRACE("(%p, %d)\n", pen, mode);
|
|
|
|
|
2008-01-30 05:46:25 +01:00
|
|
|
if(!pen) return InvalidParameter;
|
|
|
|
|
2008-07-31 07:08:32 +02:00
|
|
|
pen->align = mode;
|
2008-01-30 05:46:25 +01:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|