mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 10:13:37 +00:00
gdiplus: Initial custom line caps implementation.
This commit is contained in:
parent
a8322cb1ad
commit
d07088ee8a
|
@ -8,6 +8,7 @@ IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
|
|||
|
||||
C_SRCS = \
|
||||
brush.c \
|
||||
customlinecap.c \
|
||||
gdiplus.c \
|
||||
graphics.c \
|
||||
graphicspath.c \
|
||||
|
|
79
dlls/gdiplus/customlinecap.c
Normal file
79
dlls/gdiplus/customlinecap.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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 "gdiplus.h"
|
||||
#include "gdiplus_private.h"
|
||||
|
||||
GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath,
|
||||
GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap)
|
||||
{
|
||||
GpPathData *pathdata;
|
||||
|
||||
if(!customCap || !(fillPath || strokePath))
|
||||
return InvalidParameter;
|
||||
|
||||
*customCap = GdipAlloc(sizeof(GpCustomLineCap));
|
||||
if(!*customCap) return OutOfMemory;
|
||||
|
||||
if(strokePath){
|
||||
(*customCap)->fill = FALSE;
|
||||
pathdata = &strokePath->pathdata;
|
||||
}
|
||||
else{
|
||||
(*customCap)->fill = TRUE;
|
||||
pathdata = &fillPath->pathdata;
|
||||
}
|
||||
|
||||
(*customCap)->pathdata.Points = GdipAlloc(pathdata->Count * sizeof(PointF));
|
||||
(*customCap)->pathdata.Types = GdipAlloc(pathdata->Count);
|
||||
|
||||
if((!(*customCap)->pathdata.Types || !(*customCap)->pathdata.Points) &&
|
||||
pathdata->Count){
|
||||
GdipFree((*customCap)->pathdata.Points);
|
||||
GdipFree((*customCap)->pathdata.Types);
|
||||
GdipFree(*customCap);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
memcpy((*customCap)->pathdata.Points, pathdata->Points, pathdata->Count
|
||||
* sizeof(PointF));
|
||||
memcpy((*customCap)->pathdata.Types, pathdata->Types, pathdata->Count);
|
||||
(*customCap)->pathdata.Count = pathdata->Count;
|
||||
|
||||
(*customCap)->inset = baseInset;
|
||||
(*customCap)->cap = baseCap;
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipDeleteCustomLineCap(GpCustomLineCap *customCap)
|
||||
{
|
||||
if(!customCap)
|
||||
return InvalidParameter;
|
||||
|
||||
GdipFree(customCap->pathdata.Points);
|
||||
GdipFree(customCap->pathdata.Types);
|
||||
GdipFree(customCap);
|
||||
|
||||
return Ok;
|
||||
}
|
|
@ -74,7 +74,7 @@
|
|||
@ stub GdipCreateBitmapFromStream
|
||||
@ stub GdipCreateBitmapFromStreamICM
|
||||
@ stub GdipCreateCachedBitmap
|
||||
@ stub GdipCreateCustomLineCap
|
||||
@ stdcall GdipCreateCustomLineCap(ptr ptr long long ptr)
|
||||
@ stub GdipCreateFont
|
||||
@ stub GdipCreateFontFamilyFromName
|
||||
@ stub GdipCreateFontFromDC
|
||||
|
@ -129,7 +129,7 @@
|
|||
@ stub GdipCreateTextureIAI
|
||||
@ stdcall GdipDeleteBrush(ptr)
|
||||
@ stub GdipDeleteCachedBitmap
|
||||
@ stub GdipDeleteCustomLineCap
|
||||
@ stdcall GdipDeleteCustomLineCap(ptr)
|
||||
@ stub GdipDeleteFont
|
||||
@ stub GdipDeleteFontFamily
|
||||
@ stdcall GdipDeleteGraphics(ptr)
|
||||
|
|
|
@ -91,4 +91,11 @@ struct GpPathIterator{
|
|||
INT pathtype_pos; /* for NextPathType methods */
|
||||
};
|
||||
|
||||
struct GpCustomLineCap{
|
||||
GpPathData pathdata;
|
||||
BOOL fill; /* TRUE for fill, FALSE for stroke */
|
||||
GpLineCap cap; /* as far as I can tell, this value is ignored */
|
||||
REAL inset; /* how much to adjust the end of the line */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -101,6 +101,10 @@ GpStatus WINGDIPAPI GdipPathIterCopyData(GpPathIterator*,INT*,GpPointF*,BYTE*,
|
|||
GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator*,INT*,INT*,INT*,BOOL*);
|
||||
GpStatus WINGDIPAPI GdipPathIterRewind(GpPathIterator*);
|
||||
|
||||
GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath*,GpPath*,GpLineCap,REAL,
|
||||
GpCustomLineCap**);
|
||||
GpStatus WINGDIPAPI GdipDeleteCustomLineCap(GpCustomLineCap*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,7 @@ class GpSolidFill {};
|
|||
class GpPath {};
|
||||
class GpMatrix {};
|
||||
class GpPathIterator {};
|
||||
class GpCustomLineCap {};
|
||||
|
||||
#else /* end of c++ declarations */
|
||||
|
||||
|
@ -38,6 +39,7 @@ typedef struct GpSolidFill GpSolidFill;
|
|||
typedef struct GpPath GpPath;
|
||||
typedef struct GpMatrix GpMatrix;
|
||||
typedef struct GpPathIterator GpPathIterator;
|
||||
typedef struct GpCustomLineCap GpCustomLineCap;
|
||||
|
||||
#endif /* end of c declarations */
|
||||
|
||||
|
|
Loading…
Reference in a new issue