ReactOS  0.4.14-dev-52-g6116262
metafile.c File Reference
#include <stdarg.h>
#include <math.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/unicode.h"
#include "objbase.h"
#include "ocidl.h"
#include "olectl.h"
#include "ole2.h"
#include "winreg.h"
#include "shlwapi.h"
#include "gdiplus.h"
#include "gdiplus_private.h"
#include "wine/debug.h"
#include "wine/list.h"
Include dependency graph for metafile.c:

Go to the source code of this file.

Classes

struct  EmfPlusRecordHeader
 
struct  EmfPlusHeader
 
struct  EmfPlusClear
 
struct  EmfPlusFillRects
 
struct  EmfPlusSetClipRect
 
struct  EmfPlusSetPageTransform
 
struct  EmfPlusRect
 
struct  EmfPlusSetWorldTransform
 
struct  EmfPlusScaleWorldTransform
 
struct  EmfPlusMultiplyWorldTransform
 
struct  EmfPlusRotateWorldTransform
 
struct  EmfPlusTranslateWorldTransform
 
struct  EmfPlusBeginContainer
 
struct  EmfPlusContainerRecord
 
struct  container
 
struct  EmfPlusTransformMatrix
 
struct  EmfPlusDashedLineData
 
struct  EmfPlusCompoundLineData
 
struct  EmfPlusCustomStartCapData
 
struct  EmfPlusCustomEndCapData
 
struct  EmfPlusPenData
 
struct  EmfPlusSolidBrushData
 
struct  EmfPlusHatchBrushData
 
struct  EmfPlusTextureBrushData
 
struct  EmfPlusRectF
 
struct  EmfPlusLinearGradientBrushData
 
struct  EmfPlusBrush
 
struct  EmfPlusPen
 
struct  EmfPlusPath
 
struct  EmfPlusRegionNodePath
 
struct  EmfPlusRegion
 
struct  EmfPlusPalette
 
struct  EmfPlusBitmap
 
struct  EmfPlusMetafile
 
struct  EmfPlusImage
 
struct  EmfPlusImageAttributes
 
struct  EmfPlusObject
 
struct  EmfPlusPointR7
 
struct  EmfPlusPoint
 
struct  EmfPlusPointF
 
struct  EmfPlusDrawImage
 
struct  EmfPlusDrawImagePoints
 
struct  EmfPlusDrawPath
 
struct  EmfPlusDrawArc
 
struct  EmfPlusDrawEllipse
 
struct  EmfPlusDrawPie
 
struct  EmfPlusDrawRects
 
struct  EmfPlusFillPath
 
struct  EmfPlusFillClosedCurve
 
struct  EmfPlusFillEllipse
 
struct  EmfPlusFillPie
 
struct  EmfPlusFont
 
struct  enum_metafile_data
 

Macros

#define NONAMELESSUNION
 
#define COBJMACROS
 

Typedefs

typedef ARGB EmfPlusARGB
 
typedef struct EmfPlusRecordHeader EmfPlusRecordHeader
 
typedef struct EmfPlusHeader EmfPlusHeader
 
typedef struct EmfPlusClear EmfPlusClear
 
typedef struct EmfPlusFillRects EmfPlusFillRects
 
typedef struct EmfPlusSetClipRect EmfPlusSetClipRect
 
typedef struct EmfPlusSetPageTransform EmfPlusSetPageTransform
 
typedef struct EmfPlusRect EmfPlusRect
 
typedef struct EmfPlusSetWorldTransform EmfPlusSetWorldTransform
 
typedef struct EmfPlusScaleWorldTransform EmfPlusScaleWorldTransform
 
typedef struct EmfPlusMultiplyWorldTransform EmfPlusMultiplyWorldTransform
 
typedef struct EmfPlusRotateWorldTransform EmfPlusRotateWorldTransform
 
typedef struct EmfPlusTranslateWorldTransform EmfPlusTranslateWorldTransform
 
typedef struct EmfPlusBeginContainer EmfPlusBeginContainer
 
typedef struct EmfPlusContainerRecord EmfPlusContainerRecord
 
typedef struct container container
 
typedef struct EmfPlusTransformMatrix EmfPlusTransformMatrix
 
typedef struct EmfPlusDashedLineData EmfPlusDashedLineData
 
typedef struct EmfPlusCompoundLineData EmfPlusCompoundLineData
 
typedef struct EmfPlusCustomStartCapData EmfPlusCustomStartCapData
 
typedef struct EmfPlusCustomEndCapData EmfPlusCustomEndCapData
 
typedef struct EmfPlusPenData EmfPlusPenData
 
typedef struct EmfPlusSolidBrushData EmfPlusSolidBrushData
 
typedef struct EmfPlusHatchBrushData EmfPlusHatchBrushData
 
typedef struct EmfPlusTextureBrushData EmfPlusTextureBrushData
 
typedef struct EmfPlusRectF EmfPlusRectF
 
typedef struct EmfPlusLinearGradientBrushData EmfPlusLinearGradientBrushData
 
typedef struct EmfPlusBrush EmfPlusBrush
 
typedef struct EmfPlusPen EmfPlusPen
 
typedef struct EmfPlusPath EmfPlusPath
 
typedef struct EmfPlusRegionNodePath EmfPlusRegionNodePath
 
typedef struct EmfPlusRegion EmfPlusRegion
 
typedef struct EmfPlusPalette EmfPlusPalette
 
typedef struct EmfPlusBitmap EmfPlusBitmap
 
typedef struct EmfPlusMetafile EmfPlusMetafile
 
typedef enum ImageDataType ImageDataType
 
typedef struct EmfPlusImage EmfPlusImage
 
typedef struct EmfPlusImageAttributes EmfPlusImageAttributes
 
typedef struct EmfPlusObject EmfPlusObject
 
typedef struct EmfPlusPointR7 EmfPlusPointR7
 
typedef struct EmfPlusPoint EmfPlusPoint
 
typedef struct EmfPlusPointF EmfPlusPointF
 
typedef struct EmfPlusDrawImage EmfPlusDrawImage
 
typedef struct EmfPlusDrawImagePoints EmfPlusDrawImagePoints
 
typedef struct EmfPlusDrawPath EmfPlusDrawPath
 
typedef struct EmfPlusDrawArc EmfPlusDrawArc
 
typedef struct EmfPlusDrawEllipse EmfPlusDrawEllipse
 
typedef struct EmfPlusDrawPie EmfPlusDrawPie
 
typedef struct EmfPlusDrawRects EmfPlusDrawRects
 
typedef struct EmfPlusFillPath EmfPlusFillPath
 
typedef struct EmfPlusFillClosedCurve EmfPlusFillClosedCurve
 
typedef struct EmfPlusFillEllipse EmfPlusFillEllipse
 
typedef struct EmfPlusFillPie EmfPlusFillPie
 
typedef struct EmfPlusFont EmfPlusFont
 

Enumerations

enum  container_type { BEGIN_CONTAINER, SAVE_GRAPHICS }
 
enum  PenDataFlags {
  PenDataTransform = 0x0001, PenDataStartCap = 0x0002, PenDataEndCap = 0x0004, PenDataJoin = 0x0008,
  PenDataMiterLimit = 0x0010, PenDataLineStyle = 0x0020, PenDataDashedLineCap = 0x0040, PenDataDashedLineOffset = 0x0080,
  PenDataDashedLine = 0x0100, PenDataNonCenter = 0x0200, PenDataCompoundLine = 0x0400, PenDataCustomStartCap = 0x0800,
  PenDataCustomEndCap = 0x1000
}
 
enum  LineStyle {
  LineStyleSolid, LineStyleDash, LineStyleDot, LineStyleDashDot,
  LineStyleDashDotDot, LineStyleCustom
}
 
enum  BrushDataFlags {
  BrushDataPath = 1 << 0, BrushDataTransform = 1 << 1, BrushDataPresetColors = 1 << 2, BrushDataBlendFactorsH = 1 << 3,
  BrushDataBlendFactorsV = 1 << 4, BrushDataFocusScales = 1 << 6, BrushDataIsGammaCorrected = 1 << 7, BrushDataDoNotTransform = 1 << 8
}
 
enum  BitmapDataType { BitmapDataTypePixel, BitmapDataTypeCompressed }
 
