Skip to content
Browse files

2007-04-26 Sebastien Pouliot <sebastien@ximian.com>

	* emfcodec.h: Include metafile-private.h
	* emfplus.h: Include metafile-private.h
	* graphics.c: Correct API wrt public API
	* graphics.h: Clean up public API (and include missing stuff)
	* gdiplus-private.h: Add typedef for GpMetafile
	* image.c: Include metafile-private.h
	* metafile.c: Add GdipRecordMetafile{Filename][I] functions.
	* metafile.h: Add new record functions. Remove private stuff (into new
	private header) and win32 definitions.
	* metafile-private.h: New file. Private header.
	* win32structs.h: Add metafile public here
	* wmfcodec.h: Include metafile-private.h
	* Makefile.am: Add new metafile-private.h to the build/dist


svn path=/trunk/libgdiplus/; revision=76308
  • Loading branch information...
1 parent 63cf75f commit 3389967f99d0068144f5dd40814bb96e308923ff Sebastien Pouliot committed Apr 26, 2007
Showing with 662 additions and 438 deletions.
  1. +16 −0 src/ChangeLog
  2. +1 −0 src/Makefile.am
  3. +1 −1 src/emfcodec.h
  4. +1 −1 src/emfplus.h
  5. +1 −0 src/gdiplus-private.h
  6. +31 −33 src/graphics.c
  7. +119 −81 src/graphics.h
  8. +1 −1 src/image.c
  9. +175 −0 src/metafile-private.h
  10. +107 −1 src/metafile.c
  11. +33 −313 src/metafile.h
  12. +175 −6 src/win32structs.h
  13. +1 −1 src/wmfcodec.h
