From 586e63ef380335137c83c010b844560d7976d48b Mon Sep 17 00:00:00 2001 From: Evan Stade Date: Mon, 30 Jul 2007 19:09:57 -0700 Subject: [PATCH] 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 e440dba9a1b..c31de0ec113 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 2f582b2a953..7b19db00bc2 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 849b1b484ee..9b6ed419aa2 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)