From 8cf5608089ad40f842ff8d518f428efebc95c517 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 25 Apr 2008 01:58:36 +0400 Subject: [PATCH] gdiplus: Implemented GdipDrawImageRect/GdipDrawImageRectI. --- dlls/gdiplus/gdiplus.spec | 4 ++-- dlls/gdiplus/graphics.c | 27 ++++++++++++++++++++++++++- include/gdiplusflat.h | 2 ++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 9fdd4be6bac..bdead36760c 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -181,8 +181,8 @@ @ stub GdipDrawImagePointsI @ stdcall GdipDrawImagePointsRect(ptr ptr ptr long long long long long long ptr ptr ptr) @ stub GdipDrawImagePointsRectI -@ stub GdipDrawImageRect -@ stub GdipDrawImageRectI +@ stdcall GdipDrawImageRect(ptr ptr long long long long) +@ stdcall GdipDrawImageRectI(ptr ptr long long long long) @ stdcall GdipDrawImageRectRect(ptr ptr long long long long long long long long long ptr long ptr) @ stdcall GdipDrawImageRectRectI(ptr ptr long long long long long long long long long ptr long ptr) @ stdcall GdipDrawLine(ptr ptr long long long long) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index ef57def4249..b8a2efade1d 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -1100,7 +1100,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData); - if(!graphics || !image || !points || !imageAttributes || count != 3) + if(!graphics || !image || !points || count != 3) return InvalidParameter; if(srcUnit == UnitInch) @@ -1177,6 +1177,31 @@ GpStatus WINGDIPAPI GdipDrawImageRectRectI(GpGraphics *graphics, GpImage *image, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData); } +GpStatus WINGDIPAPI GdipDrawImageRect(GpGraphics *graphics, GpImage *image, + REAL x, REAL y, REAL width, REAL height) +{ + RectF bounds; + GpUnit unit; + GpStatus ret; + + if(!graphics || !image) + return InvalidParameter; + + ret = GdipGetImageBounds(image, &bounds, &unit); + if(ret != Ok) + return ret; + + return GdipDrawImageRectRect(graphics, image, x, y, width, height, + bounds.X, bounds.Y, bounds.Width, bounds.Height, + unit, NULL, NULL, NULL); +} + +GpStatus WINGDIPAPI GdipDrawImageRectI(GpGraphics *graphics, GpImage *image, + INT x, INT y, INT width, INT height) +{ + return GdipDrawImageRect(graphics, image, (REAL)x, (REAL)y, (REAL)width, (REAL)height); +} + GpStatus WINGDIPAPI GdipDrawLine(GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, REAL x2, REAL y2) { diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index cd349ea0277..8df6c5b34ea 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -87,6 +87,8 @@ GpStatus WINGDIPAPI GdipDrawImageRectRect(GpGraphics*,GpImage*,REAL,REAL,REAL, GpStatus WINGDIPAPI GdipDrawImageRectRectI(GpGraphics*,GpImage*,INT,INT,INT, INT,INT,INT,INT,INT,GpUnit,GDIPCONST GpImageAttributes*,DrawImageAbort, VOID*); +GpStatus WINGDIPAPI GdipDrawImageRect(GpGraphics*,GpImage*,REAL,REAL,REAL,REAL); +GpStatus WINGDIPAPI GdipDrawImageRectI(GpGraphics*,GpImage*,INT,INT,INT,INT); GpStatus WINGDIPAPI GdipDrawLine(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL); GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics*,GpPen*,INT,INT,INT,INT); GpStatus WINGDIPAPI GdipDrawLines(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT); -- 2.11.4.GIT