diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 50d2f6b090..b09ca8ef4a 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -287,7 +287,7 @@ @ stub GdipGetImageEncoders @ stub GdipGetImageEncodersSize @ stub GdipGetImageFlags -@ stub GdipGetImageGraphicsContext +@ stdcall GdipGetImageGraphicsContext(ptr ptr) @ stdcall GdipGetImageHeight(ptr ptr) @ stdcall GdipGetImageHorizontalResolution(ptr ptr) @ stub GdipGetImageItemData diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index d8136780a5..d779907bef 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -384,9 +384,13 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromStreamICM(IStream* stream, GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image) { + HDC hdc; + if(!image) return InvalidParameter; + IPicture_get_CurDC(image->picture, &hdc); + DeleteDC(hdc); IPicture_Release(image->picture); GdipFree(image); @@ -429,6 +433,29 @@ GpStatus WINGDIPAPI GdipGetImageBounds(GpImage *image, GpRectF *srcRect, return Ok; } +GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, + GpGraphics **graphics) +{ + HDC hdc; + + if(!image || !graphics) + return InvalidParameter; + + if(image->type != ImageTypeBitmap){ + FIXME("not implemented for image type %d\n", image->type); + return NotImplemented; + } + + IPicture_get_CurDC(image->picture, &hdc); + + if(!hdc){ + hdc = CreateCompatibleDC(0); + IPicture_SelectPicture(image->picture, hdc, NULL, NULL); + } + + return GdipCreateFromHDC(hdc, graphics); +} + GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height) { if(!image || !height) diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 33d0e33ca1..b19049284e 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -192,6 +192,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromStream(IStream*,GpBitmap**); GpStatus WINGDIPAPI GdipCreateBitmapFromStreamICM(IStream*,GpBitmap**); GpStatus WINGDIPAPI GdipDisposeImage(GpImage*); GpStatus WINGDIPAPI GdipGetImageBounds(GpImage*,GpRectF*,GpUnit*); +GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage*,GpGraphics**); GpStatus WINGDIPAPI GdipGetImageHeight(GpImage*,UINT*); GpStatus WINGDIPAPI GdipGetImageHorizontalResolution(GpImage*,REAL*); GpStatus WINGDIPAPI GdipGetImagePixelFormat(GpImage*,PixelFormat*);