From f30732fdf99d7bc0fb13d74ecf0ad6629a378d52 Mon Sep 17 00:00:00 2001 From: Evan Stade Date: Tue, 24 Jul 2007 17:18:47 -0700 Subject: [PATCH] gdiplus: Added GdipSetWorldTransform/GdipGetWorldTransform. --- dlls/gdiplus/gdiplus.spec | 4 ++-- dlls/gdiplus/gdiplus_private.h | 1 + dlls/gdiplus/graphics.c | 26 ++++++++++++++++++++++++++ include/gdiplusflat.h | 2 ++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index f13a72fd2da..49732dbee6a 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -386,7 +386,7 @@ @ stub GdipGetTextureWrapMode @ stub GdipGetVisibleClipBounds @ stub GdipGetVisibleClipBoundsI -@ stub GdipGetWorldTransform +@ stdcall GdipGetWorldTransform(ptr ptr) @ stub GdipGraphicsClear @ stub GdipImageForceValidation @ stub GdipImageGetFrameCount @@ -576,7 +576,7 @@ @ stub GdipSetTextRenderingHint @ stub GdipSetTextureTransform @ stub GdipSetTextureWrapMode -@ stub GdipSetWorldTransform +@ stdcall GdipSetWorldTransform(ptr ptr) @ stub GdipShearMatrix @ stdcall GdipStartPathFigure(ptr) @ stub GdipStringFormatGetGenericDefault diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 2e7fc2c1557..f8e79f0f8bb 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -67,6 +67,7 @@ struct GpGraphics{ PixelOffsetMode pixeloffset; GpUnit unit; /* page unit */ REAL scale; /* page scale */ + GpMatrix * worldtrans; /* world transform */ }; struct GpBrush{ diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 3ed99cae065..9daf0924bcf 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -734,6 +734,8 @@ end: GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics) { + GpStatus retval; + if(hdc == NULL) return OutOfMemory; @@ -743,6 +745,11 @@ GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics) *graphics = GdipAlloc(sizeof(GpGraphics)); if(!*graphics) return OutOfMemory; + if((retval = GdipCreateMatrix(&(*graphics)->worldtrans)) != Ok){ + GdipFree(*graphics); + return retval; + } + (*graphics)->hdc = hdc; (*graphics)->hwnd = NULL; (*graphics)->smoothing = SmoothingModeDefault; @@ -773,6 +780,7 @@ GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics) if(graphics->hwnd) ReleaseDC(graphics->hwnd, graphics->hdc); + GdipDeleteMatrix(graphics->worldtrans); HeapFree(GetProcessHeap(), 0, graphics); return Ok; @@ -1133,6 +1141,15 @@ GpStatus WINGDIPAPI GdipGetSmoothingMode(GpGraphics *graphics, SmoothingMode *mo return Ok; } +GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics *graphics, GpMatrix *matrix) +{ + if(!graphics || !matrix) + return InvalidParameter; + + memcpy(matrix, graphics->worldtrans, sizeof(GpMatrix)); + return Ok; +} + GpStatus WINGDIPAPI GdipRestoreGraphics(GpGraphics *graphics, GraphicsState state) { if(!graphics) @@ -1215,3 +1232,12 @@ GpStatus WINGDIPAPI GdipSetSmoothingMode(GpGraphics *graphics, SmoothingMode mod return Ok; } + +GpStatus WINGDIPAPI GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix) +{ + if(!graphics || !matrix) + return InvalidParameter; + + GdipDeleteMatrix(graphics->worldtrans); + return GdipCloneMatrix(matrix, &graphics->worldtrans); +} diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 94693eb2c20..11431953b51 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -66,6 +66,7 @@ GpStatus WINGDIPAPI GdipGetPageScale(GpGraphics*,REAL*); GpStatus WINGDIPAPI GdipGetPageUnit(GpGraphics*,GpUnit*); GpStatus WINGDIPAPI GdipGetPixelOffsetMode(GpGraphics*,PixelOffsetMode*); GpStatus WINGDIPAPI GdipGetSmoothingMode(GpGraphics*,SmoothingMode*); +GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics*,GpMatrix*); GpStatus WINGDIPAPI GdipRestoreGraphics(GpGraphics*,GraphicsState); GpStatus WINGDIPAPI GdipSaveGraphics(GpGraphics*,GraphicsState*); GpStatus WINGDIPAPI GdipSetCompositingQuality(GpGraphics*,CompositingQuality); @@ -74,6 +75,7 @@ GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics*,REAL); GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics*,GpUnit); GpStatus WINGDIPAPI GdipSetPixelOffsetMode(GpGraphics*,PixelOffsetMode); GpStatus WINGDIPAPI GdipSetSmoothingMode(GpGraphics*,SmoothingMode); +GpStatus WINGDIPAPI GdipSetWorldTransform(GpGraphics*,GpMatrix*); GpStatus WINGDIPAPI GdipCloneBrush(GpBrush*,GpBrush**); GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB,GpSolidFill**);