Evan Stade : gdiplus: Implemented GdipGetImageBounds for metafiles.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jul 31 07:54:49 CDT 2007
Module: wine
Branch: master
Commit: 586e63ef380335137c83c010b844560d7976d48b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=586e63ef380335137c83c010b844560d7976d48b
Author: Evan Stade <estade at gmail.com>
Date: Mon Jul 30 19:09:57 2007 -0700
gdiplus: Implemented GdipGetImageBounds for metafiles.
---
dlls/gdiplus/gdiplus_private.h | 2 ++
dlls/gdiplus/graphics.c | 8 ++++++++
dlls/gdiplus/image.c | 15 +++++++++------
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index e440dba..c31de0e 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -124,6 +124,8 @@ struct GpImage{
struct GpMetafile{
GpImage image;
+ GpRectF bounds;
+ GpUnit unit;
};
struct GpImageAttributes{
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 2f582b2..7b19db0 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -895,6 +895,14 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
}
(*metafile)->image.type = ImageTypeMetafile;
+ (*metafile)->bounds.X = ((REAL) placeable->BoundingBox.Left) / ((REAL) placeable->Inch);
+ (*metafile)->bounds.Y = ((REAL) placeable->BoundingBox.Right) / ((REAL) placeable->Inch);
+ (*metafile)->bounds.Width = ((REAL) (placeable->BoundingBox.Right
+ - placeable->BoundingBox.Left)) / ((REAL) placeable->Inch);
+ (*metafile)->bounds.Height = ((REAL) (placeable->BoundingBox.Bottom
+ - placeable->BoundingBox.Top)) / ((REAL) placeable->Inch);
+ (*metafile)->unit = UnitInch;
+
if(delete)
DeleteMetaFile(hwmf);
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 849b1b4..9b6ed41 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -45,15 +45,18 @@ GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
GpStatus WINGDIPAPI GdipGetImageBounds(GpImage *image, GpRectF *srcRect,
GpUnit *srcUnit)
{
- static int calls;
-
if(!image || !srcRect || !srcUnit)
return InvalidParameter;
+ if(image->type == ImageTypeMetafile){
+ memcpy(srcRect, &((GpMetafile*)image)->bounds, sizeof(GpRectF));
+ *srcUnit = ((GpMetafile*)image)->unit;
+ }
+ else{
+ FIXME("not implemented for bitmaps\n");
+ return NotImplemented;
+ }
- if(!(calls++))
- FIXME("not implemented\n");
-
- return NotImplemented;
+ return Ok;
}
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
More information about the wine-cvs
mailing list