View
16 src/ChangeLog
@@ -1,3 +1,19 @@
+2007-04-26 Sebastien Pouliot <sebastien@ximian.com>
+
+ * emfcodec.h: Include metafile-private.h
+ * emfplus.h: Include metafile-private.h
+ * graphics.c: Correct API wrt public API
+ * graphics.h: Clean up public API (and include missing stuff)
+ * gdiplus-private.h: Add typedef for GpMetafile
+ * image.c: Include metafile-private.h
+ * metafile.c: Add GdipRecordMetafile{Filename][I] functions.
+ * metafile.h: Add new record functions. Remove private stuff (into new
+ private header) and win32 definitions.
+ * metafile-private.h: New file. Private header.
+ * win32structs.h: Add metafile public here
+ * wmfcodec.h: Include metafile-private.h
+ * Makefile.am: Add new metafile-private.h to the build/dist
+
2007-04-25 Sebastien Pouliot <sebastien@ximian.com>
* pngcodec.c: Fix compilation when old headers are used (e.g. rh9 and
View
1 src/Makefile.am
@@ -62,6 +62,7 @@ libgdiplus_la_SOURCES = \
matrix-private.h \
metafile.c \
metafile.h \
+ metafile-private.h \
pathgradientbrush.c \
pathgradientbrush.h \
pathgradientbrush-private.h \
View
2 src/emfcodec.h
@@ -24,7 +24,7 @@
#define __EMFCODEC_H__
#include "gdiplus-private.h"
-#include "metafile.h"
+#include "metafile-private.h"
#include "graphics-private.h"
/*
View
2 src/emfplus.h
@@ -24,7 +24,7 @@
#define __EMFPLUS_H__
#include "gdiplus-private.h"
-#include "metafile.h"
+#include "metafile-private.h"
#include "emfcodec.h"
#include "graphics.h"
#include "solidbrush-private.h"
View
1 src/gdiplus-private.h
@@ -81,6 +81,7 @@ typedef struct _Hatch GpHatch;
typedef struct _Image GpImage;
typedef struct _ImageAttributes GpImageAttributes;
typedef struct _LineGradient GpLineGradient;
+typedef struct _Metafile GpMetafile;
typedef struct _Path GpPath;
typedef struct _PathIterator GpPathIterator;
typedef struct _PathGradient GpPathGradient;
View
64 src/graphics.c
@@ -222,7 +222,7 @@ make_ellipse (GpGraphics *graphics, float x, float y, float width, float height,
}
static void
-make_polygon (GpGraphics *graphics, GpPointF *points, int count, BOOL antialiasing)
+make_polygon (GpGraphics *graphics, GDIPCONST GpPointF *points, int count, BOOL antialiasing)
{
int i;
@@ -244,7 +244,7 @@ make_polygon (GpGraphics *graphics, GpPointF *points, int count, BOOL antialiasi
}
static void
-make_polygon_from_integers (GpGraphics *graphics, GpPoint *points, int count, BOOL antialiasing)
+make_polygon_from_integers (GpGraphics *graphics, GDIPCONST GpPoint *points, int count, BOOL antialiasing)
{
int i;
@@ -1002,8 +1002,7 @@ GpStatus GdipDrawBezierI (GpGraphics *graphics, GpPen *pen,
}
GpStatus
-GdipDrawBeziers (GpGraphics *graphics, GpPen *pen,
- GpPointF *points, int count)
+GdipDrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count)
{
int i, j, k;
@@ -1038,8 +1037,7 @@ GdipDrawBeziers (GpGraphics *graphics, GpPen *pen,
}
GpStatus
-GdipDrawBeziersI (GpGraphics *graphics, GpPen *pen,
- GpPoint *points, int count)
+GdipDrawBeziersI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count)
{
int i, j, k;
@@ -1143,7 +1141,7 @@ GdipDrawLineI (GpGraphics *graphics, GpPen *pen,
}
GpStatus
-GdipDrawLines (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count)
+GdipDrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count)
{
int i;
@@ -1172,7 +1170,7 @@ GdipDrawLines (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count)
}
GpStatus
-GdipDrawLinesI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count)
+GdipDrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count)
{
int i;
@@ -1310,7 +1308,7 @@ GdipDrawPieI (GpGraphics *graphics, GpPen *pen, int x, int y,
}
GpStatus
-GdipDrawPolygon (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count)
+GdipDrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count)
{
if (!graphics || !pen || !points || count < 2)
return InvalidParameter;
@@ -1333,7 +1331,7 @@ GdipDrawPolygon (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count)
}
GpStatus
-GdipDrawPolygonI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count)
+GdipDrawPolygonI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count)
{
if (!graphics || !pen || !points || count < 2)
return InvalidParameter;
@@ -1397,7 +1395,7 @@ GdipDrawRectangleI (GpGraphics *graphics, GpPen *pen,
}
GpStatus
-GdipDrawRectangles (GpGraphics *graphics, GpPen *pen, GpRectF *rects, int count)
+GdipDrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, int count)
{
BOOL draw = FALSE;
int i;
@@ -1433,7 +1431,7 @@ GdipDrawRectangles (GpGraphics *graphics, GpPen *pen, GpRectF *rects, int count)
}
GpStatus
-GdipDrawRectanglesI (GpGraphics *graphics, GpPen *pen, GpRect *rects, int count)
+GdipDrawRectanglesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, int count)
{
BOOL draw = FALSE;
int i;
@@ -1469,7 +1467,7 @@ GdipDrawRectanglesI (GpGraphics *graphics, GpPen *pen, GpRect *rects, int count)
}
static void
-make_curve (GpGraphics *graphics, GpPointF *points, GpPointF *tangents, int offset, int length,
+make_curve (GpGraphics *graphics, GDIPCONST GpPointF *points, GpPointF *tangents, int offset, int length,
_CurveType type, BOOL antialiasing)
{
int i;
@@ -1509,19 +1507,19 @@ make_curve (GpGraphics *graphics, GpPointF *points, GpPointF *tangents, int offs
}
GpStatus
-GdipDrawClosedCurve (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count)
+GdipDrawClosedCurve (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count)
{
return GdipDrawClosedCurve2 (graphics, pen, points, count, 0.5f);
}
GpStatus
-GdipDrawClosedCurveI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count)
+GdipDrawClosedCurveI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count)
{
return GdipDrawClosedCurve2I (graphics, pen, points, count, 0.5f);
}
GpStatus
-GdipDrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count, float tension)
+GdipDrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count, float tension)
{
GpPointF *tangents;
@@ -1556,7 +1554,7 @@ GdipDrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GpPointF *points, int co
}
GpStatus
-GdipDrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count, float tension)
+GdipDrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count, float tension)
{
GpPointF *pt;
GpStatus s;
@@ -1576,7 +1574,7 @@ GdipDrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GpPoint *points, int co
}
GpStatus
-GdipDrawCurve (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count)
+GdipDrawCurve (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count)
{
if (count == 2) {
return GdipDrawLines (graphics, pen, points, count);
@@ -1587,7 +1585,7 @@ GdipDrawCurve (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count)
}
GpStatus
-GdipDrawCurveI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count)
+GdipDrawCurveI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count)
{
if (count == 2) {
return GdipDrawLinesI (graphics, pen, points, count);
@@ -1598,7 +1596,7 @@ GdipDrawCurveI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count)
}
GpStatus
-GdipDrawCurve2 (GpGraphics *graphics, GpPen* pen, GpPointF *points, int count, float tension)
+GdipDrawCurve2 (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPointF *points, int count, float tension)
{
if (count == 2) {
return GdipDrawLines (graphics, pen, points, count);
@@ -1609,7 +1607,7 @@ GdipDrawCurve2 (GpGraphics *graphics, GpPen* pen, GpPointF *points, int count, f
}
GpStatus
-GdipDrawCurve2I (GpGraphics *graphics, GpPen* pen, GpPoint *points, int count, float tension)
+GdipDrawCurve2I (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPoint *points, int count, float tension)
{
if (count == 2) {
return GdipDrawLinesI (graphics, pen, points, count);
@@ -1620,7 +1618,7 @@ GdipDrawCurve2I (GpGraphics *graphics, GpPen* pen, GpPoint *points, int count, f
}
GpStatus
-GdipDrawCurve3 (GpGraphics *graphics, GpPen* pen, GpPointF *points, int count, int offset, int numOfSegments, float tension)
+GdipDrawCurve3 (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPointF *points, int count, int offset, int numOfSegments, float tension)
{
GpPointF *tangents;
@@ -1661,7 +1659,7 @@ GdipDrawCurve3 (GpGraphics *graphics, GpPen* pen, GpPointF *points, int count, i
}
GpStatus
-GdipDrawCurve3I (GpGraphics *graphics, GpPen* pen, GpPoint *points, int count, int offset, int numOfSegments, float tension)
+GdipDrawCurve3I (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPoint *points, int count, int offset, int numOfSegments, float tension)
{
GpPointF *pf;
GpStatus s;
@@ -1750,7 +1748,7 @@ GdipFillRectangleI (GpGraphics *graphics, GpBrush *brush,
}
GpStatus
-GdipFillRectangles (GpGraphics *graphics, GpBrush *brush, GpRectF *rects, int count)
+GdipFillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, int count)
{
BOOL draw = FALSE;
int i;
@@ -1787,7 +1785,7 @@ GdipFillRectangles (GpGraphics *graphics, GpBrush *brush, GpRectF *rects, int co
}
GpStatus
-GdipFillRectanglesI (GpGraphics *graphics, GpBrush *brush, GpRect *rects, int count)
+GdipFillRectanglesI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, int count)
{
BOOL draw = FALSE;
int i;
@@ -1861,7 +1859,7 @@ GdipFillPieI (GpGraphics *graphics, GpBrush *brush,
}
GpStatus
-GdipFillPolygon (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count, FillMode fillMode)
+GdipFillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, FillMode fillMode)
{
if (!graphics || !brush || !points)
return InvalidParameter;
@@ -1911,7 +1909,7 @@ GdipFillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path)
}
GpStatus
-GdipFillPolygonI (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count, FillMode fillMode)
+GdipFillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, FillMode fillMode)
{
if (!graphics || !brush || !points)
return InvalidParameter;
@@ -1935,31 +1933,31 @@ GdipFillPolygonI (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int cou
}
GpStatus
-GdipFillPolygon2 (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count)
+GdipFillPolygon2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count)
{
return GdipFillPolygon (graphics, brush, points, count, FillModeAlternate);
}
GpStatus
-GdipFillPolygon2I (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count)
+GdipFillPolygon2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count)
{
return GdipFillPolygonI (graphics, brush, points, count, FillModeAlternate);
}
GpStatus
-GdipFillClosedCurve (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count)
+GdipFillClosedCurve (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count)
{
return GdipFillClosedCurve2 (graphics, brush, points, count, 0.5f);
}
GpStatus
-GdipFillClosedCurveI (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count)
+GdipFillClosedCurveI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count)
{
return GdipFillClosedCurve2I (graphics, brush, points, count, 0.5f);
}
GpStatus
-GdipFillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count, float tension)
+GdipFillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, float tension)
{
GpPointF *tangents;
@@ -1994,7 +1992,7 @@ GdipFillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GpPointF *points, in
}
GpStatus
-GdipFillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count, float tension)
+GdipFillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, float tension)
{
GpPointF *pt;
GpStatus s;
View
200 src/graphics.h
@@ -32,103 +32,141 @@ GpStatus GdipBeginContainer2 (GpGraphics *graphics, GraphicsContainer* state);
GpStatus GdipBeginContainerI (GpGraphics *graphics, GDIPCONST GpRect* dstrect, GDIPCONST GpRect *srcrect, GpUnit unit, GraphicsContainer *state);
GpStatus GdipEndContainer (GpGraphics *graphics, GraphicsContainer state);
-GpStatus GdipCreateFromHDC (void *hDC, GpGraphics **graphics);
+GpStatus GdipCreateFromHDC (HDC hDC, GpGraphics **graphics);
GpStatus GdipDeleteGraphics (GpGraphics *graphics);
-GpStatus GdipGetDC (GpGraphics *graphics, void **hDC);
-GpStatus GdipReleaseDC (GpGraphics *graphics, void *hDC);
+
+GpStatus GdipGetDC (GpGraphics *graphics, HDC *hDC);
+GpStatus GdipReleaseDC (GpGraphics *graphics, HDC hDC);
+
GpStatus GdipRestoreGraphics (GpGraphics *graphics, unsigned int graphicsState);
GpStatus GdipSaveGraphics(GpGraphics *graphics, unsigned int * state);
+
GpStatus GdipGetWorldTransform (GpGraphics *graphics, GpMatrix *matrix);
+GpStatus GdipSetWorldTransform (GpGraphics *graphics, GpMatrix *matrix);
GpStatus GdipMultiplyWorldTransform (GpGraphics *graphics, GpMatrix *matrix, GpMatrixOrder order);
GpStatus GdipResetWorldTransform (GpGraphics *graphics);
-GpStatus GdipSetWorldTransform (GpGraphics *graphics, GpMatrix *matrix);
GpStatus GdipScaleWorldTransform (GpGraphics *graphics, float sx, float sy, GpMatrixOrder order);
GpStatus GdipRotateWorldTransform (GpGraphics *graphics, float angle, GpMatrixOrder order);
GpStatus GdipTranslateWorldTransform (GpGraphics *graphics, float dx, float dy, GpMatrixOrder order);
-GpStatus GdipDrawArc (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
-GpStatus GdipDrawArcI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle);
-GpStatus GdipDrawBezier (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
-GpStatus GdipDrawBezierI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
-GpStatus GdipDrawBeziers (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count);
-GpStatus GdipDrawBeziersI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count);
-GpStatus GdipDrawCurve (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count);
-GpStatus GdipDrawCurveI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count);
-GpStatus GdipDrawCurve2 (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count, float tension);
-GpStatus GdipDrawCurve2I (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count, float tension);
-GpStatus GdipDrawCurve3 (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count, int offset, int numOfSegments, float tension);
-GpStatus GdipDrawCurve3I (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count, int offset, int numOfSegments, float tension);
-GpStatus GdipDrawClosedCurve (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count);
-GpStatus GdipDrawClosedCurveI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count);
-GpStatus GdipDrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count, float tension);
-GpStatus GdipDrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count, float tension);
-GpStatus GdipDrawEllipse (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height);
-GpStatus GdipDrawImage (GpGraphics *graphics, GpImage *image, float x, float y);
-GpStatus GdipDrawImageI (GpGraphics *graphics, GpImage *image, int x, int y);
-GpStatus GdipDrawImageRect (GpGraphics *graphics, GpImage *image, float x, float y, float width, float height);
-GpStatus GdipDrawImageRectI (GpGraphics *graphics, GpImage *image, int x, int y, int width, int height);
-GpStatus GdipDrawImagePoints (GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *dstPoints, int count);
-GpStatus GdipDrawImagePointsI (GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *dstPoints, int count);
-GpStatus GdipDrawImagePointRect (GpGraphics *graphics, GpImage *image, float x, float y, float srcx, float srcy, float srcwidth, float srcheight, GpUnit srcUnit);
-GpStatus GdipDrawImagePointRectI (GpGraphics *graphics, GpImage *image, int x, int y, int srcx, int srcy, int srcwidth, int srcheight, GpUnit srcUnit);
-GpStatus GdipDrawImageRectRect (GpGraphics *graphics, GpImage *image, float dstx, float dsty, float dstwidth, float dstheight, float srcx, float srcy, float srcwidth, float srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData);
-GpStatus GdipDrawImageRectRectI (GpGraphics *graphics, GpImage *image, int dstx, int dsty, int dstwidth, int dstheight, int srcx, int srcy, int srcwidth, int srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData);
-GpStatus GdipDrawImagePointsRect (GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *points, int count, float srcx, float srcy, float srcwidth, float srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData);
-GpStatus GdipDrawImagePointsRectI (GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *points, int count, int srcx, int srcy, int srcwidth, int srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData);
-GpStatus GdipDrawLine (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2);
-GpStatus GdipDrawLineI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2);
-GpStatus GdipDrawLines (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count);
-GpStatus GdipDrawLinesI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count);
+
+GpStatus GdipDrawArc (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle);
+GpStatus GdipDrawArcI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle);
+GpStatus GdipDrawBezier (GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4);
+GpStatus GdipDrawBezierI (GpGraphics *graphics, GpPen *pen, INT x1, INT y1, INT x2, INT y2, INT x3, INT y3, INT x4, INT y4);
+GpStatus GdipDrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count);
+GpStatus GdipDrawBeziersI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count);
+GpStatus GdipDrawCurve (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count);
+GpStatus GdipDrawCurveI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count);
+GpStatus GdipDrawCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, REAL tension);
+GpStatus GdipDrawCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, REAL tension);
+GpStatus GdipDrawCurve3 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, INT offset, INT numOfSegments, REAL tension);
+GpStatus GdipDrawCurve3I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, INT offset, INT numOfSegments, REAL tension);
+GpStatus GdipDrawClosedCurve (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count);
+GpStatus GdipDrawClosedCurveI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count);
+GpStatus GdipDrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, REAL tension);
+GpStatus GdipDrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, REAL tension);
+GpStatus GdipDrawEllipse (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height);
+GpStatus GdipDrawEllipseI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height);
+GpStatus GdipDrawImage (GpGraphics *graphics, GpImage *image, REAL x, REAL y);
+GpStatus GdipDrawImageI (GpGraphics *graphics, GpImage *image, INT x, INT y);
+GpStatus GdipDrawImageRect (GpGraphics *graphics, GpImage *image, REAL x, REAL y, REAL width, REAL height);
+GpStatus GdipDrawImageRectI (GpGraphics *graphics, GpImage *image, INT x, INT y, INT width, INT height);
+GpStatus GdipDrawImagePoints (GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *dstPoints, INT count);
+GpStatus GdipDrawImagePointsI (GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *dstPoints, INT count);
+GpStatus GdipDrawImagePointRect (GpGraphics *graphics, GpImage *image, REAL x, REAL y, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit);
+GpStatus GdipDrawImagePointRectI (GpGraphics *graphics, GpImage *image, INT x, INT y, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit);
+GpStatus GdipDrawImageRectRect (GpGraphics *graphics, GpImage *image, REAL dstx, REAL dsty, REAL dstwidth, REAL dstheight, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData);
+GpStatus GdipDrawImageRectRectI (GpGraphics *graphics, GpImage *image, INT dstx, INT dsty, INT dstwidth, INT dstheight, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData);
+GpStatus 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);
+GpStatus GdipDrawImagePointsRectI (GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *points, INT count, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData);
+GpStatus GdipDrawLine (GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, REAL x2, REAL y2);
+GpStatus GdipDrawLineI (GpGraphics *graphics, GpPen *pen, INT x1, INT y1, INT x2, INT y2);
+GpStatus GdipDrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count);
+GpStatus GdipDrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count);
GpStatus GdipDrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path);
-GpStatus GdipDrawPie (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
-GpStatus GdipDrawPieI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle);
-GpStatus GdipDrawPolygon (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count);
-GpStatus GdipDrawPolygonI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count);
-GpStatus GdipDrawRectangle (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height);
-GpStatus GdipDrawRectangleI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height);
-GpStatus GdipDrawRectangles (GpGraphics *graphics, GpPen *pen, GpRectF *rects, int count);
-GpStatus GdipDrawRectanglesI (GpGraphics *graphics, GpPen *pen, GpRect *rects, int count);
-GpStatus GdipFillClosedCurve (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count);
-GpStatus GdipFillClosedCurveI (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count);
-GpStatus GdipFillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count, float tension);
-GpStatus GdipFillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count, float tension);
-GpStatus GdipFillEllipse (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height);
-GpStatus GdipFillEllipseI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height);
-GpStatus GdipFillRectangle (GpGraphics *graphics, GpBrush *brush, float x1, float y1, float x2, float y2);
-GpStatus GdipFillRectangleI (GpGraphics *graphics, GpBrush *brush, int x1, int y1, int x2, int y2);
-GpStatus GdipFillRectangles (GpGraphics *graphics, GpBrush *brush, GpRectF *rects, int count);
-GpStatus GdipFillRectanglesI (GpGraphics *graphics, GpBrush *brush, GpRect *rects, int count);
-GpStatus GdipFillPolygon (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count, FillMode fillMode);
-GpStatus GdipFillPolygonI (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count, FillMode fillMode);
-GpStatus GdipFillPolygon2 (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count);
-GpStatus GdipFillPolygon2I (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count);
+GpStatus GdipDrawPie (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle);
+GpStatus GdipDrawPieI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle);
+GpStatus GdipDrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count);
+GpStatus GdipDrawPolygonI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count);
+GpStatus GdipDrawRectangle (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height);
+GpStatus GdipDrawRectangleI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height);
+GpStatus GdipDrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, INT count);
+GpStatus GdipDrawRectanglesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, INT count);
+GpStatus GdipFillClosedCurve (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count);
+GpStatus GdipFillClosedCurveI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count);
+GpStatus GdipFillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count, REAL tension);
+GpStatus GdipFillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count, REAL tension);
+GpStatus GdipFillEllipse (GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height);
+GpStatus GdipFillEllipseI (GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height);
+GpStatus GdipFillRectangle (GpGraphics *graphics, GpBrush *brush, REAL x1, REAL y1, REAL x2, REAL y2);
+GpStatus GdipFillRectangleI (GpGraphics *graphics, GpBrush *brush, INT x1, INT y1, INT x2, INT y2);
+GpStatus GdipFillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, INT count);
+GpStatus GdipFillRectanglesI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, INT count);
+GpStatus GdipFillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count, FillMode fillMode);
+GpStatus GdipFillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count, FillMode fillMode);
+GpStatus GdipFillPolygon2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count);
+GpStatus GdipFillPolygon2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count);
GpStatus GdipFillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path);
-GpStatus GdipSetRenderingOrigin (GpGraphics *graphics, int x, int y);
-GpStatus GdipGetRenderingOrigin (GpGraphics *graphics, int *x, int *y);
-GpStatus GdipGetDpiX(GpGraphics *graphics, float *dpi);
-GpStatus GdipGetDpiY(GpGraphics *graphics, float *dpi);
-GpStatus GdipFillPie(GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height, float startAngle, float sweepAngle);
-GpStatus GdipFillPieI(GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height, float startAngle, float sweepAngle);
-GpStatus GdipGraphicsClear(GpGraphics *graphics, ARGB color);
-GpStatus GdipFillRegion(GpGraphics *graphics, GpBrush *brush, GpRegion *region);
-GpStatus GdipSetInteroplationMode(GpGraphics *graphics, InterpolationMode imode);
-GpStatus GdipGetInteroplationMode(GpGraphics *graphics, InterpolationMode *imode);
-GpStatus GdipSetTextRenderingHint(GpGraphics *graphics, TextRenderingHint mode);
-GpStatus GdipGetTextRenderingHint(GpGraphics *graphics, TextRenderingHint *mode);
-GpStatus GdipSetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode pixelOffsetMode);
-GpStatus GdipGetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode *pixelOffsetMode);
-GpStatus GdipSetTextContrast(GpGraphics *graphics, UINT contrast);
-GpStatus GdipGetTextContrast(GpGraphics *graphics, UINT *contrast);
-GpStatus GdipSetSmoothingMode(GpGraphics *graphics, SmoothingMode mode);
-GpStatus GdipGetSmoothingMode(GpGraphics *graphics, SmoothingMode *mode);
+GpStatus GdipFillPie (GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle);
+GpStatus GdipFillPieI( GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle);
+GpStatus GdipFillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region);
+GpStatus GdipGraphicsClear (GpGraphics *graphics, ARGB color);
+
+GpStatus GdipGetDpiX( GpGraphics *graphics, REAL *dpi);
+GpStatus GdipGetDpiY (GpGraphics *graphics, REAL *dpi);
+GpStatus GdipGetNearestColor (GpGraphics *graphics, ARGB *argb);
+
+GpStatus GdipSetCompositingMode (GpGraphics *graphics, CompositingMode compositingMode);
+GpStatus GdipGetCompositingMode (GpGraphics *graphics, CompositingMode *compositingMode);
+GpStatus GdipSetCompositingQuality (GpGraphics *graphics, CompositingQuality compositingQuality);
+GpStatus GdipGetCompositingQuality (GpGraphics *graphics, CompositingQuality *compositingQuality);
+GpStatus GdipSetInteroplationMode (GpGraphics *graphics, InterpolationMode imode);
+GpStatus GdipGetInteroplationMode (GpGraphics *graphics, InterpolationMode *imode);
+GpStatus GdipSetPageScale (GpGraphics *graphics, REAL scale);
+GpStatus GdipGetPageScale (GpGraphics *graphics, REAL *scale);
+GpStatus GdipSetPageUnit (GpGraphics *graphics, GpUnit unit);
+GpStatus GdipGetPageUnit (GpGraphics *graphics, GpUnit *unit);
+GpStatus GdipSetPixelOffsetMode (GpGraphics *graphics, PixelOffsetMode pixelOffsetMode);
+GpStatus GdipGetPixelOffsetMode (GpGraphics *graphics, PixelOffsetMode *pixelOffsetMode);
+GpStatus GdipSetRenderingOrigin (GpGraphics *graphics, INT x, INT y);
+GpStatus GdipGetRenderingOrigin (GpGraphics *graphics, INT *x, INT *y);
+GpStatus GdipSetSmoothingMode (GpGraphics *graphics, SmoothingMode mode);
+GpStatus GdipGetSmoothingMode (GpGraphics *graphics, SmoothingMode *mode);
+GpStatus GdipSetTextContrast (GpGraphics *graphics, UINT contrast);
+GpStatus GdipGetTextContrast (GpGraphics *graphics, UINT *contrast);
+GpStatus GdipSetTextRenderingHint (GpGraphics *graphics, TextRenderingHint mode);
+GpStatus GdipGetTextRenderingHint (GpGraphics *graphics, TextRenderingHint *mode);
+
+GpStatus GdipIsVisiblePoint (GpGraphics *graphics, REAL x, REAL y, BOOL *result);
+GpStatus GdipIsVisiblePointI (GpGraphics *graphics, INT x, INT y, BOOL *result);
+GpStatus GdipIsVisibleRect (GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, BOOL *result);
+GpStatus GdipIsVisibleRectI (GpGraphics *graphics, INT x, INT y, INT width, INT height, BOOL *result);
+GpStatus GdipTransformPoints (GpGraphics *graphics, GpCoordinateSpace destSpace, GpCoordinateSpace srcSpace, GpPointF *points, INT count);
+GpStatus GdipTransformPointsI (GpGraphics *graphics, GpCoordinateSpace destSpace, GpCoordinateSpace srcSpace, GpPoint *points, INT count);
+
GpStatus GdipResetClip (GpGraphics *graphics);
+GpStatus GdipGetClipBounds (GpGraphics *graphics, GpRectF *rect);
+GpStatus GdipGetClipBoundsI (GpGraphics *graphics, GpRect *rect);
+GpStatus GdipGetVisibleClipBounds (GpGraphics *graphics, GpRectF *rect);
+GpStatus GdipGetVisibleClipBoundsI (GpGraphics *graphics, GpRect *rect);
+GpStatus GdipIsClipEmpty (GpGraphics *graphics, BOOL *result);
+GpStatus GdipIsVisibleClipEmpty (GpGraphics *graphics, BOOL *result);
GpStatus GdipSetClipGraphics (GpGraphics *graphics, GpGraphics *srcgraphics, CombineMode combineMode);
GpStatus GdipSetClipHrgn (GpGraphics *graphics, void *hRgn, CombineMode combineMode);
GpStatus GdipSetClipPath (GpGraphics *graphics, GpPath *path, CombineMode combineMode);
-GpStatus GdipSetClipRect (GpGraphics *graphics, float x, float y, float width, float height, CombineMode combineMode);
-GpStatus GdipSetClipRectI (GpGraphics *graphics, int x, int y, int width, int height, CombineMode combineMode);
+GpStatus GdipSetClipRect (GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, CombineMode combineMode);
+GpStatus GdipSetClipRectI (GpGraphics *graphics, INT x, INT y, INT width, INT height, CombineMode combineMode);
GpStatus GdipSetClipRegion (GpGraphics *graphics, GpRegion *region, CombineMode combineMode);
GpStatus GdipSetVisibleClip_linux (GpGraphics *graphics, GpRect *rect);
-GpStatus GdipTranslateClip (GpGraphics *graphics, float dx, float dy);
-GpStatus GdipTranslateClipI (GpGraphics *graphics, int dx, int dy);
+GpStatus GdipTranslateClip (GpGraphics *graphics, REAL dx, REAL dy);
+GpStatus GdipTranslateClipI (GpGraphics *graphics, INT dx, INT dy);
+
+/* missing API
+ GdipCreateFromHDC2
+ GdipCreateFromHWND
+ GdipCreateFromHWNDICM
+ GdipCreateHalftonePalette
+ GdipResetPageTransform
+ */
#endif
View
2 src/image.c
@@ -35,7 +35,7 @@
#include "graphics-private.h"
#include "matrix.h"
-#include "metafile.h"
+#include "metafile-private.h"
#include "bmpcodec.h"
#include "pngcodec.h"
#include "jpegcodec.h"
View
175 src/metafile-private.h
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Sebastien Pouliot <sebastien@ximian.com>
+ */
+
+#ifndef __METAFILE_PRIVATE_H__
+#define __METAFILE_PRIVATE_H__
+
+#include "gdiplus-private.h"
+#include "codecs-private.h"
+#include "bitmap-private.h"
+#include "matrix-private.h"
+#include "bmpcodec.h"
+#include "emfcodec.h"
+#include "wmfcodec.h"
+
+/*
+ * http://wvware.sourceforge.net/caolan/ora-wmf.html
+ */
+
+#define ALDUS_PLACEABLE_METAFILE_KEY 0x9AC6CDD7
+#define WMF_TYPE_AND_HEADERSIZE_KEY 0x00090001
+#define EMF_EMR_HEADER_KEY 0x1
+
+/* this has to do with 25.4mm in an inch (but why is it multiplied by 100 ?) */
+#define METAFILE_DIMENSION_FACTOR 2540
+#define MM_PER_INCH 25.4f
+
+/* match System.Drawing.Imaging.MetafileType */
+#define METAFILETYPE_INVALID 0
+#define METAFILETYPE_WMF 1
+#define METAFILETYPE_WMFPLACEABLE 2
+#define METAFILETYPE_EMF 3
+#define METAFILETYPE_EMFPLUSONLY 4
+#define METAFILETYPE_EMFPLUSDUAL 5
+
+/* object types */
+#define METAOBJECT_TYPE_EMPTY 0
+#define METAOBJECT_TYPE_PEN 1
+#define METAOBJECT_TYPE_BRUSH 2
+
+#define GDIP_EMFPLUS_RECORD_BASE 16384
+
+#define gdip_get_metaheader(image) (&((GpMetafile*)image)->metafile_header)
+
+
+typedef struct {
+ void *ptr;
+ int type;
+} MetaObject;
+
+struct _Metafile {
+ GpImage base;
+ MetafileHeader metafile_header;
+ BOOL delete;
+ BYTE *data;
+ int length;
+};
+
+typedef struct {
+ GpMetafile *metafile;
+ int x, y, width, height;
+ int objects_count;
+ MetaObject *objects;
+ MetaObject created;
+ GpGraphics *graphics;
+ GpMatrix initial;
+ GpMatrix matrix;
+ DWORD bk_mode;
+ DWORD bk_color;
+ float miter_limit;
+ int selected_pen;
+ int selected_brush;
+ int selected_font;
+ int selected_palette;
+ int map_mode;
+ FillMode fill_mode;
+ int current_x, current_y;
+ /* path related data */
+ BOOL use_path;
+ GpPath *path;
+ int path_x, path_y;
+ /* stock objects */
+ GpPen *stock_pen_white;
+ GpPen *stock_pen_black;
+ GpPen *stock_pen_null;
+ GpSolidFill *stock_brush_white;
+ GpSolidFill *stock_brush_ltgray;
+ GpSolidFill *stock_brush_gray;
+ GpSolidFill *stock_brush_dkgray;
+ GpSolidFill *stock_brush_black;
+ GpSolidFill *stock_brush_null;
+ /* bitmap representation */
+ BYTE *scan0;
+} MetafilePlayContext;
+
+typedef struct {
+ int num;
+ GpPointF *points;
+} PointFList;
+
+
+GpStatus gdip_get_metafile_from (void *pointer, GpMetafile **metafile, ImageSource source) GDIP_INTERNAL;
+GpStatus gdip_metafile_clone (GpMetafile *metafile, GpMetafile **clonedmetafile) GDIP_INTERNAL;
+GpStatus gdip_metafile_dispose (GpMetafile *metafile) GDIP_INTERNAL;
+
+GpStatus gdip_metafile_play_emf (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus gdip_metafile_play_wmf (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus gdip_metafile_play_emfplus_block (MetafilePlayContext *context, BYTE* data, int length) GDIP_INTERNAL;
+
+MetafilePlayContext* gdip_metafile_play_setup (GpMetafile *metafile, GpGraphics *graphics, int x, int y, int width,
+ int height) GDIP_INTERNAL;
+GpStatus gdip_metafile_play (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus gdip_metafile_play_cleanup (MetafilePlayContext *context) GDIP_INTERNAL;
+
+GpPen* gdip_metafile_GetSelectedPen (MetafilePlayContext *context) GDIP_INTERNAL;
+GpBrush* gdip_metafile_GetSelectedBrush (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus GdiComment (MetafilePlayContext *context, BYTE* data, DWORD size) GDIP_INTERNAL;
+
+GpStatus gdip_metafile_SaveDC (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetBkMode (MetafilePlayContext *context, DWORD bkMode) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetMapMode (MetafilePlayContext *context, DWORD mode) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetROP2 (MetafilePlayContext *context, DWORD rop) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetRelabs (MetafilePlayContext *context, DWORD mode) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetPolyFillMode (MetafilePlayContext *context, DWORD mode) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetStretchBltMode (MetafilePlayContext *context, int iStretchMode) GDIP_INTERNAL;
+GpStatus gdip_metafile_RestoreDC (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus gdip_metafile_SelectObject (MetafilePlayContext *context, DWORD slot) GDIP_INTERNAL;
+GpStatus gdip_metafile_ModifyWorldTransform (MetafilePlayContext *context, XFORM *lpXform, DWORD iMode) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetTextAlign (MetafilePlayContext *context, DWORD textalign) GDIP_INTERNAL;
+GpStatus gdip_metafile_DeleteObject (MetafilePlayContext *context, DWORD slot) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetBkColor (MetafilePlayContext *context, DWORD color) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetWindowOrg (MetafilePlayContext *context, int x, int y) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetWindowExt (MetafilePlayContext *context, int height, int width) GDIP_INTERNAL;
+GpStatus gdip_metafile_LineTo (MetafilePlayContext *context, int x, int y) GDIP_INTERNAL;
+GpStatus gdip_metafile_MoveTo (MetafilePlayContext *context, int x, int y) GDIP_INTERNAL;
+GpStatus gdip_metafile_SetMiterLimit (MetafilePlayContext *context, float eNewLimit, float *peOldLimit) GDIP_INTERNAL;
+GpStatus gdip_metafile_CreatePenIndirect (MetafilePlayContext *context, DWORD style, DWORD width, DWORD color) GDIP_INTERNAL;
+GpStatus gdip_metafile_ExtCreatePen (MetafilePlayContext *context, DWORD dwPenStyle, DWORD dwWidth, CONST LOGBRUSH *lplb,
+ DWORD dwStyleCount, CONST DWORD *lpStyle) GDIP_INTERNAL;
+GpStatus gdip_metafile_CreateBrushIndirect (MetafilePlayContext *context, DWORD style, DWORD color, DWORD hatch) GDIP_INTERNAL;
+GpStatus gdip_metafile_Arc (MetafilePlayContext *context, int left, int top, int right, int bottom,
+ int xstart, int ystart, int xend, int yend) GDIP_INTERNAL;
+GpStatus gdip_metafile_StretchDIBits (MetafilePlayContext *context, int XDest, int YDest, int nDestWidth, int nDestHeight,
+ int XSrc, int YSrc, int nSrcWidth, int nSrcHeight, CONST void *lpBits, CONST BITMAPINFO *lpBitsInfo,
+ UINT iUsage, DWORD dwRop) GDIP_INTERNAL;
+GpStatus gdip_metafile_PolyBezier (MetafilePlayContext *context, GpPointF *points, int count) GDIP_INTERNAL;
+GpStatus gdip_metafile_Polygon (MetafilePlayContext *context, GpPointF *points, int count) GDIP_INTERNAL;
+GpStatus gdip_metafile_BeginPath (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus gdip_metafile_EndPath (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus gdip_metafile_CloseFigure (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus gdip_metafile_FillPath (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus gdip_metafile_StrokePath (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus gdip_metafile_StrokeAndFillPath (MetafilePlayContext *context) GDIP_INTERNAL;
+
+#include "metafile.h"
+
+#endif
View
108 src/metafile.c
@@ -20,7 +20,7 @@
* Sebastien Pouliot <sebastien@ximian.com>
*/
-#include "metafile.h"
+#include "metafile-private.h"
#include "solidbrush-private.h"
#include "graphics.h"
#include "graphics-path-private.h"
@@ -1615,6 +1615,112 @@ GdipSetMetafileDownLevelRasterizationLimit (GpMetafile *metafile, UINT metafileR
GpStatus
GdipPlayMetafileRecord (GDIPCONST GpMetafile *metafile, EmfPlusRecordType recordType, UINT flags, UINT dataSize, GDIPCONST BYTE* data)
{
+ if (!metafile)
+ return InvalidParameter;
+
/* TODO */
return NotImplemented;
}
+
+GpStatus
+GdipRecordMetafile (HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit,
+ GDIPCONST WCHAR *description, GpMetafile **metafile)
+{
+ GpMetafile *mf;
+
+ if (!referenceHdc || !frameRect || !metafile)
+ return InvalidParameter;
+
+ if ((type < EmfTypeEmfOnly) || (type > EmfTypeEmfPlusDual))
+ return InvalidParameter;
+
+ if ((frameUnit < MetafileFrameUnitPixel) || (frameUnit > MetafileFrameUnitGdi))
+ return InvalidParameter;
+
+ if (((frameRect->Width == 0) || (frameRect->Height == 0)) && (frameUnit != MetafileFrameUnitGdi))
+ return GenericError;
+
+ mf = gdip_metafile_create ();
+ if (!mf)
+ return OutOfMemory;
+
+ mf->metafile_header.X = frameRect->X;
+ mf->metafile_header.Y = frameRect->Y;
+ mf->metafile_header.Width = frameRect->Width;
+ mf->metafile_header.Height = frameRect->Height;
+ mf->metafile_header.Size = 0;
+ mf->metafile_header.Type = type;
+
+ /* TODO - more stuff here! */
+
+ *metafile = mf;
+ return Ok;
+}
+
+GpStatus
+GdipRecordMetafileI (HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit,
+ GDIPCONST WCHAR *description, GpMetafile **metafile)
+{
+ GpRectF rect;
+
+ if (!frameRect)
+ return InvalidParameter;
+
+ rect.X = frameRect->X;
+ rect.Y = frameRect->Y;
+ rect.Width = frameRect->Width;
+ rect.Height = frameRect->Height;
+ return GdipRecordMetafile (referenceHdc, type, (GDIPCONST GpRectF*) &rect, frameUnit, description, metafile);
+}
+
+GpStatus
+GdipRecordMetafileFileName (GDIPCONST WCHAR *fileName, HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect,
+ MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile)
+{
+ GpStatus status;
+
+ if (!fileName)
+ return InvalidParameter;
+
+ status = GdipRecordMetafile (referenceHdc, type, frameRect, frameUnit, description, metafile);
+ if (status != Ok)
+ return status;
+
+ /* TODO - open filename to write stuff */
+
+ return Ok;
+}
+
+GpStatus
+GdipRecordMetafileFileNameI (GDIPCONST WCHAR *fileName, HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect,
+ MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile)
+{
+ GpRectF rect;
+
+ if (!frameRect)
+ return InvalidParameter;
+
+ rect.X = frameRect->X;
+ rect.Y = frameRect->Y;
+ rect.Width = frameRect->Width;
+ rect.Height = frameRect->Height;
+ return GdipRecordMetafileFileName (fileName, referenceHdc, type, (GDIPCONST GpRectF*) &rect, frameUnit, description, metafile);
+}
+
+GpStatus
+GdipRecordMetafileStream (void /* IStream */ *stream, HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect,
+ MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile)
+{
+ /* note: we do not support the COM-based IStream functions */
+ return NotImplemented;
+ /* TODO: add delegate-based function */
+}
+
+GpStatus
+GdipRecordMetafileStreamI (void /* IStream */ *stream, HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect,
+ MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile)
+{
+ /* note: we do not support the COM-based IStream functions */
+ return NotImplemented;
+ /* TODO: add delegate-based function */
+}
View
346 src/metafile.h
@@ -23,265 +23,29 @@
#ifndef __METAFILE_H__
#define __METAFILE_H__
-#include "gdiplus-private.h"
-#include "codecs-private.h"
-#include "bitmap-private.h"
-#include "bmpcodec.h"
-#include "emfcodec.h"
-#include "wmfcodec.h"
-
-/*
- * http://wvware.sourceforge.net/caolan/ora-wmf.html
- */
-
-/* definitions */
-
-#define ALDUS_PLACEABLE_METAFILE_KEY 0x9AC6CDD7
-#define WMF_TYPE_AND_HEADERSIZE_KEY 0x00090001
-#define EMF_EMR_HEADER_KEY 0x1
-
-/* this has to do with 25.4mm in an inch (but why is it multiplied by 100 ?) */
-#define METAFILE_DIMENSION_FACTOR 2540
-#define MM_PER_INCH 25.4f
-
-/* match System.Drawing.Imaging.MetafileType */
-#define METAFILETYPE_INVALID 0
-#define METAFILETYPE_WMF 1
-#define METAFILETYPE_WMFPLACEABLE 2
-#define METAFILETYPE_EMF 3
-#define METAFILETYPE_EMFPLUSONLY 4
-#define METAFILETYPE_EMFPLUSDUAL 5
-
-/* object types */
-#define METAOBJECT_TYPE_EMPTY 0
-#define METAOBJECT_TYPE_PEN 1
-#define METAOBJECT_TYPE_BRUSH 2
-
-/* SetBkMode */
-#define TRANSPARENT 1
-#define OPAQUE 2
-
-/* SetMapMode */
-#define MM_TEXT 1
-#define MM_LOMETRIC 2
-#define MM_HIMETRIC 3
-#define MM_LOENGLISH 4
-#define MM_HIENGLISH 5
-#define MM_TWIPS 6
-#define MM_ISOTROPIC 7
-#define MM_ANISOTROPIC 8
-
-/* CreatePenIndirect */
-#define PS_NULL 0x00000005
-#define PS_STYLE_MASK 0x0000000F
-#define PS_ENDCAP_ROUND 0x00000000
-#define PS_ENDCAP_SQUARE 0x00000100
-#define PS_ENDCAP_FLAT 0x00000200
-#define PS_ENDCAP_MASK 0x00000F00
-#define PS_JOIN_ROUND 0x00000000
-#define PS_JOIN_BEVEL 0x00001000
-#define PS_JOIN_MITER 0x00002000
-#define PS_JOIN_MASK 0x0000F000
-
-/* CreateBrushIndirect */
-#define BS_SOLID 0
-#define BS_NULL 1
-#define BS_HATCHED 2
-#define BS_PATTERN 3
-#define BS_INDEXED 4
-
-/* SetPolyFillMode */
-#define ALTERNATE 1
-#define WINDING 2
-
-/* SetRelabs */
-#define ABSOLUTE 1
-#define RELATIVE 2
-
-/* ModifyWorldTransform */
-#define MWT_IDENTITY 1
-#define MWT_LEFTMULTIPLY 2
-#define MWT_RIGHTMULTIPLY 3
-
-typedef struct {
- float eM11;
- float eM12;
- float eM21;
- float eM22;
- float eDx;
- float eDy;
-} XFORM;
-
-typedef struct {
- LONG x;
- LONG y;
-} POINT;
-
-typedef DWORD COLORREF;
-
-typedef struct {
- UINT lopnStyle;
- POINT lopnWidth;
- COLORREF lopnColor;
-} LOGPEN;
-
-typedef struct {
- UINT lbStyle;
- COLORREF lbColor;
- LONG lbHatch;
-} LOGBRUSH;
-
-typedef struct {
- int left;
- int top;
- int right;
- int bottom;
-} RECT, RECTL;
-
-typedef struct {
- int cx;
- int cy;
-} SIZE, SIZEL;
-
-typedef struct {
- SHORT Left;
- SHORT Top;
- SHORT Right;
- SHORT Bottom;
-} PWMFRect16;
-
-#ifndef __GNUC__
- #pragma pack(2)
-#endif
-
-typedef struct
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-{
- WORD mtType; /* 1 for disk, 0 for memory */
- WORD mtHeaderSize;
- WORD mtVersion;
- DWORD mtSize;
- WORD mtNoObjects;
- DWORD mtMaxRecord;
- WORD mtNoParameters;
-} METAHEADER;
-
-typedef struct
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-{
- DWORD Key;
- SHORT Hmf;
- PWMFRect16 BoundingBox;
- SHORT Inch;
- DWORD Reserved;
- SHORT Checksum;
-} WmfPlaceableFileHeader;
-
-#ifndef __GNUC__
- #pragma pack()
-#endif
-
-typedef struct {
- DWORD iType;
- DWORD nSize;
- RECTL rclBounds;
- RECTL rclFrame;
- DWORD dSignature;
- DWORD nVersion;
- DWORD nBytes;
- DWORD nRecords;
- WORD nHandles;
- WORD sReserved;
- DWORD nDescription;
- DWORD offDescription;
- DWORD nPalEntries;
- SIZEL szlDevice;
- SIZEL szlMillimeters;
-} ENHMETAHEADER3;
-
-typedef struct {
- int Type;
- int Size;
- int Version;
- int EmfPlusFlags;
- float DpiX;
- float DpiY;
- int X;
- int Y;
- int Width;
- int Height;
- union {
- METAHEADER WmfHeader;
- ENHMETAHEADER3 EmfHeader;
- };
- int EmfPlusHeaderSize;
- int LogicalDpiX;
- int LogicalDpiY;
-} MetafileHeader;
-
-typedef struct {
- void *ptr;
- int type;
-} MetaObject;
-
-typedef struct {
- GpImage base;
- MetafileHeader metafile_header;
- BOOL delete;
- BYTE *data;
- int length;
-} GpMetafile;
-
-typedef struct {
- GpMetafile *metafile;
- int x, y, width, height;
- int objects_count;
- MetaObject *objects;
- MetaObject created;
- GpGraphics *graphics;
- GpMatrix initial;
- GpMatrix matrix;
- DWORD bk_mode;
- DWORD bk_color;
- float miter_limit;
- int selected_pen;
- int selected_brush;
- int selected_font;
- int selected_palette;
- int map_mode;
- FillMode fill_mode;
- int current_x, current_y;
- /* path related data */
- BOOL use_path;
- GpPath *path;
- int path_x, path_y;
- /* stock objects */
- GpPen *stock_pen_white;
- GpPen *stock_pen_black;
- GpPen *stock_pen_null;
- GpSolidFill *stock_brush_white;
- GpSolidFill *stock_brush_ltgray;
- GpSolidFill *stock_brush_gray;
- GpSolidFill *stock_brush_dkgray;
- GpSolidFill *stock_brush_black;
- GpSolidFill *stock_brush_null;
- /* bitmap representation */
- BYTE *scan0;
-} MetafilePlayContext, HDC;
-
-typedef struct {
- int num;
- GpPointF *points;
-} PointFList;
+typedef enum {
+ MetafileTypeInvalid,
+ MetafileTypeWmf,
+ MetafileTypeWmfPlaceable,
+ MetafileTypeEmf,
+ MetafileTypeEmfPlusOnly,
+ MetafileTypeEmfPlusDual
+} MetafileType;
-typedef gpointer HMETAFILE;
-typedef gpointer HENHMETAFILE;
+typedef enum {
+ EmfTypeEmfOnly = MetafileTypeEmf,
+ EmfTypeEmfPlusOnly = MetafileTypeEmfPlusOnly,
+ EmfTypeEmfPlusDual = MetafileTypeEmfPlusDual
+} EmfType;
-#define GDIP_EMFPLUS_RECORD_BASE 16384
+typedef enum {
+ MetafileFrameUnitPixel = UnitPixel,
+ MetafileFrameUnitPoint = UnitPoint,
+ MetafileFrameUnitInch = UnitInch,
+ MetafileFrameUnitDocument = UnitDocument,
+ MetafileFrameUnitMillimeter = UnitMillimeter,
+ MetafileFrameUnitGdi
+} MetafileFrameUnit;
typedef enum {
EmfRecordTypeGdiComment = 70,
@@ -329,61 +93,17 @@ GpStatus GdipSetMetafileDownLevelRasterizationLimit (GpMetafile *metafile, UINT
GpStatus GdipPlayMetafileRecord (GDIPCONST GpMetafile *metafile, EmfPlusRecordType recordType, UINT flags, UINT dataSize, GDIPCONST BYTE* data);
-/* internal functions */
-
-#define gdip_get_metaheader(image) (&((GpMetafile*)image)->metafile_header)
-
-GpStatus gdip_get_metafile_from (void *pointer, GpMetafile **metafile, ImageSource source) GDIP_INTERNAL;
-GpStatus gdip_metafile_clone (GpMetafile *metafile, GpMetafile **clonedmetafile) GDIP_INTERNAL;
-GpStatus gdip_metafile_dispose (GpMetafile *metafile) GDIP_INTERNAL;
-
-GpStatus gdip_metafile_play_emf (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus gdip_metafile_play_wmf (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus gdip_metafile_play_emfplus_block (MetafilePlayContext *context, BYTE* data, int length) GDIP_INTERNAL;
-
-MetafilePlayContext* gdip_metafile_play_setup (GpMetafile *metafile, GpGraphics *graphics, int x, int y, int width,
- int height) GDIP_INTERNAL;
-GpStatus gdip_metafile_play (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus gdip_metafile_play_cleanup (MetafilePlayContext *context) GDIP_INTERNAL;
-
-GpPen* gdip_metafile_GetSelectedPen (MetafilePlayContext *context) GDIP_INTERNAL;
-GpBrush* gdip_metafile_GetSelectedBrush (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus GdiComment (MetafilePlayContext *context, BYTE* data, DWORD size) GDIP_INTERNAL;
-
-GpStatus gdip_metafile_SaveDC (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetBkMode (MetafilePlayContext *context, DWORD bkMode) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetMapMode (MetafilePlayContext *context, DWORD mode) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetROP2 (MetafilePlayContext *context, DWORD rop) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetRelabs (MetafilePlayContext *context, DWORD mode) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetPolyFillMode (MetafilePlayContext *context, DWORD mode) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetStretchBltMode (MetafilePlayContext *context, int iStretchMode) GDIP_INTERNAL;
-GpStatus gdip_metafile_RestoreDC (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus gdip_metafile_SelectObject (MetafilePlayContext *context, DWORD slot) GDIP_INTERNAL;
-GpStatus gdip_metafile_ModifyWorldTransform (MetafilePlayContext *context, XFORM *lpXform, DWORD iMode) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetTextAlign (MetafilePlayContext *context, DWORD textalign) GDIP_INTERNAL;
-GpStatus gdip_metafile_DeleteObject (MetafilePlayContext *context, DWORD slot) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetBkColor (MetafilePlayContext *context, DWORD color) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetWindowOrg (MetafilePlayContext *context, int x, int y) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetWindowExt (MetafilePlayContext *context, int height, int width) GDIP_INTERNAL;
-GpStatus gdip_metafile_LineTo (MetafilePlayContext *context, int x, int y) GDIP_INTERNAL;
-GpStatus gdip_metafile_MoveTo (MetafilePlayContext *context, int x, int y) GDIP_INTERNAL;
-GpStatus gdip_metafile_SetMiterLimit (MetafilePlayContext *context, float eNewLimit, float *peOldLimit) GDIP_INTERNAL;
-GpStatus gdip_metafile_CreatePenIndirect (MetafilePlayContext *context, DWORD style, DWORD width, DWORD color) GDIP_INTERNAL;
-GpStatus gdip_metafile_ExtCreatePen (MetafilePlayContext *context, DWORD dwPenStyle, DWORD dwWidth, CONST LOGBRUSH *lplb,
- DWORD dwStyleCount, CONST DWORD *lpStyle) GDIP_INTERNAL;
-GpStatus gdip_metafile_CreateBrushIndirect (MetafilePlayContext *context, DWORD style, DWORD color, DWORD hatch) GDIP_INTERNAL;
-GpStatus gdip_metafile_Arc (MetafilePlayContext *context, int left, int top, int right, int bottom,
- int xstart, int ystart, int xend, int yend) GDIP_INTERNAL;
-GpStatus gdip_metafile_StretchDIBits (MetafilePlayContext *context, int XDest, int YDest, int nDestWidth, int nDestHeight,
- int XSrc, int YSrc, int nSrcWidth, int nSrcHeight, CONST void *lpBits, CONST BITMAPINFO *lpBitsInfo,
- UINT iUsage, DWORD dwRop) GDIP_INTERNAL;
-GpStatus gdip_metafile_PolyBezier (MetafilePlayContext *context, GpPointF *points, int count) GDIP_INTERNAL;
-GpStatus gdip_metafile_Polygon (MetafilePlayContext *context, GpPointF *points, int count) GDIP_INTERNAL;
-GpStatus gdip_metafile_BeginPath (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus gdip_metafile_EndPath (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus gdip_metafile_CloseFigure (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus gdip_metafile_FillPath (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus gdip_metafile_StrokePath (MetafilePlayContext *context) GDIP_INTERNAL;
-GpStatus gdip_metafile_StrokeAndFillPath (MetafilePlayContext *context) GDIP_INTERNAL;
+GpStatus GdipRecordMetafile (HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit,
+ GDIPCONST WCHAR *description, GpMetafile **metafile);
+GpStatus GdipRecordMetafileI (HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit,
+ GDIPCONST WCHAR *description, GpMetafile **metafile);
+GpStatus GdipRecordMetafileFileName (GDIPCONST WCHAR *fileName, HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect,
+ MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile);
+GpStatus GdipRecordMetafileFileNameI (GDIPCONST WCHAR *fileName, HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect,
+ MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile);
+GpStatus GdipRecordMetafileStream (void /* IStream */ *stream, HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect,
+ MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile);
+GpStatus GdipRecordMetafileStreamI (void /* IStream */ *stream, HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect,
+ MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile);
#endif
View
181 src/win32structs.h
@@ -35,7 +35,53 @@
/* public enums and structures that GDI+ reuse from the other Windows API */
-#define LF_FACESIZE 32
+#define LF_FACESIZE 32
+
+/* SetBkMode */
+#define TRANSPARENT 1
+#define OPAQUE 2
+
+/* SetMapMode */
+#define MM_TEXT 1
+#define MM_LOMETRIC 2
+#define MM_HIMETRIC 3
+#define MM_LOENGLISH 4
+#define MM_HIENGLISH 5
+#define MM_TWIPS 6
+#define MM_ISOTROPIC 7
+#define MM_ANISOTROPIC 8
+
+/* CreatePenIndirect */
+#define PS_NULL 0x00000005
+#define PS_STYLE_MASK 0x0000000F
+#define PS_ENDCAP_ROUND 0x00000000
+#define PS_ENDCAP_SQUARE 0x00000100
+#define PS_ENDCAP_FLAT 0x00000200
+#define PS_ENDCAP_MASK 0x00000F00
+#define PS_JOIN_ROUND 0x00000000
+#define PS_JOIN_BEVEL 0x00001000
+#define PS_JOIN_MITER 0x00002000
+#define PS_JOIN_MASK 0x0000F000
+
+/* CreateBrushIndirect */
+#define BS_SOLID 0
+#define BS_NULL 1
+#define BS_HATCHED 2
+#define BS_PATTERN 3
+#define BS_INDEXED 4
+
+/* SetPolyFillMode */
+#define ALTERNATE 1
+#define WINDING 2
+
+/* SetRelabs */
+#define ABSOLUTE 1
+#define RELATIVE 2
+
+/* ModifyWorldTransform */
+#define MWT_IDENTITY 1
+#define MWT_LEFTMULTIPLY 2
+#define MWT_RIGHTMULTIPLY 3
typedef int LANGID;
typedef int INT;
@@ -47,11 +93,14 @@ typedef gint32 PROPID;
typedef guint32 ULONG_PTR; /* not a pointer! */
typedef float REAL;
-typedef void* HBITMAP;
-typedef void* HFONT;
-typedef void* HICON;
-typedef void* HPALETTE;
-typedef void* HINSTANCE;
+typedef gpointer HBITMAP;
+typedef gpointer HDC;
+typedef gpointer HENHMETAFILE;
+typedef gpointer HFONT;
+typedef gpointer HICON;
+typedef gpointer HINSTANCE;
+typedef gpointer HMETAFILE;
+typedef gpointer HPALETTE;
/* mono/io-layer/uglify.h also has these typedefs.
* To avoid a dependency on mono we have copied all
@@ -133,4 +182,124 @@ typedef struct {
WCHAR lfFaceName[LF_FACESIZE];
} LOGFONTW;
+typedef struct {
+ float eM11;
+ float eM12;
+ float eM21;
+ float eM22;
+ float eDx;
+ float eDy;
+} XFORM;
+
+typedef struct {
+ LONG x;
+ LONG y;
+} POINT;
+
+typedef DWORD COLORREF;
+
+typedef struct {
+ UINT lopnStyle;
+ POINT lopnWidth;
+ COLORREF lopnColor;
+} LOGPEN;
+
+typedef struct {
+ UINT lbStyle;
+ COLORREF lbColor;
+ LONG lbHatch;
+} LOGBRUSH;
+
+typedef struct {
+ int left;
+ int top;
+ int right;
+ int bottom;
+} RECT, RECTL;
+
+typedef struct {
+ int cx;
+ int cy;
+} SIZE, SIZEL;
+
+typedef struct {
+ SHORT Left;
+ SHORT Top;
+ SHORT Right;
+ SHORT Bottom;
+} PWMFRect16;
+
+#ifndef __GNUC__
+ #pragma pack(2)
+#endif
+
+typedef struct
+#ifdef __GNUC__
+ __attribute__ ((packed))
+#endif
+{
+ WORD mtType; /* 1 for disk, 0 for memory */
+ WORD mtHeaderSize;
+ WORD mtVersion;
+ DWORD mtSize;
+ WORD mtNoObjects;
+ DWORD mtMaxRecord;
+ WORD mtNoParameters;
+} METAHEADER;
+
+typedef struct
+#ifdef __GNUC__
+ __attribute__ ((packed))
+#endif
+{
+ DWORD Key;
+ SHORT Hmf;
+ PWMFRect16 BoundingBox;
+ SHORT Inch;
+ DWORD Reserved;
+ SHORT Checksum;
+} WmfPlaceableFileHeader;
+
+#ifndef __GNUC__
+ #pragma pack()
+#endif
+
+typedef struct {
+ DWORD iType;
+ DWORD nSize;
+ RECTL rclBounds;
+ RECTL rclFrame;
+ DWORD dSignature;
+ DWORD nVersion;
+ DWORD nBytes;
+ DWORD nRecords;
+ WORD nHandles;
+ WORD sReserved;
+ DWORD nDescription;
+ DWORD offDescription;
+ DWORD nPalEntries;
+ SIZEL szlDevice;
+ SIZEL szlMillimeters;
+} ENHMETAHEADER3;
+
+typedef struct {
+ int Type;
+ int Size;
+ int Version;
+ int EmfPlusFlags;
+ float DpiX;
+ float DpiY;
+ int X;
+ int Y;
+ int Width;
+ int Height;
+ union {
+ METAHEADER WmfHeader;
+ ENHMETAHEADER3 EmfHeader;
+ };
+ int EmfPlusHeaderSize;
+ int LogicalDpiX;
+ int LogicalDpiY;
+} MetafileHeader;
+
#endif
View
2 src/wmfcodec.h
@@ -25,7 +25,7 @@
#include "gdiplus-private.h"
#include "graphics-private.h"
-#include "metafile.h"
+#include "metafile-private.h"
#define WMF_MIN_RECORD_SIZE 6

0 comments on commit 3389967

Please sign in to comment.
Something went wrong with that request. Please try again.