enum  ImageDataType {
  ImageDataTypeUnknown, ImageDataTypeBitmap, ImageDataTypeMetafile, ImageDataTypeUnknown,
  ImageDataTypeBitmap, ImageDataTypeMetafile
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (gdiplus)
 
HRESULT WINAPI WICCreateImagingFactory_Proxy (UINT, IWICImagingFactory **)
 
static void metafile_free_object_table_entry (GpMetafile *metafile, BYTE id)
 
void METAFILE_Free (GpMetafile *metafile)
 
static DWORD METAFILE_AddObjectId (GpMetafile *metafile)
 
static GpStatus METAFILE_AllocateRecord (GpMetafile *metafile, DWORD size, void **result)
 
static void METAFILE_RemoveLastRecord (GpMetafile *metafile, EmfPlusRecordHeader *record)
 
static void METAFILE_WriteRecords (GpMetafile *metafile)
 
static GpStatus METAFILE_WriteHeader (GpMetafile *metafile, HDC hdc)
 
static GpStatus METAFILE_WriteEndOfFile (GpMetafile *metafile)
 
GpStatus WINGDIPAPI GdipRecordMetafile (HDC hdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
 
GpStatus WINGDIPAPI GdipRecordMetafileI (HDC hdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
 
GpStatus WINGDIPAPI GdipRecordMetafileStream (IStream *stream, HDC hdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
 
static void METAFILE_AdjustFrame (GpMetafile *metafile, const GpPointF *points, UINT num_points)
 
GpStatus METAFILE_GetGraphicsContext (GpMetafile *metafile, GpGraphics **result)
 
GpStatus METAFILE_GetDC (GpMetafile *metafile, HDC *hdc)
 
GpStatus METAFILE_GraphicsClear (GpMetafile *metafile, ARGB color)
 
static BOOL is_integer_rect (const GpRectF *rect)
 
static GpStatus METAFILE_PrepareBrushData (GpBrush *brush, DWORD *size)
 
static void METAFILE_FillBrushData (GpBrush *brush, EmfPlusBrush *data)
 
static GpStatus METAFILE_AddBrushObject (GpMetafile *metafile, GpBrush *brush, DWORD *id)
 
GpStatus METAFILE_FillRectangles (GpMetafile *metafile, GpBrush *brush, GDIPCONST GpRectF *rects, INT count)
 
GpStatus METAFILE_SetClipRect (GpMetafile *metafile, REAL x, REAL y, REAL width, REAL height, CombineMode mode)
 
static GpStatus METAFILE_AddRegionObject (GpMetafile *metafile, GpRegion *region, DWORD *id)
 
GpStatus METAFILE_SetClipRegion (GpMetafile *metafile, GpRegion *region, CombineMode mode)
 
GpStatus METAFILE_SetPageTransform (GpMetafile *metafile, GpUnit unit, REAL scale)
 
GpStatus METAFILE_SetWorldTransform (GpMetafile *metafile, GDIPCONST GpMatrix *transform)
 
GpStatus METAFILE_ScaleWorldTransform (GpMetafile *metafile, REAL sx, REAL sy, MatrixOrder order)
 
GpStatus METAFILE_MultiplyWorldTransform (GpMetafile *metafile, GDIPCONST GpMatrix *matrix, MatrixOrder order)
 
GpStatus METAFILE_RotateWorldTransform (GpMetafile *metafile, REAL angle, MatrixOrder order)
 
GpStatus METAFILE_TranslateWorldTransform (GpMetafile *metafile, REAL dx, REAL dy, MatrixOrder order)
 
GpStatus METAFILE_ResetWorldTransform (GpMetafile *metafile)
 
GpStatus METAFILE_BeginContainer (GpMetafile *metafile, GDIPCONST GpRectF *dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, DWORD StackIndex)
 
GpStatus METAFILE_BeginContainerNoParams (GpMetafile *metafile, DWORD StackIndex)
 
GpStatus METAFILE_EndContainer (GpMetafile *metafile, DWORD StackIndex)
 
GpStatus METAFILE_SaveGraphics (GpMetafile *metafile, DWORD StackIndex)
 
GpStatus METAFILE_RestoreGraphics (GpMetafile *metafile, DWORD StackIndex)
 
GpStatus METAFILE_ReleaseDC (GpMetafile *metafile, HDC hdc)
 
GpStatus METAFILE_GraphicsDeleted (GpMetafile *metafile)
 
GpStatus WINGDIPAPI GdipGetHemfFromMetafile (GpMetafile *metafile, HENHMETAFILE *hEmf)
 
static void METAFILE_GetFinalGdiTransform (const GpMetafile *metafile, XFORM *result)
 
static GpStatus METAFILE_PlaybackUpdateGdiTransform (GpMetafile *metafile)
 
static GpStatus METAFILE_PlaybackGetDC (GpMetafile *metafile)
 
static void METAFILE_PlaybackReleaseDC (GpMetafile *metafile)
 
static GpStatus METAFILE_PlaybackUpdateClip (GpMetafile *metafile)
 
static GpStatus METAFILE_PlaybackUpdateWorldTransform (GpMetafile *metafile)
 
static void metafile_set_object_table_entry (GpMetafile *metafile, BYTE id, BYTE type, void *object)
 
static GpStatus metafile_deserialize_image (const BYTE *record_data, UINT data_size, GpImage **image)
 
static GpStatus metafile_deserialize_path (const BYTE *record_data, UINT data_size, GpPath **path)
 
static GpStatus metafile_read_region_node (struct memory_buffer *mbuf, GpRegion *region, region_element *node, UINT *count)
 
static GpStatus metafile_deserialize_region (const BYTE *record_data, UINT data_size, GpRegion **region)
 
static GpStatus metafile_deserialize_brush (const BYTE *record_data, UINT data_size, GpBrush **brush)
 
static GpStatus metafile_get_pen_brush_data_offset (EmfPlusPen *data, UINT data_size, DWORD *ret)
 
static GpStatus METAFILE_PlaybackObject (GpMetafile *metafile, UINT flags, UINT data_size, const BYTE *record_data)
 
static GpStatus metafile_set_clip_region (GpMetafile *metafile, GpRegion *region, CombineMode mode)
 
GpStatus WINGDIPAPI GdipPlayMetafileRecord (GDIPCONST GpMetafile *metafile, EmfPlusRecordType recordType, UINT flags, UINT dataSize, GDIPCONST BYTE *data)
 
static int CALLBACK enum_metafile_proc (HDC hDC, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, int nObj, LPARAM lpData)
 
GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints (GpGraphics *graphics, GDIPCONST GpMetafile *metafile, GDIPCONST GpPointF *destPoints, INT count, GDIPCONST GpRectF *srcRect, Unit srcUnit, EnumerateMetafileProc callback, VOID *callbackData, GDIPCONST GpImageAttributes *imageAttributes)
 
GpStatus WINGDIPAPI GdipEnumerateMetafileDestRect (GpGraphics *graphics, GDIPCONST GpMetafile *metafile, GDIPCONST GpRectF *dest, EnumerateMetafileProc callback, VOID *cb_data, GDIPCONST GpImageAttributes *attrs)
 
GpStatus WINGDIPAPI GdipEnumerateMetafileDestRectI (GpGraphics *graphics, GDIPCONST GpMetafile *metafile, GDIPCONST GpRect *dest, EnumerateMetafileProc callback, VOID *cb_data, GDIPCONST GpImageAttributes *attrs)
 
GpStatus WINGDIPAPI GdipEnumerateMetafileDestPoint (GpGraphics *graphics, GDIPCONST GpMetafile *metafile, GDIPCONST GpPointF *dest, EnumerateMetafileProc callback, VOID *cb_data, GDIPCONST GpImageAttributes *attrs)
 
GpStatus WINGDIPAPI GdipEnumerateMetafileDestPointI (GpGraphics *graphics, GDIPCONST GpMetafile *metafile, GDIPCONST GpPoint *dest, EnumerateMetafileProc callback, VOID *cb_data, GDIPCONST GpImageAttributes *attrs)
 
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile (GpMetafile *metafile, MetafileHeader *header)
 
static int CALLBACK get_emfplus_header_proc (HDC hDC, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, int nObj, LPARAM lpData)
 
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf (HENHMETAFILE hemf, MetafileHeader *header)
 
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromWmf (HMETAFILE hwmf, GDIPCONST WmfPlaceableFileHeader *placeable, MetafileHeader *header)
 
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile (GDIPCONST WCHAR *filename, MetafileHeader *header)
 
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream (IStream *stream, MetafileHeader *header)
 
GpStatus WINGDIPAPI GdipCreateMetafileFromEmf (HENHMETAFILE hemf, BOOL delete, GpMetafile **metafile)
 
GpStatus WINGDIPAPI GdipCreateMetafileFromWmf (HMETAFILE hwmf, BOOL delete, GDIPCONST WmfPlaceableFileHeader *placeable, GpMetafile **metafile)
 
GpStatus WINGDIPAPI GdipCreateMetafileFromWmfFile (GDIPCONST WCHAR *file, GDIPCONST WmfPlaceableFileHeader *placeable, GpMetafile **metafile)
 
GpStatus WINGDIPAPI GdipCreateMetafileFromFile (GDIPCONST WCHAR *file, GpMetafile **metafile)
 
GpStatus WINGDIPAPI GdipCreateMetafileFromStream (IStream *stream, GpMetafile **metafile)
 
GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit (GpMetafile *metafile, UINT limitDpi)
 
GpStatus WINGDIPAPI GdipConvertToEmfPlus (const GpGraphics *ref, GpMetafile *metafile, BOOL *succ, EmfType emfType, const WCHAR *description, GpMetafile **out_metafile)
 
GpStatus WINGDIPAPI GdipEmfToWmfBits (HENHMETAFILE hemf, UINT cbData16, LPBYTE pData16, INT iMapMode, INT eFlags)
 
GpStatus WINGDIPAPI GdipRecordMetafileFileName (GDIPCONST WCHAR *fileName, HDC hdc, EmfType type, GDIPCONST GpRectF *pFrameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
 
GpStatus WINGDIPAPI GdipRecordMetafileFileNameI (GDIPCONST WCHAR *fileName, HDC hdc, EmfType type, GDIPCONST GpRect *pFrameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
 
GpStatus WINGDIPAPI GdipConvertToEmfPlusToFile (const GpGraphics *refGraphics, GpMetafile *metafile, BOOL *conversionSuccess, const WCHAR *filename, EmfType emfType, const WCHAR *description, GpMetafile **out_metafile)
 
static GpStatus METAFILE_CreateCompressedImageStream (GpImage *image, IStream **stream, DWORD *size)
 
static GpStatus METAFILE_FillEmfPlusBitmap (EmfPlusBitmap *record, IStream *stream, DWORD size)
 
static GpStatus METAFILE_AddImageObject (GpMetafile *metafile, GpImage *image, DWORD *id)
 
static GpStatus METAFILE_AddImageAttributesObject (GpMetafile *metafile, const GpImageAttributes *attrs, DWORD *id)
 
GpStatus METAFILE_DrawImagePointsRect (GpMetafile *metafile, GpImage *image, GDIPCONST GpPointF *points, INT count, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, VOID *callbackData)
 
GpStatus METAFILE_AddSimpleProperty (GpMetafile *metafile, SHORT prop, SHORT val)
 
static GpStatus METAFILE_AddPathObject (GpMetafile *metafile, GpPath *path, DWORD *id)
 
static GpStatus METAFILE_AddPenObject (GpMetafile *metafile, GpPen *pen, DWORD *id)
 
GpStatus METAFILE_DrawPath (GpMetafile *metafile, GpPen *pen, GpPath *path)
 
GpStatus METAFILE_FillPath (GpMetafile *metafile, GpBrush *brush, GpPath *path)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 30 of file metafile.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 23 of file metafile.c.

Typedef Documentation

◆ container

◆ EmfPlusARGB

typedef ARGB EmfPlusARGB

Definition at line 48 of file metafile.c.

◆ EmfPlusBeginContainer

◆ EmfPlusBitmap

◆ EmfPlusBrush

◆ EmfPlusClear

◆ EmfPlusCompoundLineData

◆ EmfPlusContainerRecord

◆ EmfPlusCustomEndCapData

◆ EmfPlusCustomStartCapData

◆ EmfPlusDashedLineData

◆ EmfPlusDrawArc

◆ EmfPlusDrawEllipse

◆ EmfPlusDrawImage

◆ EmfPlusDrawImagePoints

◆ EmfPlusDrawPath

◆ EmfPlusDrawPie

◆ EmfPlusDrawRects

◆ EmfPlusFillClosedCurve

◆ EmfPlusFillEllipse

◆ EmfPlusFillPath

◆ EmfPlusFillPie

◆ EmfPlusFillRects

◆ EmfPlusFont

◆ EmfPlusHatchBrushData

◆ EmfPlusHeader

◆ EmfPlusImage

◆ EmfPlusImageAttributes

◆ EmfPlusLinearGradientBrushData

◆ EmfPlusMetafile

◆ EmfPlusMultiplyWorldTransform

◆ EmfPlusObject

◆ EmfPlusPalette

◆ EmfPlusPath

◆ EmfPlusPen

◆ EmfPlusPenData

◆ EmfPlusPoint

◆ EmfPlusPointF

◆ EmfPlusPointR7

◆ EmfPlusRecordHeader

◆ EmfPlusRect

◆ EmfPlusRectF

◆ EmfPlusRegion

◆ EmfPlusRegionNodePath

◆ EmfPlusRotateWorldTransform

◆ EmfPlusScaleWorldTransform

◆ EmfPlusSetClipRect

◆ EmfPlusSetPageTransform

◆ EmfPlusSetWorldTransform

◆ EmfPlusSolidBrushData

◆ EmfPlusTextureBrushData

◆ EmfPlusTransformMatrix

◆ EmfPlusTranslateWorldTransform

◆ ImageDataType

Enumeration Type Documentation

◆ BitmapDataType

Enumerator
BitmapDataTypePixel 
BitmapDataTypeCompressed 

Definition at line 331 of file metafile.c.

◆ BrushDataFlags

Enumerator
BrushDataPath 
BrushDataTransform 
BrushDataPresetColors 
BrushDataBlendFactorsH 
BrushDataBlendFactorsV 
BrushDataFocusScales 
BrushDataIsGammaCorrected 
BrushDataDoNotTransform 

Definition at line 228 of file metafile.c.

◆ container_type

Enumerator
BEGIN_CONTAINER 
SAVE_GRAPHICS 

Definition at line 146 of file metafile.c.

147 {
150 };

◆ ImageDataType

Enumerator
ImageDataTypeUnknown 
ImageDataTypeBitmap 
ImageDataTypeMetafile 
ImageDataTypeUnknown 
ImageDataTypeBitmap 
ImageDataTypeMetafile 

Definition at line 354 of file metafile.c.

◆ LineStyle

Enumerator
LineStyleSolid 
LineStyleDash 
LineStyleDot 
LineStyleDashDot 
LineStyleDashDotDot 
LineStyleCustom 

Definition at line 186 of file metafile.c.

◆ PenDataFlags

Enumerator
PenDataTransform 
PenDataStartCap 
PenDataEndCap 
PenDataJoin 
PenDataMiterLimit 
PenDataLineStyle 
PenDataDashedLineCap 
PenDataDashedLineOffset 
PenDataDashedLine 
PenDataNonCenter 
PenDataCompoundLine 
PenDataCustomStartCap 
PenDataCustomEndCap 

Definition at line 164 of file metafile.c.

Function Documentation

◆ enum_metafile_proc()

static int CALLBACK enum_metafile_proc ( HDC  hDC,
HANDLETABLE lpHTable,
const ENHMETARECORD lpEMFR,
int  nObj,
LPARAM  lpData 
)
static

Definition at line 3385 of file metafile.c.

3387 {
3388  BOOL ret;
3389  struct enum_metafile_data *data = (struct enum_metafile_data*)lpData;
3390  const BYTE* pStr;
3391 
3392  data->metafile->handle_table = lpHTable;
3393  data->metafile->handle_count = nObj;
3394 
3395  /* First check for an EMF+ record. */
3396  if (lpEMFR->iType == EMR_GDICOMMENT)
3397  {
3398  const EMRGDICOMMENT *comment = (const EMRGDICOMMENT*)lpEMFR;
3399 
3400  if (comment->cbData >= 4 && memcmp(comment->Data, "EMF+", 4) == 0)
3401  {
3402  int offset = 4;
3403 
3404  while (offset + sizeof(EmfPlusRecordHeader) <= comment->cbData)
3405  {
3406  const EmfPlusRecordHeader *record = (const EmfPlusRecordHeader*)&comment->Data[offset];
3407 
3408  if (record->DataSize)
3409  pStr = (const BYTE*)(record+1);
3410  else
3411  pStr = NULL;
3412 
3413  ret = data->callback(record->Type, record->Flags, record->DataSize,
3414  pStr, data->callback_data);
3415 
3416  if (!ret)
3417  return 0;
3418 
3419  offset += record->Size;
3420  }
3421 
3422  return 1;
3423  }
3424  }
3425 
3426  if (lpEMFR->nSize != 8)
3427  pStr = (const BYTE*)lpEMFR->dParm;
3428  else
3429  pStr = NULL;
3430 
3431  return data->callback(lpEMFR->iType, 0, lpEMFR->nSize-8,
3432  pStr, data->callback_data);
3433 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HANDLETABLE * handle_table
GLintptr offset
Definition: glext.h:5920
DWORD dParm[1]
Definition: wingdi.h:2347
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
GpMetafile * metafile
Definition: metafile.c:3382
#define EMR_GDICOMMENT
Definition: wingdi.h:143
if(!(yy_init))
Definition: macro.lex.yy.c:714
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
Definition: id3.c:18
unsigned char BYTE
Definition: mem.h:68

Referenced by GdipEnumerateMetafileSrcRectDestPoints().

◆ GdipConvertToEmfPlus()

GpStatus WINGDIPAPI GdipConvertToEmfPlus ( const GpGraphics ref,
GpMetafile metafile,
BOOL succ,
EmfType  emfType,
const WCHAR description,
GpMetafile **  out_metafile 
)

Definition at line 3964 of file metafile.c.

3967 {
3968  static int calls;
3969 
3970  TRACE("(%p,%p,%p,%u,%s,%p)\n", ref, metafile, succ, emfType,
3971  debugstr_w(description), out_metafile);
3972 
3973  if(!ref || !metafile || !out_metafile || emfType < EmfTypeEmfOnly || emfType > EmfTypeEmfPlusDual)
3974  return InvalidParameter;
3975 
3976  if(succ)
3977  *succ = FALSE;
3978  *out_metafile = NULL;
3979 
3980  if(!(calls++))
3981  FIXME("not implemented\n");
3982 
3983  return NotImplemented;
3984 }
const char * description
Definition: directx.c:2497
Definition: send.c:47
static const unsigned char metafile[]
Definition: olepicture.c:138
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

◆ GdipConvertToEmfPlusToFile()

GpStatus WINGDIPAPI GdipConvertToEmfPlusToFile ( const GpGraphics refGraphics,
GpMetafile metafile,
BOOL conversionSuccess,
const WCHAR filename,
EmfType  emfType,
const WCHAR description,
GpMetafile **  out_metafile 
)

Definition at line 4018 of file metafile.c.

4022 {
4023  FIXME("stub: %p, %p, %p, %p, %u, %p, %p\n", refGraphics, metafile, conversionSuccess, filename, emfType, description, out_metafile);
4024  return NotImplemented;
4025 }
const char * description
Definition: directx.c:2497
const char * filename
Definition: ioapi.h:135
static const unsigned char metafile[]
Definition: olepicture.c:138
#define FIXME(fmt,...)
Definition: debug.h:110

◆ GdipCreateMetafileFromEmf()

GpStatus WINGDIPAPI GdipCreateMetafileFromEmf ( HENHMETAFILE  hemf,
BOOL  delete,
GpMetafile **  metafile 
)

Definition at line 3804 of file metafile.c.

3806 {
3807  GpStatus stat;
3809 
3810  TRACE("(%p,%i,%p)\n", hemf, delete, metafile);
3811 
3812  if(!hemf || !metafile)
3813  return InvalidParameter;
3814 
3816  if (stat != Ok)
3817  return stat;
3818 
3819  *metafile = heap_alloc_zero(sizeof(GpMetafile));
3820  if (!*metafile)
3821  return OutOfMemory;
3822 
3823  (*metafile)->image.type = ImageTypeMetafile;
3824  (*metafile)->image.format = ImageFormatEMF;
3825  (*metafile)->image.frame_count = 1;
3826  (*metafile)->image.xres = header.DpiX;
3827  (*metafile)->image.yres = header.DpiY;
3828  (*metafile)->bounds.X = (REAL)header.u.EmfHeader.rclFrame.left / 2540.0 * header.DpiX;
3829  (*metafile)->bounds.Y = (REAL)header.u.EmfHeader.rclFrame.top / 2540.0 * header.DpiY;
3830  (*metafile)->bounds.Width = (REAL)(header.u.EmfHeader.rclFrame.right - header.u.EmfHeader.rclFrame.left)
3831  / 2540.0 * header.DpiX;
3832  (*metafile)->bounds.Height = (REAL)(header.u.EmfHeader.rclFrame.bottom - header.u.EmfHeader.rclFrame.top)
3833  / 2540.0 * header.DpiY;
3834  (*metafile)->unit = UnitPixel;
3835  (*metafile)->metafile_type = header.Type;
3836  (*metafile)->hemf = hemf;
3837  (*metafile)->preserve_hemf = !delete;
3838  list_init(&(*metafile)->containers);
3839 
3840  TRACE("<-- %p\n", *metafile);
3841 
3842  return Ok;
3843 }
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hemf, MetafileHeader *header)
Definition: metafile.c:3688
static const unsigned char metafile[]
Definition: olepicture.c:138
#define TRACE(s)
Definition: solgame.cpp:4
Definition: stat.h:55
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
float REAL
Definition: types.h:41
struct CFHEADER header
Definition: fdi.c:109

Referenced by GdipCreateMetafileFromWmf(), GdipCreateMetafileFromWmfFile(), load_emf(), sync_metafile(), test_drawimage(), test_emfonly(), and test_empty().

◆ GdipCreateMetafileFromFile()

GpStatus WINGDIPAPI GdipCreateMetafileFromFile ( GDIPCONST WCHAR file,
GpMetafile **  metafile 
)

Definition at line 3915 of file metafile.c.

3917 {
3918  GpStatus status;
3919  IStream *stream;
3920 
3921  TRACE("(%p, %p)\n", file, metafile);
3922 
3923  if (!file || !metafile) return InvalidParameter;
3924 
3925  *metafile = NULL;
3926 
3928  if (status == Ok)
3929  {
3931  IStream_Release(stream);
3932  }
3933  return status;
3934 }
GpStatus WINGDIPAPI GdipCreateMetafileFromStream(IStream *stream, GpMetafile **metafile)
Definition: metafile.c:3936
GpStatus WINGDIPAPI GdipCreateStreamOnFile(GDIPCONST WCHAR *filename, UINT access, IStream **stream)
Definition: graphics.c:2558
static const unsigned char metafile[]
Definition: olepicture.c:138
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
static SERVICE_STATUS status
Definition: service.c:31
Definition: fci.c:126
Definition: ps.c:97

Referenced by GdipGetMetafileHeaderFromFile().

◆ GdipCreateMetafileFromStream()

GpStatus WINGDIPAPI GdipCreateMetafileFromStream ( IStream stream,
GpMetafile **  metafile 
)

Definition at line 3936 of file metafile.c.

3938 {
3939  GpStatus stat;
3940 
3941  TRACE("%p %p\n", stream, metafile);
3942 
3944  if (stat != Ok) return stat;
3945 
3946  if ((*metafile)->image.type != ImageTypeMetafile)
3947  {
3948  GdipDisposeImage(&(*metafile)->image);
3949  *metafile = NULL;
3950  return GenericError;
3951  }
3952 
3953  return Ok;
3954 }
static const unsigned char metafile[]
Definition: olepicture.c:138
GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream *stream, GpImage **image)
Definition: image.c:4357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
Definition: parse.h:22
Definition: stat.h:55
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345

Referenced by GdipCreateMetafileFromFile(), and GdipGetMetafileHeaderFromStream().

◆ GdipCreateMetafileFromWmf()

GpStatus WINGDIPAPI GdipCreateMetafileFromWmf ( HMETAFILE  hwmf,
BOOL  delete,
GDIPCONST WmfPlaceableFileHeader placeable,
GpMetafile **  metafile 
)

Definition at line 3845 of file metafile.c.

3847 {
3848  UINT read;
3849  BYTE *copy;
3850  HENHMETAFILE hemf;
3851  GpStatus retval = Ok;
3852 
3853  TRACE("(%p, %d, %p, %p)\n", hwmf, delete, placeable, metafile);
3854 
3855  if(!hwmf || !metafile)
3856  return InvalidParameter;
3857 
3858  *metafile = NULL;
3859  read = GetMetaFileBitsEx(hwmf, 0, NULL);
3860  if(!read)
3861  return GenericError;
3862  copy = heap_alloc_zero(read);
3863  GetMetaFileBitsEx(hwmf, read, copy);
3864 
3865  hemf = SetWinMetaFileBits(read, copy, NULL, NULL);
3866  heap_free(copy);
3867 
3868  /* FIXME: We should store and use hwmf instead of converting to hemf */
3869  retval = GdipCreateMetafileFromEmf(hemf, TRUE, metafile);
3870 
3871  if (retval == Ok)
3872  {
3873  if (placeable)
3874  {
3875  (*metafile)->image.xres = (REAL)placeable->Inch;
3876  (*metafile)->image.yres = (REAL)placeable->Inch;
3877  (*metafile)->bounds.X = ((REAL)placeable->BoundingBox.Left) / ((REAL)placeable->Inch);
3878  (*metafile)->bounds.Y = ((REAL)placeable->BoundingBox.Top) / ((REAL)placeable->Inch);
3879  (*metafile)->bounds.Width = (REAL)(placeable->BoundingBox.Right -
3880  placeable->BoundingBox.Left);
3881  (*metafile)->bounds.Height = (REAL)(placeable->BoundingBox.Bottom -
3882  placeable->BoundingBox.Top);
3883  (*metafile)->metafile_type = MetafileTypeWmfPlaceable;
3884  }
3885  else
3886  (*metafile)->metafile_type = MetafileTypeWmf;
3887  (*metafile)->image.format = ImageFormatWMF;
3888 
3889  if (delete) DeleteMetaFile(hwmf);
3890  }
3891  else
3892  DeleteEnhMetaFile(hemf);
3893  return retval;
3894 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DeleteMetaFile(HMETAFILE hmf)
Definition: metafile.c:139
static const unsigned char metafile[]
Definition: olepicture.c:138
HENHMETAFILE WINAPI SetWinMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *lpMeta16Data, _In_opt_ HDC hdcRef, _In_opt_ const METAFILEPICT *lpMFP)
GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete, GpMetafile **metafile)
Definition: metafile.c:3804
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
UINT WINAPI GetMetaFileBitsEx(HMETAFILE hmf, UINT nSize, LPVOID buf)
Definition: metafile.c:1091
#define TRACE(s)
Definition: solgame.cpp:4
if(!(yy_init))
Definition: macro.lex.yy.c:714
unsigned char BYTE
Definition: mem.h:68
Status
Definition: gdiplustypes.h:24
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
unsigned int UINT
Definition: ndis.h:50
float REAL
Definition: types.h:41
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by GdipCreateMetafileFromWmfFile(), GdipGetMetafileHeaderFromWmf(), load_wmf(), test_createfromwmf(), and test_createfromwmf_noplaceable().

◆ GdipCreateMetafileFromWmfFile()

GpStatus WINGDIPAPI GdipCreateMetafileFromWmfFile ( GDIPCONST WCHAR file,
GDIPCONST WmfPlaceableFileHeader placeable,
GpMetafile **  metafile 
)

Definition at line 3896 of file metafile.c.

3898 {
3899  HMETAFILE hmf;
3900  HENHMETAFILE emf;
3901 
3902  TRACE("(%s, %p, %p)\n", debugstr_w(file), placeable, metafile);
3903 
3904  hmf = GetMetaFileW(file);
3905  if(hmf)
3906  return GdipCreateMetafileFromWmf(hmf, TRUE, placeable, metafile);
3907 
3908  emf = GetEnhMetaFileW(file);
3909  if(emf)
3910  return GdipCreateMetafileFromEmf(emf, TRUE, metafile);
3911 
3912  return GenericError;
3913 }
#define TRUE
Definition: types.h:120
static const unsigned char metafile[]
Definition: olepicture.c:138
#define debugstr_w
Definition: kernel32.h:32
GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete, GpMetafile **metafile)
Definition: metafile.c:3804
HMETAFILE WINAPI GetMetaFileW(LPCWSTR lpFilename)
Definition: metafile.c:217
#define TRACE(s)
Definition: solgame.cpp:4
GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, GDIPCONST WmfPlaceableFileHeader *placeable, GpMetafile **metafile)
Definition: metafile.c:3845
HENHMETAFILE WINAPI GetEnhMetaFileW(_In_ LPCWSTR)
Definition: fci.c:126

Referenced by test_fillpath().

◆ GdipEmfToWmfBits()

GpStatus WINGDIPAPI GdipEmfToWmfBits ( HENHMETAFILE  hemf,
UINT  cbData16,
LPBYTE  pData16,
INT  iMapMode,
INT  eFlags 
)

Definition at line 3986 of file metafile.c.

3988 {
3989  FIXME("(%p, %d, %p, %d, %d): stub\n", hemf, cbData16, pData16, iMapMode, eFlags);
3990  return NotImplemented;
3991 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ GdipEnumerateMetafileDestPoint()

GpStatus WINGDIPAPI GdipEnumerateMetafileDestPoint ( GpGraphics graphics,
GDIPCONST GpMetafile metafile,
GDIPCONST GpPointF dest,
EnumerateMetafileProc  callback,
VOID cb_data,
GDIPCONST GpImageAttributes attrs 
)

Definition at line 3602 of file metafile.c.

3605 {
3606  GpRectF destf;
3607 
3608  if (!graphics || !metafile || !dest) return InvalidParameter;
3609 
3610  destf.X = dest->X;
3611  destf.Y = dest->Y;
3612  destf.Width = units_to_pixels(metafile->bounds.Width, metafile->unit, metafile->image.xres);
3613  destf.Height = units_to_pixels(metafile->bounds.Height, metafile->unit, metafile->image.yres);
3614 
3615  return GdipEnumerateMetafileDestRect(graphics, metafile, &destf, callback, cb_data, attrs);
3616 }
GpStatus WINGDIPAPI GdipEnumerateMetafileDestRect(GpGraphics *graphics, GDIPCONST GpMetafile *metafile, GDIPCONST GpRectF *dest, EnumerateMetafileProc callback, VOID *cb_data, GDIPCONST GpImageAttributes *attrs)
Definition: metafile.c:3569
static const unsigned char metafile[]
Definition: olepicture.c:138
REAL Height
Definition: gdiplustypes.h:264
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
REAL X
Definition: gdiplustypes.h:261
REAL Width
Definition: gdiplustypes.h:263
REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi)
Definition: gdiplus.c:327
static char * dest
Definition: rtl.c:135
REAL Y
Definition: gdiplustypes.h:262

Referenced by GdipEnumerateMetafileDestPointI().

◆ GdipEnumerateMetafileDestPointI()

GpStatus WINGDIPAPI GdipEnumerateMetafileDestPointI ( GpGraphics graphics,
GDIPCONST GpMetafile metafile,
GDIPCONST GpPoint dest,
EnumerateMetafileProc  callback,
VOID cb_data,
GDIPCONST GpImageAttributes attrs 
)

Definition at line 3618 of file metafile.c.

3621 {
3622  GpPointF ptf;
3623 
3624  if (!graphics || !metafile || !dest) return InvalidParameter;
3625 
3626  ptf.X = dest->X;
3627  ptf.Y = dest->Y;
3628 
3629  return GdipEnumerateMetafileDestPoint(graphics, metafile, &ptf, callback, cb_data, attrs);
3630 }
static const unsigned char metafile[]
Definition: olepicture.c:138
GpStatus WINGDIPAPI GdipEnumerateMetafileDestPoint(GpGraphics *graphics, GDIPCONST GpMetafile *metafile, GDIPCONST GpPointF *dest, EnumerateMetafileProc callback, VOID *cb_data, GDIPCONST GpImageAttributes *attrs)
Definition: metafile.c:3602
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
REAL Y
Definition: gdiplustypes.h:249
REAL X
Definition: gdiplustypes.h:248
static char * dest
Definition: rtl.c:135

◆ GdipEnumerateMetafileDestRect()

GpStatus WINGDIPAPI GdipEnumerateMetafileDestRect ( GpGraphics graphics,
GDIPCONST GpMetafile metafile,
GDIPCONST GpRectF dest,
EnumerateMetafileProc  callback,
VOID cb_data,
GDIPCONST GpImageAttributes attrs 
)

Definition at line 3569 of file metafile.c.

3572 {
3573  GpPointF points[3];
3574 
3575  if (!graphics || !metafile || !dest) return InvalidParameter;
3576 
3577  points[0].X = points[2].X = dest->X;
3578  points[0].Y = points[1].Y = dest->Y;
3579  points[1].X = dest->X + dest->Width;
3580  points[2].Y = dest->Y + dest->Height;
3581 
3583  &metafile->bounds, metafile->unit, callback, cb_data, attrs);
3584 }
GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics, GDIPCONST GpMetafile *metafile, GDIPCONST GpPointF *destPoints, INT count, GDIPCONST GpRectF *srcRect, Unit srcUnit, EnumerateMetafileProc callback, VOID *callbackData, GDIPCONST GpImageAttributes *imageAttributes)
Definition: metafile.c:3435
static const unsigned char metafile[]
Definition: olepicture.c:138
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
GLsizei const GLfloat * points
Definition: glext.h:8112
static char * dest
Definition: rtl.c:135

Referenced by GdipEnumerateMetafileDestPoint(), and GdipEnumerateMetafileDestRectI().

◆ GdipEnumerateMetafileDestRectI()

GpStatus WINGDIPAPI GdipEnumerateMetafileDestRectI ( GpGraphics graphics,
GDIPCONST GpMetafile metafile,
GDIPCONST GpRect dest,
EnumerateMetafileProc  callback,
VOID cb_data,
GDIPCONST GpImageAttributes attrs 
)

Definition at line 3586 of file metafile.c.

3589 {
3590  GpRectF destf;
3591 
3592  if (!graphics || !metafile || !dest) return InvalidParameter;
3593 
3594  destf.X = dest->X;
3595  destf.Y = dest->Y;
3596  destf.Width = dest->Width;
3597  destf.Height = dest->Height;
3598 
3599  return GdipEnumerateMetafileDestRect(graphics, metafile, &destf, callback, cb_data, attrs);
3600 }
GpStatus WINGDIPAPI GdipEnumerateMetafileDestRect(GpGraphics *graphics, GDIPCONST GpMetafile *metafile, GDIPCONST GpRectF *dest, EnumerateMetafileProc callback, VOID *cb_data, GDIPCONST GpImageAttributes *attrs)
Definition: metafile.c:3569
static const unsigned char metafile[]
Definition: olepicture.c:138
REAL Height
Definition: gdiplustypes.h:264
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
REAL X
Definition: gdiplustypes.h:261
REAL Width
Definition: gdiplustypes.h:263
static char * dest
Definition: rtl.c:135
REAL Y
Definition: gdiplustypes.h:262

◆ GdipEnumerateMetafileSrcRectDestPoints()

GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints ( GpGraphics graphics,
GDIPCONST GpMetafile metafile,
GDIPCONST GpPointF destPoints,
INT  count,
GDIPCONST GpRectF srcRect,
Unit  srcUnit,
EnumerateMetafileProc  callback,
VOID callbackData,
GDIPCONST GpImageAttributes imageAttributes 
)

Definition at line 3435 of file metafile.c.

3439 {
3440  struct enum_metafile_data data;
3441  GpStatus stat;
3442  GpMetafile *real_metafile = (GpMetafile*)metafile; /* whoever made this const was joking */
3444  GpPath *dst_path;
3445 
3446  TRACE("(%p,%p,%p,%i,%p,%i,%p,%p,%p)\n", graphics, metafile,
3447  destPoints, count, srcRect, srcUnit, callback, callbackData,
3448  imageAttributes);
3449 
3450  if (!graphics || !metafile || !destPoints || count != 3 || !srcRect)
3451  return InvalidParameter;
3452 
3453  if (!metafile->hemf)
3454  return InvalidParameter;
3455 
3456  if (metafile->playback_graphics)
3457  return ObjectBusy;
3458 
3459  TRACE("%s %i -> %s %s %s\n", debugstr_rectf(srcRect), srcUnit,
3460  debugstr_pointf(&destPoints[0]), debugstr_pointf(&destPoints[1]),
3461  debugstr_pointf(&destPoints[2]));
3462 
3463  data.callback = callback;
3464  data.callback_data = callbackData;
3465  data.metafile = real_metafile;
3466 
3467  real_metafile->playback_graphics = graphics;
3468  real_metafile->playback_dc = NULL;
3469  real_metafile->src_rect = *srcRect;
3470 
3471  memcpy(real_metafile->playback_points, destPoints, sizeof(PointF) * 3);
3473 
3474  if (stat == Ok)
3475  stat = GdipBeginContainer2(graphics, &state);
3476 
3477  if (stat == Ok)
3478  {
3479  stat = GdipSetPageScale(graphics, 1.0);
3480 
3481  if (stat == Ok)
3482  stat = GdipSetPageUnit(graphics, UnitPixel);
3483 
3484  if (stat == Ok)
3485  stat = GdipResetWorldTransform(graphics);
3486 
3487  if (stat == Ok)
3488  stat = GdipCreateRegion(&real_metafile->base_clip);
3489 
3490  if (stat == Ok)
3491  stat = GdipGetClip(graphics, real_metafile->base_clip);
3492 
3493  if (stat == Ok)
3494  stat = GdipCreateRegion(&real_metafile->clip);
3495 
3496  if (stat == Ok)
3497  stat = GdipCreatePath(FillModeAlternate, &dst_path);
3498 
3499  if (stat == Ok)
3500  {
3501  GpPointF clip_points[4];
3502 
3503  clip_points[0] = real_metafile->playback_points[0];
3504  clip_points[1] = real_metafile->playback_points[1];
3505  clip_points[2].X = real_metafile->playback_points[1].X + real_metafile->playback_points[2].X
3506  - real_metafile->playback_points[0].X;
3507  clip_points[2].Y = real_metafile->playback_points[1].Y + real_metafile->playback_points[2].Y
3508  - real_metafile->playback_points[0].Y;
3509  clip_points[3] = real_metafile->playback_points[2];
3510 
3511  stat = GdipAddPathPolygon(dst_path, clip_points, 4);
3512 
3513  if (stat == Ok)
3514  stat = GdipCombineRegionPath(real_metafile->base_clip, dst_path, CombineModeIntersect);
3515 
3516  GdipDeletePath(dst_path);
3517  }
3518 
3519  if (stat == Ok)
3520  stat = GdipCreateMatrix(&real_metafile->world_transform);
3521 
3522  if (stat == Ok)
3523  {
3524  real_metafile->page_unit = UnitDisplay;
3525  real_metafile->page_scale = 1.0;
3527  }
3528 
3529  if (stat == Ok)
3530  {
3531  stat = METAFILE_PlaybackUpdateClip(real_metafile);
3532  }
3533 
3534  if (stat == Ok && (metafile->metafile_type == MetafileTypeEmf ||
3535  metafile->metafile_type == MetafileTypeWmfPlaceable ||
3536  metafile->metafile_type == MetafileTypeWmf))
3537  stat = METAFILE_PlaybackGetDC(real_metafile);
3538 
3539  if (stat == Ok)
3541 
3542  METAFILE_PlaybackReleaseDC(real_metafile);
3543 
3544  GdipDeleteMatrix(real_metafile->world_transform);
3545  real_metafile->world_transform = NULL;
3546 
3547  GdipDeleteRegion(real_metafile->base_clip);
3548  real_metafile->base_clip = NULL;
3549 
3550  GdipDeleteRegion(real_metafile->clip);
3551  real_metafile->clip = NULL;
3552 
3553  while (list_head(&real_metafile->containers))
3554  {
3555  container* cont = LIST_ENTRY(list_head(&real_metafile->containers), container, entry);
3556  list_remove(&cont->entry);
3557  GdipDeleteRegion(cont->clip);
3558  heap_free(cont);
3559  }
3560 
3561  GdipEndContainer(graphics, state);
3562  }
3563 
3564  real_metafile->playback_graphics = NULL;
3565 
3566  return stat;
3567 }
GpStatus WINGDIPAPI GdipAddPathPolygon(GpPath *path, GDIPCONST GpPointF *points, INT count)
Definition: graphicspath.c:844
GpStatus WINGDIPAPI GdipResetWorldTransform(GpGraphics *graphics)
Definition: graphics.c:5840
const char * debugstr_pointf(const PointF *pt)
Definition: gdiplus.c:482
struct list entry
Definition: metafile.c:154
GpRectF src_rect
static GpStatus METAFILE_PlaybackGetDC(GpMetafile *metafile)
Definition: metafile.c:1656
static void METAFILE_PlaybackReleaseDC(GpMetafile *metafile)
Definition: metafile.c:1673
GLuint GLuint GLsizei count
Definition: gl.h:1545
GpUnit page_unit
GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
Definition: matrix.c:140
GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode mode)
Definition: region.c:232
UINT GraphicsContainer
Definition: gdiplusenums.h:23
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
static const unsigned char metafile[]
Definition: olepicture.c:138
GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region)
Definition: graphics.c:6809
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
Definition: graphics.c:6202
GpRegion * base_clip
static int CALLBACK enum_metafile_proc(HDC hDC, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, int nObj, LPARAM lpData)
Definition: metafile.c:3385
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EnumEnhMetaFile(_In_opt_ HDC, _In_ HENHMETAFILE, _In_ ENHMFENUMPROC, _In_opt_ PVOID, _In_opt_ LPCRECT)
GpGraphics * playback_graphics
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
Definition: region.c:390
#define TRACE(s)
Definition: solgame.cpp:4
GpStatus WINGDIPAPI GdipEndContainer(GpGraphics *graphics, GraphicsContainer state)
Definition: graphics.c:6039
static GpStatus METAFILE_PlaybackUpdateClip(GpMetafile *metafile)
Definition: metafile.c:1682
const char * debugstr_rectf(const RectF *rc)
Definition: gdiplus.c:476
GpStatus WINGDIPAPI GdipBeginContainer2(GpGraphics *graphics, GraphicsContainer *state)
Definition: graphics.c:5917
REAL Y
Definition: gdiplustypes.h:249
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
Definition: matrix.c:160
static GpStatus METAFILE_PlaybackUpdateWorldTransform(GpMetafile *metafile)
Definition: metafile.c:1691
GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path)
static int state
Definition: maze.c:121
Definition: stat.h:55
uint32_t entry
Definition: isohybrid.c:63
REAL X
Definition: gdiplustypes.h:248
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GpRegion * clip
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
GpPointF playback_points[3]
GpMatrix * world_transform
GpRegion * clip
Definition: metafile.c:161
struct list containers
GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale)
Definition: graphics.c:6178
#define LIST_ENTRY(type)
Definition: queue.h:175
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
Definition: region.c:571
GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6960
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by check_metafile(), GdipDrawImagePointsRect(), GdipEnumerateMetafileDestRect(), and play_metafile().

◆ GdipGetHemfFromMetafile()

GpStatus WINGDIPAPI GdipGetHemfFromMetafile ( GpMetafile metafile,
HENHMETAFILE *  hEmf 
)

Definition at line 1613 of file metafile.c.

1614 {
1615  TRACE("(%p,%p)\n", metafile, hEmf);
1616 
1617  if (!metafile || !hEmf || !metafile->hemf)
1618  return InvalidParameter;
1619 
1620  *hEmf = metafile->hemf;
1621  metafile->hemf = NULL;
1622 
1623  return Ok;
1624 }
static const unsigned char metafile[]
Definition: olepicture.c:138
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by sync_metafile(), test_clear(), test_drawimage(), test_drawpath(), test_emfonly(), test_empty(), test_fillpath(), test_fillrect(), test_gditransform(), test_getdc(), and test_properties().

◆ GdipGetMetafileHeaderFromEmf()

GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf ( HENHMETAFILE  hemf,
MetafileHeader header 
)

Definition at line 3688 of file metafile.c.

3690 {
3691  ENHMETAHEADER3 emfheader;
3692  EmfPlusHeader emfplusheader;
3693  MetafileType metafile_type;
3694 
3695  TRACE("(%p,%p)\n", hemf, header);
3696 
3697  if(!hemf || !header)
3698  return InvalidParameter;
3699 
3700  if (GetEnhMetaFileHeader(hemf, sizeof(emfheader), (ENHMETAHEADER*)&emfheader) == 0)
3701  return GenericError;
3702 
3703  emfplusheader.Header.Type = 0;
3704 
3705  EnumEnhMetaFile(NULL, hemf, get_emfplus_header_proc, &emfplusheader, NULL);
3706 
3707  if (emfplusheader.Header.Type == EmfPlusRecordTypeHeader)
3708  {
3709  if ((emfplusheader.Header.Flags & 1) == 1)
3710  metafile_type = MetafileTypeEmfPlusDual;
3711  else
3712  metafile_type = MetafileTypeEmfPlusOnly;
3713  }
3714  else
3715  metafile_type = MetafileTypeEmf;
3716 
3717  header->Type = metafile_type;
3718  header->Size = emfheader.nBytes;
3719  header->DpiX = (REAL)emfheader.szlDevice.cx * 25.4 / emfheader.szlMillimeters.cx;
3720  header->DpiY = (REAL)emfheader.szlDevice.cy * 25.4 / emfheader.szlMillimeters.cy;
3721  header->X = gdip_round((REAL)emfheader.rclFrame.left / 2540.0 * header->DpiX);
3722  header->Y = gdip_round((REAL)emfheader.rclFrame.top / 2540.0 * header->DpiY);
3723  header->Width = gdip_round((REAL)(emfheader.rclFrame.right - emfheader.rclFrame.left) / 2540.0 * header->DpiX);
3724  header->Height = gdip_round((REAL)(emfheader.rclFrame.bottom - emfheader.rclFrame.top) / 2540.0 * header->DpiY);
3725  header->u.EmfHeader = emfheader;
3726 
3727  if (metafile_type == MetafileTypeEmfPlusDual || metafile_type == MetafileTypeEmfPlusOnly)
3728  {
3729  header->Version = emfplusheader.Version;
3730  header->EmfPlusFlags = emfplusheader.EmfPlusFlags;
3731  header->EmfPlusHeaderSize = emfplusheader.Header.Size;
3732  header->LogicalDpiX = emfplusheader.LogicalDpiX;
3733  header->LogicalDpiY = emfplusheader.LogicalDpiY;
3734  }
3735  else
3736  {
3737  header->Version = emfheader.nVersion;
3738  header->EmfPlusFlags = 0;
3739  header->EmfPlusHeaderSize = 0;
3740  header->LogicalDpiX = 0;
3741  header->LogicalDpiY = 0;
3742  }
3743 
3744  return Ok;
3745 }
static int CALLBACK get_emfplus_header_proc(HDC hDC, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, int nObj, LPARAM lpData)
Definition: metafile.c:3662
SIZEL szlDevice
Definition: wingdi.h:2328
SIZEL szlMillimeters
Definition: wingdi.h:2329
long bottom
Definition: polytest.cpp:53
DWORD EmfPlusFlags
Definition: metafile.c:62
long right
Definition: polytest.cpp:53
DWORD Version
Definition: metafile.c:61
long top
Definition: polytest.cpp:53
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EnumEnhMetaFile(_In_opt_ HDC, _In_ HENHMETAFILE, _In_ ENHMFENUMPROC, _In_opt_ PVOID, _In_opt_ LPCRECT)
LONG cx
Definition: windef.h:319
static INT gdip_round(REAL x)
long left
Definition: polytest.cpp:53
DWORD LogicalDpiX
Definition: metafile.c:63
#define TRACE(s)
Definition: solgame.cpp:4
RECTL rclFrame
Definition: wingdi.h:2318
EmfPlusRecordHeader Header
Definition: metafile.c:60
UINT WINAPI GetEnhMetaFileHeader(_In_ HENHMETAFILE hemf, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPENHMETAHEADER lpEnhMetaHeader)
DWORD LogicalDpiY
Definition: metafile.c:64
DWORD nVersion
Definition: wingdi.h:2320
float REAL
Definition: types.h:41
LONG cy
Definition: windef.h:320
struct CFHEADER header
Definition: fdi.c:109
MetafileType
Definition: gdiplusenums.h:212

Referenced by GdipCreateMetafileFromEmf(), GdipGetMetafileHeaderFromMetafile(), METAFILE_GraphicsDeleted(), test_emfonly(), and test_empty().

◆ GdipGetMetafileHeaderFromFile()

GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile ( GDIPCONST WCHAR filename,
MetafileHeader header 
)

Definition at line 3764 of file metafile.c.

3766 {
3767  GpStatus status;
3769 
3770  TRACE("(%s,%p)\n", debugstr_w(filename), header);
3771 
3772  if (!filename || !header)
3773  return InvalidParameter;
3774 
3776  if (status == Ok)
3777  {
3779  GdipDisposeImage(&metafile->image);
3780  }
3781  return status;
3782 }
const char * filename
Definition: ioapi.h:135
static const unsigned char metafile[]
Definition: olepicture.c:138
#define debugstr_w
Definition: kernel32.h:32
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile *metafile, MetafileHeader *header)
Definition: metafile.c:3632
#define TRACE(s)
Definition: solgame.cpp:4
GpStatus WINGDIPAPI GdipCreateMetafileFromFile(GDIPCONST WCHAR *file, GpMetafile **metafile)
Definition: metafile.c:3915
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
static SERVICE_STATUS status
Definition: service.c:31
struct CFHEADER header
Definition: fdi.c:109
Definition: ps.c:97

◆ GdipGetMetafileHeaderFromMetafile()

GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile ( GpMetafile metafile,
MetafileHeader header 
)

Definition at line 3632 of file metafile.c.

3634 {
3635  GpStatus status;
3636 
3637  TRACE("(%p, %p)\n", metafile, header);
3638 
3639  if(!metafile || !header)
3640  return InvalidParameter;
3641 
3642  if (metafile->hemf)
3643  {
3645  if (status != Ok) return status;
3646  }
3647  else
3648  {
3649  memset(header, 0, sizeof(*header));
3650  header->Version = VERSION_MAGIC2;
3651  }
3652 
3653  header->Type = metafile->metafile_type;
3654  header->DpiX = metafile->image.xres;
3655  header->DpiY = metafile->image.yres;
3656  header->Width = gdip_round(metafile->bounds.Width);
3657  header->Height = gdip_round(metafile->bounds.Height);
3658 
3659  return Ok;
3660 }
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hemf, MetafileHeader *header)
Definition: metafile.c:3688
#define VERSION_MAGIC2
static const unsigned char metafile[]
Definition: olepicture.c:138
static INT gdip_round(REAL x)
#define TRACE(s)
Definition: solgame.cpp:4
Status
Definition: gdiplustypes.h:24
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
struct CFHEADER header
Definition: fdi.c:109
Definition: ps.c:97

Referenced by GdipGetMetafileHeaderFromFile(), GdipGetMetafileHeaderFromStream(), GdipGetMetafileHeaderFromWmf(), test_createfromwmf(), test_emfonly(), test_empty(), test_gditransform(), and test_loadwmf().

◆ GdipGetMetafileHeaderFromStream()

GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream ( IStream stream,
MetafileHeader header 
)

Definition at line 3784 of file metafile.c.

3786 {
3787  GpStatus status;
3789 
3790  TRACE("(%p,%p)\n", stream, header);
3791 
3792  if (!stream || !header)
3793  return InvalidParameter;
3794 
3796  if (status == Ok)
3797  {
3799  GdipDisposeImage(&metafile->image);
3800  }
3801  return status;
3802 }
GpStatus WINGDIPAPI GdipCreateMetafileFromStream(IStream *stream, GpMetafile **metafile)
Definition: metafile.c:3936
static const unsigned char metafile[]
Definition: olepicture.c:138
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile *metafile, MetafileHeader *header)
Definition: metafile.c:3632
#define TRACE(s)
Definition: solgame.cpp:4
Definition: parse.h:22
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
static SERVICE_STATUS status
Definition: service.c:31
struct CFHEADER header
Definition: fdi.c:109
Definition: ps.c:97

◆ GdipGetMetafileHeaderFromWmf()

GpStatus WINGDIPAPI GdipGetMetafileHeaderFromWmf ( HMETAFILE  hwmf,
GDIPCONST WmfPlaceableFileHeader placeable,
MetafileHeader header 
)

Definition at line 3747 of file metafile.c.

3749 {
3750  GpStatus status;
3752 
3753  TRACE("(%p,%p,%p)\n", hwmf, placeable, header);
3754 
3755  status = GdipCreateMetafileFromWmf(hwmf, FALSE, placeable, &metafile);
3756  if (status == Ok)
3757  {
3759  GdipDisposeImage(&metafile->image);
3760  }
3761  return status;
3762 }
static const unsigned char metafile[]
Definition: olepicture.c:138
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile *metafile, MetafileHeader *header)
Definition: metafile.c:3632
#define TRACE(s)
Definition: solgame.cpp:4
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, GDIPCONST WmfPlaceableFileHeader *placeable, GpMetafile **metafile)
Definition: metafile.c:3845
static SERVICE_STATUS status
Definition: service.c:31
struct CFHEADER header
Definition: fdi.c:109
Definition: ps.c:97

◆ GdipPlayMetafileRecord()

GpStatus WINGDIPAPI GdipPlayMetafileRecord ( GDIPCONST GpMetafile metafile,
EmfPlusRecordType  recordType,
UINT  flags,
UINT  dataSize,
GDIPCONST BYTE data 
)

Definition at line 2461 of file metafile.c.

2463 {
2464  GpStatus stat;
2465  GpMetafile *real_metafile = (GpMetafile*)metafile;
2466 
2467  TRACE("(%p,%x,%x,%d,%p)\n", metafile, recordType, flags, dataSize, data);
2468 
2469  if (!metafile || (dataSize && !data) || !metafile->playback_graphics)
2470  return InvalidParameter;
2471 
2472  if (recordType >= 1 && recordType <= 0x7a)
2473  {
2474  /* regular EMF record */
2475  if (metafile->playback_dc)
2476  {
2477  switch (recordType)
2478  {
2479  case EMR_SETMAPMODE:
2480  case EMR_SAVEDC:
2481  case EMR_RESTOREDC:
2482  case EMR_SETWINDOWORGEX:
2483  case EMR_SETWINDOWEXTEX:
2484  case EMR_SETVIEWPORTORGEX:
2485  case EMR_SETVIEWPORTEXTEX:
2487  case EMR_SCALEWINDOWEXTEX:
2489  FIXME("not implemented for record type %x\n", recordType);
2490  break;
2491  case EMR_SETWORLDTRANSFORM:
2492  {
2493  const XFORM* xform = (void*)data;
2494  real_metafile->gdiworldtransform = *xform;
2495  METAFILE_PlaybackUpdateGdiTransform(real_metafile);
2496  break;
2497  }
2498  case EMR_EXTSELECTCLIPRGN:
2499  {
2500  DWORD rgndatasize = *(DWORD*)data;
2501  DWORD mode = *(DWORD*)(data + 4);
2502  const RGNDATA *rgndata = (const RGNDATA*)(data + 8);
2503  HRGN hrgn = NULL;
2504 
2505  if (dataSize > 8)
2506  {
2507  XFORM final;
2508 
2510 
2511  hrgn = ExtCreateRegion(&final, rgndatasize, rgndata);
2512  }
2513 
2514  ExtSelectClipRgn(metafile->playback_dc, hrgn, mode);
2515 
2516  DeleteObject(hrgn);
2517 
2518  return Ok;
2519  }
2520  default:
2521  {
2522  ENHMETARECORD *record = heap_alloc_zero(dataSize + 8);
2523 
2524  if (record)
2525  {
2526  record->iType = recordType;
2527  record->nSize = dataSize + 8;
2528  memcpy(record->dParm, data, dataSize);
2529 
2530  if(PlayEnhMetaFileRecord(metafile->playback_dc, metafile->handle_table,
2531  record, metafile->handle_count) == 0)
2532  ERR("PlayEnhMetaFileRecord failed\n");
2533 
2534  heap_free(record);
2535  }
2536  else
2537  return OutOfMemory;
2538 
2539  break;
2540  }
2541  }
2542  }
2543  }
2544  else
2545  {
2547 
2549 
2550  switch(recordType)
2551  {
2554  break;
2557  break;
2559  {
2561 
2562  if (dataSize != sizeof(record->Color))
2563  return InvalidParameter;
2564 
2565  return GdipGraphicsClear(metafile->playback_graphics, record->Color);
2566  }
2568  {
2570  GpBrush *brush, *temp_brush=NULL;
2571  GpRectF *rects, *temp_rects=NULL;
2572 
2573  if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(EmfPlusFillRects))
2574  return InvalidParameter;
2575 
2576  if (flags & 0x4000)
2577  {
2578  if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(EmfPlusFillRects) + sizeof(EmfPlusRect) * record->Count)
2579  return InvalidParameter;
2580  }
2581  else
2582  {
2583  if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(EmfPlusFillRects) + sizeof(GpRectF) * record->Count)
2584  return InvalidParameter;
2585  }
2586 
2587  if (flags & 0x8000)
2588  {
2589  stat = GdipCreateSolidFill(record->BrushID, (GpSolidFill **)&temp_brush);
2590  brush = temp_brush;
2591  }
2592  else
2593  {
2594  if (record->BrushID >= EmfPlusObjectTableSize ||
2595  real_metafile->objtable[record->BrushID].type != ObjectTypeBrush)
2596  return InvalidParameter;
2597 
2598  brush = real_metafile->objtable[record->BrushID].u.brush;
2599  stat = Ok;
2600  }
2601 
2602  if (stat == Ok)
2603  {
2604  if (flags & 0x4000)
2605  {
2606  EmfPlusRect *int_rects = (EmfPlusRect*)(record+1);
2607  int i;
2608 
2609  rects = temp_rects = heap_alloc_zero(sizeof(GpRectF) * record->Count);
2610  if (rects)
2611  {
2612  for (i=0; i<record->Count; i++)
2613  {
2614  rects[i].X = int_rects[i].X;
2615  rects[i].Y = int_rects[i].Y;
2616  rects[i].Width = int_rects[i].Width;
2617  rects[i].Height = int_rects[i].Height;
2618  }
2619  }
2620  else
2621  stat = OutOfMemory;
2622  }
2623  else
2624  rects = (GpRectF*)(record+1);
2625  }
2626 
2627  if (stat == Ok)
2628  {
2629  stat = GdipFillRectangles(metafile->playback_graphics, brush, rects, record->Count);
2630  }
2631 
2632  GdipDeleteBrush(temp_brush);
2633  heap_free(temp_rects);
2634 
2635  return stat;
2636  }
2638  {
2640  CombineMode mode = (CombineMode)((flags >> 8) & 0xf);
2641  GpRegion *region;
2642 
2643  if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(*record))
2644  return InvalidParameter;
2645 
2646  stat = GdipCreateRegionRect(&record->ClipRect, &region);
2647 
2648  if (stat == Ok)
2649  {
2650  stat = metafile_set_clip_region(real_metafile, region, mode);
2651  GdipDeleteRegion(region);
2652  }
2653 
2654  return stat;
2655  }
2657  {
2658  CombineMode mode = (flags >> 8) & 0xf;
2659  BYTE regionid = flags & 0xff;
2660  GpRegion *region;
2661 
2662  if (dataSize != 0)
2663  return InvalidParameter;
2664 
2665  if (regionid >= EmfPlusObjectTableSize || real_metafile->objtable[regionid].type != ObjectTypeRegion)
2666  return InvalidParameter;
2667 
2668  stat = GdipCloneRegion(real_metafile->objtable[regionid].u.region, &region);
2669  if (stat == Ok)
2670  {
2671  stat = metafile_set_clip_region(real_metafile, region, mode);
2672  GdipDeleteRegion(region);
2673  }
2674 
2675  return stat;
2676  }
2678  {
2679  CombineMode mode = (flags >> 8) & 0xf;
2680  BYTE pathid = flags & 0xff;
2681  GpRegion *region;
2682 
2683  if (dataSize != 0)
2684  return InvalidParameter;
2685 
2686  if (pathid >= EmfPlusObjectTableSize || real_metafile->objtable[pathid].type != ObjectTypePath)
2687  return InvalidParameter;
2688 
2689  stat = GdipCreateRegionPath(real_metafile->objtable[pathid].u.path, &region);
2690  if (stat == Ok)
2691  {
2692  stat = metafile_set_clip_region(real_metafile, region, mode);
2693  GdipDeleteRegion(region);
2694  }
2695 
2696  return stat;
2697  }
2699  {
2701  GpUnit unit = (GpUnit)flags;
2702 
2703  if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(EmfPlusSetPageTransform))
2704  return InvalidParameter;
2705 
2706  real_metafile->page_unit = unit;
2707  real_metafile->page_scale = record->PageScale;
2708 
2709  return METAFILE_PlaybackUpdateWorldTransform(real_metafile);
2710  }
2712  {
2714 
2715  if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(EmfPlusSetWorldTransform))
2716  return InvalidParameter;
2717 
2718  memcpy(real_metafile->world_transform->matrix, record->MatrixData, sizeof(record->MatrixData));
2719 
2720  return METAFILE_PlaybackUpdateWorldTransform(real_metafile);
2721  }
2723  {
2726 
2728  return InvalidParameter;
2729 
2730  GdipScaleMatrix(real_metafile->world_transform, record->Sx, record->Sy, order);
2731 
2732  return METAFILE_PlaybackUpdateWorldTransform(real_metafile);
2733  }
2735  {
2738  GpMatrix matrix;
2739 
2741  return InvalidParameter;
2742 
2743  memcpy(matrix.matrix, record->MatrixData, sizeof(matrix.matrix));
2744 
2745  GdipMultiplyMatrix(real_metafile->world_transform, &matrix, order);
2746 
2747  return METAFILE_PlaybackUpdateWorldTransform(real_metafile);
2748  }
2750  {
2753 
2755  return InvalidParameter;
2756 
2757  GdipRotateMatrix(real_metafile->world_transform, record->Angle, order);
2758 
2759  return METAFILE_PlaybackUpdateWorldTransform(real_metafile);
2760  }
2762  {
2765 
2767  return InvalidParameter;
2768 
2769  GdipTranslateMatrix(real_metafile->world_transform, record->dx, record->dy, order);
2770 
2771  return METAFILE_PlaybackUpdateWorldTransform(real_metafile);
2772  }
2774  {
2775  GdipSetMatrixElements(real_metafile->world_transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
2776 
2777  return METAFILE_PlaybackUpdateWorldTransform(real_metafile);
2778  }
2780  {
2782  container* cont;
2783  GpUnit unit;
2784  REAL scale_x, scale_y;
2785  GpRectF scaled_srcrect;
2787 
2788  cont = heap_alloc_zero(sizeof(*cont));
2789  if (!cont)
2790  return OutOfMemory;
2791 
2792  stat = GdipCloneRegion(metafile->clip, &cont->clip);
2793  if (stat != Ok)
2794  {
2795  heap_free(cont);
2796  return stat;
2797  }
2798 
2799  stat = GdipBeginContainer2(metafile->playback_graphics, &cont->state);
2800 
2801  if (stat != Ok)
2802  {
2803  GdipDeleteRegion(cont->clip);
2804  heap_free(cont);
2805  return stat;
2806  }
2807 
2808  cont->id = record->StackIndex;
2809  cont->type = BEGIN_CONTAINER;
2810  cont->world_transform = *metafile->world_transform;
2811  cont->page_unit = metafile->page_unit;
2812  cont->page_scale = metafile->page_scale;
2813  list_add_head(&real_metafile->containers, &cont->entry);
2814 
2815  unit = record->Header.Flags & 0xff;
2816 
2817  scale_x = units_to_pixels(1.0, unit, metafile->image.xres);
2818  scale_y = units_to_pixels(1.0, unit, metafile->image.yres);
2819 
2820  scaled_srcrect.X = scale_x * record->SrcRect.X;
2821  scaled_srcrect.Y = scale_y * record->SrcRect.Y;
2822  scaled_srcrect.Width = scale_x * record->SrcRect.Width;
2823  scaled_srcrect.Height = scale_y * record->SrcRect.Height;
2824 
2825  transform.matrix[0] = record->DestRect.Width / scaled_srcrect.Width;
2826  transform.matrix[1] = 0.0;
2827  transform.matrix[2] = 0.0;
2828  transform.matrix[3] = record->DestRect.Height / scaled_srcrect.Height;
2829  transform.matrix[4] = record->DestRect.X - scaled_srcrect.X;
2830  transform.matrix[5] = record->DestRect.Y - scaled_srcrect.Y;
2831 
2833 
2834  return METAFILE_PlaybackUpdateWorldTransform(real_metafile);
2835  }
2837  case EmfPlusRecordTypeSave:
2838  {
2840  container* cont;
2841 
2842  cont = heap_alloc_zero(sizeof(*cont));
2843  if (!cont)
2844  return OutOfMemory;
2845 
2846  stat = GdipCloneRegion(metafile->clip, &cont->clip);
2847  if (stat != Ok)
2848  {
2849  heap_free(cont);
2850  return stat;
2851  }
2852 
2853  if (recordType == EmfPlusRecordTypeBeginContainerNoParams)
2854  stat = GdipBeginContainer2(metafile->playback_graphics, &cont->state);
2855  else
2856  stat = GdipSaveGraphics(metafile->playback_graphics, &cont->state);
2857 
2858  if (stat != Ok)
2859  {
2860  GdipDeleteRegion(cont->clip);
2861  heap_free(cont);
2862  return stat;
2863  }
2864 
2865  cont->id = record->StackIndex;
2866  if (recordType == EmfPlusRecordTypeBeginContainerNoParams)
2867  cont->type = BEGIN_CONTAINER;
2868  else
2869  cont->type = SAVE_GRAPHICS;
2870  cont->world_transform = *metafile->world_transform;
2871  cont->page_unit = metafile->page_unit;
2872  cont->page_scale = metafile->page_scale;
2873  list_add_head(&real_metafile->containers, &cont->entry);
2874 
2875  break;
2876  }
2879  {
2881  container* cont;
2882  enum container_type type;
2883  BOOL found=FALSE;
2884 
2885  if (recordType == EmfPlusRecordTypeEndContainer)
2887  else
2888  type = SAVE_GRAPHICS;
2889 
2890  LIST_FOR_EACH_ENTRY(cont, &real_metafile->containers, container, entry)
2891  {
2892  if (cont->id == record->StackIndex && cont->type == type)
2893  {
2894  found = TRUE;
2895  break;
2896  }
2897  }
2898 
2899  if (found)
2900  {
2901  container* cont2;
2902 
2903  /* pop any newer items on the stack */
2904  while ((cont2 = LIST_ENTRY(list_head(&real_metafile->containers), container, entry)) != cont)
2905  {
2906  list_remove(&cont2->entry);
2907  GdipDeleteRegion(cont2->clip);
2908  heap_free(cont2);
2909  }
2910 
2911  if (type == BEGIN_CONTAINER)
2912  GdipEndContainer(real_metafile->playback_graphics, cont->state);
2913  else
2914  GdipRestoreGraphics(real_metafile->playback_graphics, cont->state);
2915 
2916  *real_metafile->world_transform = cont->world_transform;
2917  real_metafile->page_unit = cont->page_unit;
2918  real_metafile->page_scale = cont->page_scale;
2919  GdipCombineRegionRegion(real_metafile->clip, cont->clip, CombineModeReplace);
2920 
2921  list_remove(&cont->entry);
2922  GdipDeleteRegion(cont->clip);
2923  heap_free(cont);
2924  }
2925 
2926  break;
2927  }
2929  {
2930  return GdipSetPixelOffsetMode(real_metafile->playback_graphics, flags & 0xff);
2931  }
2933  {
2934  return GdipSetCompositingQuality(real_metafile->playback_graphics, flags & 0xff);
2935  }
2937  {
2938  return GdipSetInterpolationMode(real_metafile->playback_graphics, flags & 0xff);
2939  }
2941  {
2942  return GdipSetTextRenderingHint(real_metafile->playback_graphics, flags & 0xff);
2943  }
2945  {
2946  return GdipSetSmoothingMode(real_metafile->playback_graphics, (flags >> 1) & 0xff);
2947  }
2949  {
2950  return GdipSetCompositingMode(real_metafile->playback_graphics, flags & 0xff);
2951  }
2953  {
2954  return METAFILE_PlaybackObject(real_metafile, flags, dataSize, data);
2955  }
2957  {
2959  BYTE image = flags & 0xff;
2960  GpPointF points[3];
2961 
2962  if (image >= EmfPlusObjectTableSize || real_metafile->objtable[image].type != ObjectTypeImage)
2963  return InvalidParameter;
2964 
2965  if (dataSize != FIELD_OFFSET(EmfPlusDrawImage, RectData) - sizeof(EmfPlusRecordHeader) +
2966  (flags & 0x4000 ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)))
2967  return InvalidParameter;
2968 
2970  real_metafile->objtable[draw->ImageAttributesID].type != ObjectTypeImageAttributes)
2971  return InvalidParameter;
2972 
2973  if (flags & 0x4000) /* C */
2974  {
2975  points[0].X = draw->RectData.rect.X;
2976  points[0].Y = draw->RectData.rect.Y;
2977  points[1].X = points[0].X + draw->RectData.rect.Width;
2978  points[1].Y = points[0].Y;
2979  points[2].X = points[1].X;
2980  points[2].Y = points[1].Y + draw->RectData.rect.Height;
2981  }
2982  else
2983  {
2984  points[0].X = draw->RectData.rectF.X;
2985  points[0].Y = draw->RectData.rectF.Y;
2986  points[1].X = points[0].X + draw->RectData.rectF.Width;
2987  points[1].Y = points[0].Y;
2988  points[2].X = points[1].X;
2989  points[2].Y = points[1].Y + draw->RectData.rectF.Height;
2990  }
2991 
2992  return GdipDrawImagePointsRect(real_metafile->playback_graphics, real_metafile->objtable[image].u.image,
2993  points, 3, draw->SrcRect.X, draw->SrcRect.Y, draw->SrcRect.Width, draw->SrcRect.Height, draw->SrcUnit,
2994  real_metafile->objtable[draw->ImageAttributesID].u.image_attributes, NULL, NULL);
2995  }
2997  {
2999  static const UINT fixed_part_size = FIELD_OFFSET(EmfPlusDrawImagePoints, PointData) -
3000  FIELD_OFFSET(EmfPlusDrawImagePoints, ImageAttributesID);
3001  BYTE image = flags & 0xff;
3002  GpPointF points[3];
3003  unsigned int i;
3004  UINT size;
3005 
3006  if (image >= EmfPlusObjectTableSize || real_metafile->objtable[image].type != ObjectTypeImage)
3007  return InvalidParameter;
3008 
3009  if (dataSize <= fixed_part_size)
3010  return InvalidParameter;
3011  dataSize -= fixed_part_size;
3012 
3014  real_metafile->objtable[draw->ImageAttributesID].type != ObjectTypeImageAttributes)
3015  return InvalidParameter;
3016 
3017  if (draw->count != 3)
3018  return InvalidParameter;
3019 
3020  if ((flags >> 13) & 1) /* E */
3021  FIXME("image effects are not supported.\n");
3022 
3023  if ((flags >> 11) & 1) /* P */
3024  size = sizeof(EmfPlusPointR7) * draw->count;
3025  else if ((flags >> 14) & 1) /* C */
3026  size = sizeof(EmfPlusPoint) * draw->count;
3027  else
3028  size = sizeof(EmfPlusPointF) * draw->count;
3029 
3030  if (dataSize != size)
3031  return InvalidParameter;
3032 
3033  if ((flags >> 11) & 1) /* P */
3034  {
3035  points[0].X = draw->PointData.pointsR[0].X;
3036  points[0].Y = draw->PointData.pointsR[0].Y;
3037  for (i = 1; i < 3; i++)
3038  {
3039  points[i].X = points[i-1].X + draw->PointData.pointsR[i].X;
3040  points[i].Y = points[i-1].Y + draw->PointData.pointsR[i].Y;
3041  }
3042  }
3043  else if ((flags >> 14) & 1) /* C */
3044  {
3045  for (i = 0; i < 3; i++)
3046  {
3047  points[i].X = draw->PointData.points[i].X;
3048  points[i].Y = draw->PointData.points[i].Y;
3049  }
3050  }
3051  else
3052  memcpy(points, draw->PointData.pointsF, sizeof(points));
3053 
3054  return GdipDrawImagePointsRect(real_metafile->playback_graphics, real_metafile->objtable[image].u.image,
3055  points, 3, draw->SrcRect.X, draw->SrcRect.Y, draw->SrcRect.Width, draw->SrcRect.Height, draw->SrcUnit,
3056  real_metafile->objtable[draw->ImageAttributesID].u.image_attributes, NULL, NULL);
3057  }
3059  {
3061  GpSolidFill *solidfill = NULL;
3062  BYTE path = flags & 0xff;
3063  GpBrush *brush;
3064 
3065  if (path >= EmfPlusObjectTableSize || real_metafile->objtable[path].type != ObjectTypePath)
3066  return InvalidParameter;
3067 
3068  if (dataSize != sizeof(fill->data.BrushId))
3069  return InvalidParameter;
3070 
3071  if (flags & 0x8000)
3072  {
3073  stat = GdipCreateSolidFill(fill->data.Color, (GpSolidFill **)&solidfill);
3074  if (stat != Ok)
3075  return stat;
3076  brush = (GpBrush *)solidfill;
3077  }
3078  else
3079  {
3080  if (fill->data.BrushId >= EmfPlusObjectTableSize ||
3081  real_metafile->objtable[fill->data.BrushId].type != ObjectTypeBrush)
3082  return InvalidParameter;
3083 
3084  brush = real_metafile->objtable[fill->data.BrushId].u.brush;
3085  }
3086 
3087  stat = GdipFillPath(real_metafile->playback_graphics, brush, real_metafile->objtable[path].u.path);
3088  GdipDeleteBrush((GpBrush *)solidfill);
3089  return stat;
3090  }
3092  {
3093  static const UINT fixed_part_size = FIELD_OFFSET(EmfPlusFillClosedCurve, PointData) -
3094  sizeof(EmfPlusRecordHeader);
3096  GpSolidFill *solidfill = NULL;
3097  GpFillMode mode;
3098  GpBrush *brush;
3099  UINT size, i;
3100 
3101  if (dataSize <= fixed_part_size)
3102  return InvalidParameter;
3103 
3104  if (fill->Count == 0)
3105  return InvalidParameter;
3106 
3107  if (flags & 0x800) /* P */
3108  size = (fixed_part_size + sizeof(EmfPlusPointR7) * fill->Count + 3) & ~3;
3109  else if (flags & 0x4000) /* C */
3110  size = fixed_part_size + sizeof(EmfPlusPoint) * fill->Count;
3111  else
3112  size = fixed_part_size + sizeof(EmfPlusPointF) * fill->Count;
3113 
3114  if (dataSize != size)
3115  return InvalidParameter;
3116 
3117  mode = flags & 0x200 ? FillModeWinding : FillModeAlternate; /* W */
3118 
3119  if (flags & 0x8000) /* S */
3120  {
3121  stat = GdipCreateSolidFill(fill->BrushId, (GpSolidFill **)&solidfill);
3122  if (stat != Ok)
3123  return stat;
3124  brush = (GpBrush *)solidfill;
3125  }
3126  else
3127  {
3128  if (fill->BrushId >= EmfPlusObjectTableSize ||
3129  real_metafile->objtable[fill->BrushId].type != ObjectTypeBrush)
3130  return InvalidParameter;
3131 
3132  brush = real_metafile->objtable[fill->BrushId].u.brush;
3133  }
3134 
3135  if (flags & (0x800 | 0x4000))
3136  {
3137  GpPointF *points = GdipAlloc(fill->Count * sizeof(*points));
3138  if (points)
3139  {
3140  if (flags & 0x800) /* P */
3141  {
3142  for (i = 1; i < fill->Count; i++)
3143  {
3144  points[i].X = points[i - 1].X + fill->PointData.pointsR[i].X;
3145  points[i].Y = points[i - 1].Y + fill->PointData.pointsR[i].Y;
3146  }
3147  }
3148  else
3149  {
3150  for (i = 0; i < fill->Count; i++)
3151  {
3152  points[i].X = fill->PointData.points[i].X;
3153  points[i].Y = fill->PointData.points[i].Y;
3154  }
3155  }
3156 
3157  stat = GdipFillClosedCurve2(real_metafile->playback_graphics, brush,
3158  points, fill->Count, fill->Tension, mode);
3159  GdipFree(points);
3160  }
3161  else
3162  stat = OutOfMemory;
3163  }
3164  else
3165  stat = GdipFillClosedCurve2(real_metafile->playback_graphics, brush,
3166  (const GpPointF *)fill->PointData.pointsF, fill->Count, fill->Tension, mode);
3167 
3168  GdipDeleteBrush((GpBrush *)solidfill);
3169  return stat;
3170  }
3172  {
3174  GpSolidFill *solidfill = NULL;
3175  GpBrush *brush;
3176 
3177  if (dataSize <= FIELD_OFFSET(EmfPlusFillEllipse, RectData) - sizeof(EmfPlusRecordHeader))
3178  return InvalidParameter;
3180 
3181  if (dataSize != (flags & 0x4000 ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)))
3182  return InvalidParameter;
3183 
3184  if (flags & 0x8000)
3185  {
3186  stat = GdipCreateSolidFill(fill->BrushId, (GpSolidFill **)&solidfill);
3187  if (stat != Ok)
3188  return stat;
3189  brush = (GpBrush *)solidfill;
3190  }
3191  else
3192  {
3193  if (fill->BrushId >= EmfPlusObjectTableSize ||
3194  real_metafile->objtable[fill->BrushId].type != ObjectTypeBrush)
3195  return InvalidParameter;
3196 
3197  brush = real_metafile->objtable[fill->BrushId].u.brush;
3198  }
3199 
3200  if (flags & 0x4000)
3201  stat = GdipFillEllipseI(real_metafile->playback_graphics, brush, fill->RectData.rect.X,
3202  fill->RectData.rect.Y, fill->RectData.rect.Width, fill->RectData.rect.Height);
3203  else
3204  stat = GdipFillEllipse(real_metafile->playback_graphics, brush, fill->RectData.rectF.X,
3205  fill->RectData.rectF.Y, fill->RectData.rectF.Width, fill->RectData.rectF.Height);
3206 
3207  GdipDeleteBrush((GpBrush *)solidfill);
3208  return stat;
3209  }
3211  {
3213  GpSolidFill *solidfill = NULL;
3214  GpBrush *brush;
3215 
3216  if (dataSize <= FIELD_OFFSET(EmfPlusFillPie, RectData) - sizeof(EmfPlusRecordHeader))
3217  return InvalidParameter;
3218  dataSize -= FIELD_OFFSET(EmfPlusFillPie, RectData) - sizeof(EmfPlusRecordHeader);
3219 
3220  if (dataSize != (flags & 0x4000 ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)))
3221  return InvalidParameter;
3222 
3223  if (flags & 0x8000) /* S */
3224  {
3225  stat = GdipCreateSolidFill(fill->BrushId, (GpSolidFill **)&solidfill);
3226  if (stat != Ok)
3227  return stat;
3228  brush = (GpBrush *)solidfill;
3229  }
3230  else
3231  {
3232  if (fill->BrushId >= EmfPlusObjectTableSize ||
3233  real_metafile->objtable[fill->BrushId].type != ObjectTypeBrush)
3234  return InvalidParameter;
3235 
3236  brush = real_metafile->objtable[fill->BrushId].u.brush;
3237  }
3238 
3239  if (flags & 0x4000) /* C */
3240  stat = GdipFillPieI(real_metafile->playback_graphics, brush, fill->RectData.rect.X,
3241  fill->RectData.rect.Y, fill->RectData.rect.Width, fill->RectData.rect.Height,
3242  fill->StartAngle, fill->SweepAngle);
3243  else
3244  stat = GdipFillPie(real_metafile->playback_graphics, brush, fill->RectData.rectF.X,
3245  fill->RectData.rectF.Y, fill->RectData.rectF.Width, fill->RectData.rectF.Height,
3246  fill->StartAngle, fill->SweepAngle);
3247 
3248  GdipDeleteBrush((GpBrush *)solidfill);
3249  return stat;
3250  }
3252  {
3254  BYTE path = flags & 0xff;
3255 
3256  if (dataSize != sizeof(draw->PenId))
3257  return InvalidParameter;
3258 
3260  return InvalidParameter;
3261 
3262  if (real_metafile->objtable[path].type != ObjectTypePath ||
3263  real_metafile->objtable[draw->PenId].type != ObjectTypePen)
3264  return InvalidParameter;
3265 
3266  return GdipDrawPath(real_metafile->playback_graphics, real_metafile->objtable[draw->PenId].u.pen,
3267  real_metafile->objtable[path].u.path);
3268  }
3270  {
3272  BYTE pen = flags & 0xff;
3273 
3274  if (pen >= EmfPlusObjectTableSize || real_metafile->objtable[pen].type != ObjectTypePen)
3275  return InvalidParameter;
3276 
3277  if (dataSize != FIELD_OFFSET(EmfPlusDrawArc, RectData) - sizeof(EmfPlusRecordHeader) +
3278  (flags & 0x4000 ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)))
3279  return InvalidParameter;
3280 
3281  if (flags & 0x4000) /* C */
3282  return GdipDrawArcI(real_metafile->playback_graphics, real_metafile->objtable[pen].u.pen,
3283  draw->RectData.rect.X, draw->RectData.rect.Y, draw->RectData.rect.Width,
3284  draw->RectData.rect.Height, draw->StartAngle, draw->SweepAngle);
3285  else
3286  return GdipDrawArc(real_metafile->playback_graphics, real_metafile->objtable[pen].u.pen,
3287  draw->RectData.rectF.X, draw->RectData.rectF.Y, draw->RectData.rectF.Width,
3288  draw->RectData.rectF.Height, draw->StartAngle, draw->SweepAngle);
3289  }
3291  {
3293  BYTE pen = flags & 0xff;
3294 
3295  if (pen >= EmfPlusObjectTableSize || real_metafile->objtable[pen].type != ObjectTypePen)
3296  return InvalidParameter;
3297 
3298  if (dataSize != (flags & 0x4000 ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)))
3299  return InvalidParameter;
3300 
3301  if (flags & 0x4000) /* C */
3302  return GdipDrawEllipseI(real_metafile->playback_graphics, real_metafile->objtable[pen].u.pen,
3303  draw->RectData.rect.X, draw->RectData.rect.Y, draw->RectData.rect.Width,
3304  draw->RectData.rect.Height);
3305  else
3306  return GdipDrawEllipse(real_metafile->playback_graphics, real_metafile->objtable[pen].u.pen,
3307  draw->RectData.rectF.X, draw->RectData.rectF.Y, draw->RectData.rectF.Width,
3308  draw->RectData.rectF.Height);
3309  }
3311  {
3313  BYTE pen = flags & 0xff;
3314 
3315  if (pen >= EmfPlusObjectTableSize || real_metafile->objtable[pen].type != ObjectTypePen)
3316  return InvalidParameter;
3317 
3318  if (dataSize != FIELD_OFFSET(EmfPlusDrawPie, RectData) - sizeof(EmfPlusRecordHeader) +
3319  (flags & 0x4000 ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)))
3320  return InvalidParameter;
3321 
3322  if (flags & 0x4000) /* C */
3323  return GdipDrawPieI(real_metafile->playback_graphics, real_metafile->objtable[pen].u.pen,
3324  draw->RectData.rect.X, draw->RectData.rect.Y, draw->RectData.rect.Width,
3325  draw->RectData.rect.Height, draw->StartAngle, draw->SweepAngle);
3326  else
3327  return GdipDrawPie(real_metafile->playback_graphics, real_metafile->objtable[pen].u.pen,
3328  draw->RectData.rectF.X, draw->RectData.rectF.Y, draw->RectData.rectF.Width,
3329  draw->RectData.rectF.Height, draw->StartAngle, draw->SweepAngle);
3330  }
3332  {
3334  BYTE pen = flags & 0xff;
3335  GpRectF *rects = NULL;
3336 
3337  if (pen >= EmfPlusObjectTableSize || real_metafile->objtable[pen].type != ObjectTypePen)
3338  return InvalidParameter;
3339 
3340  if (dataSize <= FIELD_OFFSET(EmfPlusDrawRects, RectData) - sizeof(EmfPlusRecordHeader))
3341  return InvalidParameter;
3343 
3344  if (dataSize != draw->Count * (flags & 0x4000 ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)))
3345  return InvalidParameter;
3346 
3347  if (flags & 0x4000)
3348  {
3349  DWORD i;
3350 
3351  rects = GdipAlloc(draw->Count * sizeof(*rects));
3352  if (!rects)
3353  return OutOfMemory;
3354 
3355  for (i = 0; i < draw->Count; i++)
3356  {
3357  rects[i].X = draw->RectData.rect[i].X;
3358  rects[i].Y = draw->RectData.rect[i].Y;
3359  rects[i].Width = draw->RectData.rect[i].Width;
3360  rects[i].Height = draw->RectData.rect[i].Height;
3361  }
3362  }
3363 
3364  stat = GdipDrawRectangles(real_metafile->playback_graphics, real_metafile->objtable[pen].u.pen,
3365  rects ? rects : (GpRectF *)draw->RectData.rectF, draw->Count);
3366  GdipFree(rects);
3367  return stat;
3368  }
3369  default:
3370  FIXME("Not implemented for record type %x\n", recordType);
3371  return NotImplemented;
3372  }
3373  }
3374 
3375  return Ok;
3376 }
struct EmfPlusPoint EmfPlusPoint
GraphicsContainer state
Definition: metafile.c:157
SHORT X
Definition: metafile.c:94
GpStatus WINGDIPAPI GdipSetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode mode)
Definition: graphics.c:6229
union EmfPlusDrawImage::@398 RectData
#define EMR_SETMAPMODE
Definition: wingdi.h:91
GpStatus WINGDIPAPI GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Definition: matrix.c:316
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GpStatus WINGDIPAPI GdipDrawEllipse(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height)
Definition: graphics.c:2935
#define TRUE
Definition: types.h:120
static GpStatus METAFILE_PlaybackUpdateGdiTransform(GpMetafile *metafile)
Definition: metafile.c:1642
GpStatus WINGDIPAPI GdipFillEllipse(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height)
Definition: graphics.c:4290
GpStatus WINGDIPAPI GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *path)
Definition: graphics.c:4391
DWORD ImageAttributesID
Definition: metafile.c:417
struct list entry
Definition: metafile.c:154
Unit
Definition: gdiplusenums.h:25
enum container_type type
Definition: metafile.c:156
GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *points, INT count, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, VOID *callbackData)
Definition: graphics.c:3071
EmfPlusRectF rectF
Definition: metafile.c:423
float Height
Definition: metafile.c:264
GLuint GLenum matrix
Definition: glext.h:9407
static GpStatus METAFILE_PlaybackGetDC(GpMetafile *metafile)
Definition: metafile.c:1656
GpStatus WINGDIPAPI GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path)
Definition: graphics.c:4066
static void METAFILE_PlaybackReleaseDC(GpMetafile *metafile)
Definition: metafile.c:1673
GpUnit page_unit
GpStatus WINGDIPAPI GdipDrawRectangles(GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, INT count)
Definition: graphics.c:4159
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
void WINGDIPAPI GdipFree(void *ptr)
Definition: gdiplus.c:150
SHORT Width
Definition: metafile.c:96
GpStatus WINGDIPAPI GdipFillClosedCurve2(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count, REAL tension, GpFillMode fill)
Definition: graphics.c:4213
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
EmfPlusRect rect
Definition: metafile.c:477
static GpStatus METAFILE_PlaybackObject(GpMetafile *metafile, UINT flags, UINT data_size, const BYTE *record_data)
Definition: metafile.c:2249
struct EmfPlusScaleWorldTransform EmfPlusScaleWorldTransform
float Width
Definition: metafile.c:263
struct EmfPlusPointF EmfPlusPointF
EmfPlusRect rect[1]
Definition: metafile.c:488
static void METAFILE_GetFinalGdiTransform(const GpMetafile *metafile, XFORM *result)
Definition: metafile.c:1626
GpStatus WINGDIPAPI GdipFillEllipseI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height)
Definition: graphics.c:4319
static const unsigned char metafile[]
Definition: olepicture.c:138
GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone)
Definition: region.c:211
#define EMR_SETVIEWPORTORGEX
Definition: wingdi.h:86
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
struct emfplus_object objtable[EmfPlusObjectTableSize]
FillMode
Definition: gdiplusenums.h:53
static GpStatus metafile_set_clip_region(GpMetafile *metafile, GpRegion *region, CombineMode mode)
Definition: metafile.c:2449
SHORT Y
Definition: metafile.c:95
struct EmfPlusSetWorldTransform EmfPlusSetWorldTransform
container_type
Definition: metafile.c:146
CombineMode
Definition: gdiplusenums.h:347
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
float StartAngle
Definition: metafile.c:473
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GpStatus WINGDIPAPI GdipSetSmoothingMode(GpGraphics *graphics, SmoothingMode mode)
Definition: graphics.c:6289
unsigned int BOOL
Definition: ntddk_ex.h:94
EmfPlusRectF SrcRect
Definition: metafile.c:419
GpStatus WINGDIPAPI GdipSetCompositingMode(GpGraphics *graphics, CompositingMode mode)
Definition: graphics.c:6085
#define EMR_RESTOREDC
Definition: wingdi.h:108
#define FIXME(fmt,...)
Definition: debug.h:110
float SweepAngle
Definition: metafile.c:452
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
BOOL WINAPI PlayEnhMetaFileRecord(_In_ HDC hdc, _In_reads_(cht) LPHANDLETABLE pht, _In_ CONST ENHMETARECORD *pmr, _In_ UINT cht)
REAL page_scale
Definition: metafile.c:160
smooth NULL
Definition: ftsmooth.c:416
EmfPlusRectF rectF
Definition: metafile.c:478
union EmfPlusDrawPie::@402 RectData
Unit GpUnit
EmfPlusRectF SrcRect
Definition: metafile.c:432
union EmfPlusDrawArc::@400 RectData
GpGraphics * playback_graphics
EmfPlusPoint points[3]
Definition: metafile.c:437
REAL Height
Definition: gdiplustypes.h:264
EmfPlusPointR7 pointsR[3]
Definition: metafile.c:436
MatrixOrder
Definition: gdiplusenums.h:185
XFORM gdiworldtransform
GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
Definition: brush.c:994
#define EMR_MODIFYWORLDTRANSFORM
Definition: wingdi.h:110
struct EmfPlusTranslateWorldTransform EmfPlusTranslateWorldTransform
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
DWORD id
Definition: metafile.c:155
EmfPlusRectF rectF[1]
Definition: metafile.c:489
#define TRACE(s)
Definition: solgame.cpp:4
struct EmfPlusRecordHeader EmfPlusRecordHeader
GpStatus WINGDIPAPI GdipEndContainer(GpGraphics *graphics, GraphicsContainer state)
Definition: graphics.c:6039
GLsizeiptr size
Definition: glext.h:5919
#define EmfPlusObjectTableSize
GpStatus WINGDIPAPI GdipFillPieI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle)
Definition: graphics.c:4454
EmfPlusPointF pointsF[3]
Definition: metafile.c:438
if(!(yy_init))
Definition: macro.lex.yy.c:714
GpStatus WINGDIPAPI GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode mode)
Definition: graphics.c:6143
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algobase.h:449
REAL X
Definition: gdiplustypes.h:261
GpStatus WINGDIPAPI GdipBeginContainer2(GpGraphics *graphics, GraphicsContainer *state)
Definition: graphics.c:5917
GpStatus WINGDIPAPI GdipRestoreGraphics(GpGraphics *graphics, GraphicsState state)
Definition: graphics.c:6045
float StartAngle
Definition: metafile.c:451
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EMR_SCALEWINDOWEXTEX
Definition: wingdi.h:106
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Definition: matrix.c:258
GpStatus WINGDIPAPI GdipSetTextRenderingHint(GpGraphics *graphics, TextRenderingHint hint)
Definition: graphics.c:6330
GpStatus WINGDIPAPI GdipSetCompositingQuality(GpGraphics *graphics, CompositingQuality quality)
Definition: graphics.c:6114
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
REAL matrix[6]
GLsizei const GLfloat * points
Definition: glext.h:8112
static GpStatus METAFILE_PlaybackUpdateWorldTransform(GpMetafile *metafile)
Definition: metafile.c:1691
GpStatus WINGDIPAPI GdipDrawPieI(GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle)
Definition: graphics.c:4117
static HRGN hrgn
Definition: win.c:55
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:289
Definition: stat.h:55
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
GpRegion * clip
EmfPlusRect rect
Definition: metafile.c:455
GpStatus WINGDIPAPI GdipDrawArcI(GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle)
Definition: graphics.c:2645
union EmfPlusDrawImagePoints::@399 PointData
GLenum mode
Definition: glext.h:6217
EmfPlusRect rect
Definition: metafile.c:422
#define EMR_SCALEVIEWPORTEXTEX
Definition: wingdi.h:105
#define EMR_SETWINDOWEXTEX
Definition: wingdi.h:83
Status
Definition: gdiplustypes.h:24
REAL Width
Definition: gdiplustypes.h:263
struct EmfPlusMultiplyWorldTransform EmfPlusMultiplyWorldTransform
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Definition: matrix.c:418
#define ERR(fmt,...)
Definition: debug.h:109
struct EmfPlusFillRects EmfPlusFillRects
HRGN WINAPI ExtCreateRegion(_In_opt_ const XFORM *lpx, _In_ DWORD nCount, _In_reads_bytes_(nCount) const RGNDATA *lpData)
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
GpStatus WINGDIPAPI GdipDrawEllipseI(GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height)
Definition: graphics.c:2960
float SweepAngle
Definition: metafile.c:474
GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics *graphics, ARGB color)
Definition: graphics.c:5076
GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region)
Definition: region.c:425
struct EmfPlusSetPageTransform EmfPlusSetPageTransform
Definition: services.c:325
GpStatus WINGDIPAPI GdipSaveGraphics(GpGraphics *graphics, GraphicsState *state)
Definition: graphics.c:5911
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
GpMatrix * world_transform
unsigned int UINT
Definition: ndis.h:50
GpStatus WINGDIPAPI GdipDrawArc(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
Definition: graphics.c:2619
GpStatus WINGDIPAPI GdipFillRectangles(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, INT count)
Definition: graphics.c:4567
GpRegion * clip
Definition: metafile.c:161
GLenum GLsizei dataSize
Definition: glext.h:11123
struct list containers
EmfPlusRect rect
Definition: metafile.c:465
GpStatus WINGDIPAPI GdipDrawPie(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
Definition: graphics.c:4091
GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1, GpRegion *region2, CombineMode mode)
Definition: region.c:346
EmfPlusRectF rectF
Definition: metafile.c:456
EmfPlusRectF rectF
Definition: metafile.c:466
#define EMR_SETWORLDTRANSFORM
Definition: wingdi.h:109
GLuint GLenum GLenum transform
Definition: glext.h:9407
#define EMR_SETVIEWPORTEXTEX
Definition: wingdi.h:85
void *WINGDIPAPI GdipAlloc(SIZE_T size)
Definition: gdiplus.c:142
REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi)
Definition: gdiplus.c:327
union EmfPlusDrawEllipse::@401 RectData
#define EMR_SETWINDOWORGEX
Definition: wingdi.h:84
GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
Definition: brush.c:757
float REAL
Definition: types.h:41
#define LIST_ENTRY(type)
Definition: queue.h:175
SHORT Height
Definition: metafile.c:97
REAL Y
Definition: gdiplustypes.h:262
GpStatus WINGDIPAPI GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
Definition: graphics.c:4424
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
Definition: region.c:571
GpUnit page_unit
Definition: metafile.c:159
#define EMR_EXTSELECTCLIPRGN
Definition: wingdi.h:148
struct CFHEADER header
Definition: fdi.c:109
struct EmfPlusRectF EmfPlusRectF
#define EMR_SAVEDC
Definition: wingdi.h:107
struct EmfPlusPointR7 EmfPlusPointR7
struct EmfPlusRotateWorldTransform EmfPlusRotateWorldTransform
GpStatus WINGDIPAPI GdipCreateRegionRect(GDIPCONST GpRectF *rect, GpRegion **region)
Definition: region.c:459
GpMatrix world_transform
Definition: metafile.c:158
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
union EmfPlusDrawRects::@403 RectData
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, GpMatrixOrder order)
Definition: matrix.c:240

Referenced by play_metafile_proc(), and test_gditransform_cb().

◆ GdipRecordMetafile()

GpStatus WINGDIPAPI GdipRecordMetafile ( HDC  hdc,
EmfType  type,
GDIPCONST GpRectF frameRect,
MetafileFrameUnit  frameUnit,
GDIPCONST WCHAR desc,
GpMetafile **  metafile 
)

Definition at line 735 of file metafile.c.

737 {
738  HDC record_dc;
739  REAL dpix, dpiy;
740  REAL framerect_factor_x, framerect_factor_y;
741  RECT rc, *lprc;
742  GpStatus stat;
743 
744  TRACE("(%p %d %p %d %p %p)\n", hdc, type, frameRect, frameUnit, desc, metafile);
745 
747  return InvalidParameter;
748 
749  dpix = (REAL)GetDeviceCaps(hdc, HORZRES) / GetDeviceCaps(hdc, HORZSIZE) * 25.4;
750  dpiy = (REAL)GetDeviceCaps(hdc, VERTRES) / GetDeviceCaps(hdc, VERTSIZE) * 25.4;
751 
752  if (frameRect)
753  {
754  switch (frameUnit)
755  {
757  framerect_factor_x = 2540.0 / dpix;
758  framerect_factor_y = 2540.0 / dpiy;
759  break;
761  framerect_factor_x = framerect_factor_y = 2540.0 / 72.0;
762  break;
764  framerect_factor_x = framerect_factor_y = 2540.0;
765  break;
767  framerect_factor_x = framerect_factor_y = 2540.0 / 300.0;
768  break;
770  framerect_factor_x = framerect_factor_y = 100.0;
771  break;
773  framerect_factor_x = framerect_factor_y = 1.0;
774  break;
775  default:
776  return InvalidParameter;
777  }
778 
779  rc.left = framerect_factor_x * frameRect->X;
780  rc.top = framerect_factor_y * frameRect->Y;
781  rc.right = rc.left + framerect_factor_x * frameRect->Width;
782  rc.bottom = rc.top + framerect_factor_y * frameRect->Height;
783 
784  lprc = &rc;
785  }
786  else
787  lprc = NULL;
788 
789  record_dc = CreateEnhMetaFileW(hdc, NULL, lprc, desc);
790 
791  if (!record_dc)
792  return GenericError;
793 
794  *metafile = heap_alloc_zero(sizeof(GpMetafile));
795  if(!*metafile)
796  {
798  return OutOfMemory;
799  }
800 
801  (*metafile)->image.type = ImageTypeMetafile;
802  (*metafile)->image.flags = ImageFlagsNone;
803  (*metafile)->image.palette = NULL;
804  (*metafile)->image.xres = dpix;
805  (*metafile)->image.yres = dpiy;
806  (*metafile)->bounds.X = (*metafile)->bounds.Y = 0.0;
807  (*metafile)->bounds.Width = (*metafile)->bounds.Height = 1.0;
808  (*metafile)->unit = UnitPixel;
809  (*metafile)->metafile_type = type;
810  (*metafile)->record_dc = record_dc;
811  (*metafile)->comment_data = NULL;
812  (*metafile)->comment_data_size = 0;
813  (*metafile)->comment_data_length = 0;
814  (*metafile)->hemf = NULL;
815  list_init(&(*metafile)->containers);
816 
817  if (!frameRect)
818  {
819  (*metafile)->auto_frame = TRUE;
820  (*metafile)->auto_frame_min.X = 0;
821  (*metafile)->auto_frame_min.Y = 0;
822  (*metafile)->auto_frame_max.X = -1;
823  (*metafile)->auto_frame_max.Y = -1;
824  }
825 
827 
828  if (stat != Ok)
829  {
832  *metafile = NULL;
833  return OutOfMemory;
834  }
835 
836  return stat;
837 }
#define HORZRES
Definition: wingdi.h:715
#define TRUE
Definition: types.h:120
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4366
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
HDC WINAPI CreateEnhMetaFileW(_In_opt_ HDC, _In_opt_ LPCWSTR, _In_opt_ LPCRECT, _In_opt_ LPCWSTR)
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
static const unsigned char metafile[]
Definition: olepicture.c:138
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
#define TRACE(s)
Definition: solgame.cpp:4
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
Definition: stat.h:55
Status
Definition: gdiplustypes.h:24
#define HORZSIZE
Definition: wingdi.h:713
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define VERTSIZE
Definition: wingdi.h:714
#define VERTRES
Definition: wingdi.h:716
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
LONG bottom
Definition: windef.h:294
float REAL
Definition: types.h:41
static GpStatus METAFILE_WriteHeader(GpMetafile *metafile, HDC hdc)
Definition: metafile.c:679
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by GdipRecordMetafileI(), GdipRecordMetafileStream(), test_clear(), test_clipping(), test_containers(), test_converttoemfplus(), test_drawimage(), test_drawpath(), test_emfonly(), test_empty(), test_fillpath(), test_fillrect(), test_frameunit(), test_gditransform(), test_getdc(), test_nullframerect(), test_pagetransform(), test_properties(), and test_worldtransform().

◆ GdipRecordMetafileFileName()

GpStatus WINGDIPAPI GdipRecordMetafileFileName ( GDIPCONST WCHAR fileName,
HDC  hdc,
EmfType  type,
GDIPCONST GpRectF pFrameRect,
MetafileFrameUnit  frameUnit,
GDIPCONST WCHAR desc,
GpMetafile **  metafile 
)

Definition at line 3993 of file metafile.c.

3997 {
3998  FIXME("%s %p %d %p %d %s %p stub!\n", debugstr_w(fileName), hdc, type, pFrameRect,
3999  frameUnit, debugstr_w(desc), metafile);
4000 
4001  return NotImplemented;
4002 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static const unsigned char metafile[]
Definition: olepicture.c:138
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
HDC hdc
Definition: main.c:9

◆ GdipRecordMetafileFileNameI()

GpStatus WINGDIPAPI GdipRecordMetafileFileNameI ( GDIPCONST WCHAR fileName,
HDC  hdc,
EmfType  type,
GDIPCONST GpRect pFrameRect,
MetafileFrameUnit  frameUnit,
GDIPCONST WCHAR desc,
GpMetafile **  metafile 
)

Definition at line 4004 of file metafile.c.

4007 {
4008  FIXME("%s %p %d %p %d %s %p stub!\n", debugstr_w(fileName), hdc, type, pFrameRect,
4009  frameUnit, debugstr_w(desc), metafile);
4010 
4011  return NotImplemented;
4012 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static const unsigned char metafile[]
Definition: olepicture.c:138
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
HDC hdc
Definition: main.c:9

◆ GdipRecordMetafileI()

GpStatus WINGDIPAPI GdipRecordMetafileI ( HDC  hdc,
EmfType  type,
GDIPCONST GpRect frameRect,
MetafileFrameUnit  frameUnit,
GDIPCONST WCHAR desc,
GpMetafile **  metafile 
)

Definition at line 842 of file metafile.c.

844 {
845  GpRectF frameRectF, *pFrameRectF;
846 
847  TRACE("(%p %d %p %d %p %p)\n", hdc, type, frameRect, frameUnit, desc, metafile);
848 
849  if (frameRect)
850  {
851  frameRectF.X = frameRect->X;
852  frameRectF.Y = frameRect->Y;
853  frameRectF.Width = frameRect->Width;
854  frameRectF.Height = frameRect->Height;
855  pFrameRectF = &frameRectF;
856  }
857  else
858  pFrameRectF = NULL;
859 
860  return GdipRecordMetafile(hdc, type, pFrameRectF, frameUnit, desc, metafile);
861 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
Definition: metafile.c:735
static const unsigned char metafile[]
Definition: olepicture.c:138
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
REAL Height
Definition: gdiplustypes.h:264
#define TRACE(s)
Definition: solgame.cpp:4
REAL X
Definition: gdiplustypes.h:261
HDC hdc
Definition: main.c:9
REAL Width
Definition: gdiplustypes.h:263
REAL Y
Definition: gdiplustypes.h:262

◆ GdipRecordMetafileStream()

GpStatus WINGDIPAPI GdipRecordMetafileStream ( IStream stream,
HDC  hdc,
EmfType  type,
GDIPCONST GpRectF frameRect,
MetafileFrameUnit  frameUnit,
GDIPCONST WCHAR desc,
GpMetafile **  metafile 
)

Definition at line 863 of file metafile.c.

865 {
866  GpStatus stat;
867 
868  TRACE("(%p %p %d %p %d %p %p)\n", stream, hdc, type, frameRect, frameUnit, desc, metafile);
869 
870  if (!stream)
871  return InvalidParameter;
872 
873  stat = GdipRecordMetafile(hdc, type, frameRect, frameUnit, desc, metafile);
874 
875  if (stat == Ok)
876  {
877  (*metafile)->record_stream = stream;
878  IStream_AddRef(stream);
879  }
880 
881  return stat;
882 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
Definition: metafile.c:735
static const unsigned char metafile[]
Definition: olepicture.c:138
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define TRACE(s)
Definition: solgame.cpp:4
Definition: parse.h:22
HDC hdc
Definition: main.c:9
GLuint GLuint stream
Definition: glext.h:7522
Definition: stat.h:55
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345

◆ GdipSetMetafileDownLevelRasterizationLimit()

GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit ( GpMetafile metafile,
UINT  limitDpi 
)

Definition at line 3956 of file metafile.c.

3958 {
3959  TRACE("(%p,%u)\n", metafile, limitDpi);
3960 
3961  return Ok;
3962 }
static const unsigned char metafile[]
Definition: olepicture.c:138
#define TRACE(s)
Definition: solgame.cpp:4

◆ get_emfplus_header_proc()

static int CALLBACK get_emfplus_header_proc ( HDC  hDC,
HANDLETABLE lpHTable,
const ENHMETARECORD lpEMFR,
int  nObj,
LPARAM  lpData 
)
static

Definition at line 3662 of file metafile.c.

3664 {
3665  EmfPlusHeader *dst_header = (EmfPlusHeader*)lpData;
3666 
3667  if (lpEMFR->iType == EMR_GDICOMMENT)
3668  {
3669  const EMRGDICOMMENT *comment = (const EMRGDICOMMENT*)lpEMFR;
3670 
3671  if (comment->cbData >= 4 && memcmp(comment->Data, "EMF+", 4) == 0)
3672  {
3673  const EmfPlusRecordHeader *header = (const EmfPlusRecordHeader*)&comment->Data[4];
3674 
3675  if (4 + sizeof(EmfPlusHeader) <= comment->cbData &&
3677  {
3678  memcpy(dst_header, header, sizeof(*dst_header));
3679  }
3680  }
3681  }
3682  else if (lpEMFR->iType == EMR_HEADER)
3683  return TRUE;
3684 
3685  return FALSE;
3686 }
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define EMR_GDICOMMENT
Definition: wingdi.h:143
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define EMR_HEADER
Definition: wingdi.h:75
Definition: id3.c:18
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct CFHEADER header
Definition: fdi.c:109

Referenced by GdipGetMetafileHeaderFromEmf().

◆ is_integer_rect()

static BOOL is_integer_rect ( const GpRectF rect)
static

Definition at line 970 of file metafile.c.

971 {
972  SHORT x, y, width, height;
973  x = rect->X;
974  y = rect->Y;
975  width = rect->Width;
976  height = rect->Height;
977  if (rect->X != (REAL)x || rect->Y != (REAL)y ||
978  rect->Width != (REAL)width || rect->Height != (REAL)height)
979  return FALSE;
980  return TRUE;
981 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
& rect
Definition: startmenu.cpp:1413
short SHORT
Definition: pedump.c:59
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
float REAL
Definition: types.h:41

Referenced by METAFILE_FillRectangles().

◆ METAFILE_AddBrushObject()

static GpStatus METAFILE_AddBrushObject ( GpMetafile metafile,
GpBrush brush,
DWORD id 
)
static

Definition at line 1027 of file metafile.c.

1028 {
1029  EmfPlusObject *object_record;
1030  GpStatus stat;
1031  DWORD size;
1032 
1033  *id = -1;
1034  if (metafile->metafile_type != MetafileTypeEmfPlusOnly && metafile->metafile_type != MetafileTypeEmfPlusDual)
1035  return Ok;
1036 
1037  stat = METAFILE_PrepareBrushData(brush, &size);
1038  if (stat != Ok) return stat;
1039 
1041  FIELD_OFFSET(EmfPlusObject, ObjectData) + size, (void**)&object_record);
1042  if (stat != Ok) return stat;
1043 
1045  object_record->Header.Type = EmfPlusRecordTypeObject;
1046  object_record->Header.Flags = *id | ObjectTypeBrush << 8;
1047  METAFILE_FillBrushData(brush, &object_record->ObjectData.brush);
1048  return Ok;
1049 }
union EmfPlusObject::@397 ObjectData
static void METAFILE_FillBrushData(GpBrush *brush, EmfPlusBrush *data)
Definition: metafile.c:1001
static const unsigned char metafile[]
Definition: olepicture.c:138
EmfPlusBrush brush
Definition: metafile.c:387
static DWORD METAFILE_AddObjectId(GpMetafile *metafile)
Definition: metafile.c:613
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: stat.h:55
static GpStatus METAFILE_PrepareBrushData(GpBrush *brush, DWORD *size)
Definition: metafile.c:983
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void **result)
Definition: metafile.c:618
EmfPlusRecordHeader Header
Definition: metafile.c:384
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254

Referenced by METAFILE_FillPath(), and METAFILE_FillRectangles().

◆ METAFILE_AddImageAttributesObject()

static GpStatus METAFILE_AddImageAttributesObject ( GpMetafile metafile,
const GpImageAttributes attrs,