mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 02:46:32 +00:00
gdiplus: Partial implementation of GdipCreateMetafileFromWMF.
This commit is contained in:
parent
249c07c161
commit
50799cf04f
3 changed files with 75 additions and 3 deletions
|
@ -4,7 +4,8 @@ SRCDIR = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
MODULE = gdiplus.dll
|
||||
IMPORTLIB = libgdiplus.$(IMPLIBEXT)
|
||||
IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
|
||||
IMPORTS = oleaut32 ole32 user32 gdi32 advapi32 kernel32 ntdll
|
||||
EXTRALIBS = -luuid
|
||||
|
||||
C_SRCS = \
|
||||
brush.c \
|
||||
|
|
|
@ -20,13 +20,22 @@
|
|||
#define __WINE_GP_PRIVATE_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "wingdi.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
|
||||
#include "objbase.h"
|
||||
#include "ocidl.h"
|
||||
|
||||
#include "gdiplus.h"
|
||||
|
||||
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
|
||||
#define MAX_ARC_PTS (13)
|
||||
#define MAX_DASHLEN (16) /* this is a limitation of gdi */
|
||||
#define INCH_HIMETRIC (2540)
|
||||
|
||||
COLORREF ARGB2COLORREF(ARGB color);
|
||||
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 */
|
||||
};
|
||||
|
||||
struct GpImage{
|
||||
IPicture* picture;
|
||||
ImageType type;
|
||||
};
|
||||
|
||||
struct GpMetafile{
|
||||
GpImage image;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,13 @@
|
|||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "wingdi.h"
|
||||
|
||||
#define COBJMACROS
|
||||
#include "objbase.h"
|
||||
#include "ocidl.h"
|
||||
#include "olectl.h"
|
||||
#include "ole2.h"
|
||||
|
||||
#include "gdiplus.h"
|
||||
#include "gdiplus_private.h"
|
||||
#include "wine/debug.h"
|
||||
|
@ -839,14 +846,60 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
|
|||
GDIPCONST WmfPlaceableFileHeader * placeable, GpMetafile **metafile)
|
||||
{
|
||||
static int calls;
|
||||
IStream *stream;
|
||||
UINT read;
|
||||
BYTE* copy;
|
||||
METAFILEPICT mfp;
|
||||
HENHMETAFILE hemf;
|
||||
|
||||
if(!hwmf || !metafile || !placeable)
|
||||
return InvalidParameter;
|
||||
|
||||
if(!(calls++))
|
||||
FIXME("not implemented\n");
|
||||
FIXME("partially implemented\n");
|
||||
|
||||
return NotImplemented;
|
||||
if(placeable->Inch != INCH_HIMETRIC)
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue