gdiplus: Partial implementation of GdipCreateMetafileFromWMF.
This commit is contained in:
parent
249c07c161
commit
50799cf04f
|
@ -4,7 +4,8 @@ SRCDIR = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
MODULE = gdiplus.dll
|
MODULE = gdiplus.dll
|
||||||
IMPORTLIB = libgdiplus.$(IMPLIBEXT)
|
IMPORTLIB = libgdiplus.$(IMPLIBEXT)
|
||||||
IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
|
IMPORTS = oleaut32 ole32 user32 gdi32 advapi32 kernel32 ntdll
|
||||||
|
EXTRALIBS = -luuid
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
brush.c \
|
brush.c \
|
||||||
|
|
|
@ -20,13 +20,22 @@
|
||||||
#define __WINE_GP_PRIVATE_H_
|
#define __WINE_GP_PRIVATE_H_
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "winuser.h"
|
||||||
|
|
||||||
|
#include "objbase.h"
|
||||||
|
#include "ocidl.h"
|
||||||
|
|
||||||
#include "gdiplus.h"
|
#include "gdiplus.h"
|
||||||
|
|
||||||
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | 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)
|
||||||
#define MAX_DASHLEN (16) /* this is a limitation of gdi */
|
#define MAX_DASHLEN (16) /* this is a limitation of gdi */
|
||||||
|
#define INCH_HIMETRIC (2540)
|
||||||
|
|
||||||
COLORREF ARGB2COLORREF(ARGB color);
|
COLORREF ARGB2COLORREF(ARGB color);
|
||||||
extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
|
extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
|
||||||
|
@ -108,4 +117,13 @@ struct GpCustomLineCap{
|
||||||
REAL inset; /* how much to adjust the end of the line */
|
REAL inset; /* how much to adjust the end of the line */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct GpImage{
|
||||||
|
IPicture* picture;
|
||||||
|
ImageType type;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GpMetafile{
|
||||||
|
GpImage image;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,6 +23,13 @@
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
#include "objbase.h"
|
||||||
|
#include "ocidl.h"
|
||||||
|
#include "olectl.h"
|
||||||
|
#include "ole2.h"
|
||||||
|
|
||||||
#include "gdiplus.h"
|
#include "gdiplus.h"
|
||||||
#include "gdiplus_private.h"
|
#include "gdiplus_private.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
@ -839,14 +846,60 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
|
||||||
GDIPCONST WmfPlaceableFileHeader * placeable, GpMetafile **metafile)
|
GDIPCONST WmfPlaceableFileHeader * placeable, GpMetafile **metafile)
|
||||||
{
|
{
|
||||||
static int calls;
|
static int calls;
|
||||||
|
IStream *stream;
|
||||||
|
UINT read;
|
||||||
|
BYTE* copy;
|
||||||
|
METAFILEPICT mfp;
|
||||||
|
HENHMETAFILE hemf;
|
||||||
|
|
||||||
if(!hwmf || !metafile || !placeable)
|
if(!hwmf || !metafile || !placeable)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
if(!(calls++))
|
if(!(calls++))
|
||||||
FIXME("not implemented\n");
|
FIXME("partially implemented\n");
|
||||||
|
|
||||||
|
if(placeable->Inch != INCH_HIMETRIC)
|
||||||
return NotImplemented;
|
return NotImplemented;
|
||||||
|
|
||||||
|
mfp.mm = MM_HIMETRIC;
|
||||||
|
mfp.xExt = placeable->BoundingBox.Right - placeable->BoundingBox.Left;
|
||||||
|
mfp.yExt = placeable->BoundingBox.Bottom - placeable->BoundingBox.Top;
|
||||||
|
mfp.hMF = NULL;
|
||||||
|
|
||||||
|
read = GetMetaFileBitsEx(hwmf, 0, NULL);
|
||||||
|
if(!read)
|
||||||
|
return GenericError;
|
||||||
|
copy = GdipAlloc(read);
|
||||||
|
GetMetaFileBitsEx(hwmf, read, copy);
|
||||||
|
|
||||||
|
hemf = SetWinMetaFileBits(read, copy, NULL, &mfp);
|
||||||
|
GdipFree(copy);
|
||||||
|
|
||||||
|
read = GetEnhMetaFileBits(hemf, 0, NULL);
|
||||||
|
copy = GdipAlloc(read);
|
||||||
|
GetEnhMetaFileBits(hemf, read, copy);
|
||||||
|
DeleteEnhMetaFile(hemf);
|
||||||
|
|
||||||
|
if(CreateStreamOnHGlobal(copy, TRUE, &stream) != S_OK){
|
||||||
|
ERR("could not make stream\n");
|
||||||
|
return GenericError;
|
||||||
|
}
|
||||||
|
|
||||||
|
*metafile = GdipAlloc(sizeof(GpMetafile));
|
||||||
|
if(!*metafile) return OutOfMemory;
|
||||||
|
|
||||||
|
if(OleLoadPicture(stream, 0, FALSE, &IID_IPicture,
|
||||||
|
(LPVOID*) &((*metafile)->image.picture)) != S_OK){
|
||||||
|
GdipFree(*metafile);
|
||||||
|
return GenericError;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*metafile)->image.type = ImageTypeMetafile;
|
||||||
|
|
||||||
|
if(delete)
|
||||||
|
DeleteMetaFile(hwmf);
|
||||||
|
|
||||||
|
return Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
|
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
|
||||||
|
|
Loading…
Reference in New Issue