2 * Copyright (C) 2007 Google (Evan Stade)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define NONAMELESSUNION
35 #include "gdiplus_private.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus
);
40 #define PIXELFORMATBPP(x) ((x) ? ((x) >> 8) & 255 : 24)
42 static INT
ipicture_pixel_height(IPicture
*pic
)
47 IPicture_get_Height(pic
, &y
);
51 y
= MulDiv(y
, GetDeviceCaps(hdcref
, LOGPIXELSY
), INCH_HIMETRIC
);
57 static INT
ipicture_pixel_width(IPicture
*pic
)
62 IPicture_get_Width(pic
, &x
);
66 x
= MulDiv(x
, GetDeviceCaps(hdcref
, LOGPIXELSX
), INCH_HIMETRIC
);
73 GpStatus WINGDIPAPI
GdipBitmapApplyEffect(GpBitmap
* bitmap
, CGpEffect
* effect
,
74 RECT
* roi
, BOOL useAuxData
, VOID
** auxData
, INT
* auxDataSize
)
76 FIXME("(%p %p %p %d %p %p): stub\n", bitmap
, effect
, roi
, useAuxData
, auxData
, auxDataSize
);
78 * Note: According to Jose Roca's GDI+ docs, this function is not
79 * implemented in Windows's GDI+.
81 return NotImplemented
;
84 GpStatus WINGDIPAPI
GdipBitmapCreateApplyEffect(GpBitmap
** inputBitmaps
,
85 INT numInputs
, CGpEffect
* effect
, RECT
* roi
, RECT
* outputRect
,
86 GpBitmap
** outputBitmap
, BOOL useAuxData
, VOID
** auxData
, INT
* auxDataSize
)
88 FIXME("(%p %d %p %p %p %p %d %p %p): stub\n", inputBitmaps
, numInputs
, effect
, roi
, outputRect
, outputBitmap
, useAuxData
, auxData
, auxDataSize
);
90 * Note: According to Jose Roca's GDI+ docs, this function is not
91 * implemented in Windows's GDI+.
93 return NotImplemented
;
96 GpStatus WINGDIPAPI
GdipBitmapGetPixel(GpBitmap
* bitmap
, INT x
, INT y
,
100 TRACE("%p %d %d %p\n", bitmap
, x
, y
, color
);
102 if(!bitmap
|| !color
)
103 return InvalidParameter
;
106 FIXME("not implemented\n");
110 return NotImplemented
;
113 GpStatus WINGDIPAPI
GdipBitmapSetPixel(GpBitmap
* bitmap
, INT x
, INT y
,
117 TRACE("bitmap:%p, x:%d, y:%d, color:%08x\n", bitmap
, x
, y
, color
);
120 return InvalidParameter
;
123 FIXME("not implemented\n");
125 return NotImplemented
;
128 /* This function returns a pointer to an array of pixels that represents the
129 * bitmap. The *entire* bitmap is locked according to the lock mode specified by
130 * flags. It is correct behavior that a user who calls this function with write
131 * privileges can write to the whole bitmap (not just the area in rect).
133 * FIXME: only used portion of format is bits per pixel. */
134 GpStatus WINGDIPAPI
GdipBitmapLockBits(GpBitmap
* bitmap
, GDIPCONST GpRect
* rect
,
135 UINT flags
, PixelFormat format
, BitmapData
* lockeddata
)
138 INT stride
, bitspp
= PIXELFORMATBPP(format
);
140 HBITMAP hbm
, old
= NULL
;
144 GpRect act_rect
; /* actual rect to be used */
146 TRACE("%p %p %d %d %p\n", bitmap
, rect
, flags
, format
, lockeddata
);
148 if(!lockeddata
|| !bitmap
)
149 return InvalidParameter
;
152 if(rect
->X
< 0 || rect
->Y
< 0 || (rect
->X
+ rect
->Width
> bitmap
->width
) ||
153 (rect
->Y
+ rect
->Height
> bitmap
->height
) || !flags
)
154 return InvalidParameter
;
159 act_rect
.X
= act_rect
.Y
= 0;
160 act_rect
.Width
= bitmap
->width
;
161 act_rect
.Height
= bitmap
->height
;
164 if(flags
& ImageLockModeUserInputBuf
)
165 return NotImplemented
;
170 IPicture_get_Handle(bitmap
->image
.picture
, (OLE_HANDLE
*)&hbm
);
171 IPicture_get_CurDC(bitmap
->image
.picture
, &hdc
);
172 bm_is_selected
= (hdc
!= 0);
174 pbmi
= GdipAlloc(sizeof(BITMAPINFOHEADER
) + 256 * sizeof(RGBQUAD
));
177 pbmi
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
178 pbmi
->bmiHeader
.biBitCount
= 0;
181 hdc
= CreateCompatibleDC(0);
182 old
= SelectObject(hdc
, hbm
);
186 GetDIBits(hdc
, hbm
, 0, 0, NULL
, pbmi
, DIB_RGB_COLORS
);
188 abs_height
= abs(pbmi
->bmiHeader
.biHeight
);
189 stride
= pbmi
->bmiHeader
.biWidth
* bitspp
/ 8;
190 stride
= (stride
+ 3) & ~3;
192 buff
= GdipAlloc(stride
* abs_height
);
194 pbmi
->bmiHeader
.biBitCount
= bitspp
;
197 GetDIBits(hdc
, hbm
, 0, abs_height
, buff
, pbmi
, DIB_RGB_COLORS
);
200 SelectObject(hdc
, old
);
209 lockeddata
->Width
= act_rect
.Width
;
210 lockeddata
->Height
= act_rect
.Height
;
211 lockeddata
->PixelFormat
= format
;
212 lockeddata
->Reserved
= flags
;
214 if(pbmi
->bmiHeader
.biHeight
> 0){
215 lockeddata
->Stride
= -stride
;
216 lockeddata
->Scan0
= buff
+ (bitspp
/ 8) * act_rect
.X
+
217 stride
* (abs_height
- 1 - act_rect
.Y
);
220 lockeddata
->Stride
= stride
;
221 lockeddata
->Scan0
= buff
+ (bitspp
/ 8) * act_rect
.X
+ stride
* act_rect
.Y
;
224 bitmap
->lockmode
= flags
;
227 bitmap
->bitmapbits
= buff
;
233 GpStatus WINGDIPAPI
GdipBitmapSetResolution(GpBitmap
* bitmap
, REAL xdpi
, REAL ydpi
)
235 FIXME("(%p, %.2f, %.2f)\n", bitmap
, xdpi
, ydpi
);
237 return NotImplemented
;
240 GpStatus WINGDIPAPI
GdipBitmapUnlockBits(GpBitmap
* bitmap
,
241 BitmapData
* lockeddata
)
244 HBITMAP hbm
, old
= NULL
;
248 if(!bitmap
|| !lockeddata
)
249 return InvalidParameter
;
251 if(!bitmap
->lockmode
)
254 if(lockeddata
->Reserved
& ImageLockModeUserInputBuf
)
255 return NotImplemented
;
257 if(lockeddata
->Reserved
& ImageLockModeRead
){
258 if(!(--bitmap
->numlocks
))
259 bitmap
->lockmode
= 0;
261 GdipFree(bitmap
->bitmapbits
);
262 bitmap
->bitmapbits
= NULL
;
266 IPicture_get_Handle(bitmap
->image
.picture
, (OLE_HANDLE
*)&hbm
);
267 IPicture_get_CurDC(bitmap
->image
.picture
, &hdc
);
268 bm_is_selected
= (hdc
!= 0);
270 pbmi
= GdipAlloc(sizeof(BITMAPINFOHEADER
) + 256 * sizeof(RGBQUAD
));
271 pbmi
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
272 pbmi
->bmiHeader
.biBitCount
= 0;
275 hdc
= CreateCompatibleDC(0);
276 old
= SelectObject(hdc
, hbm
);
279 GetDIBits(hdc
, hbm
, 0, 0, NULL
, pbmi
, DIB_RGB_COLORS
);
280 pbmi
->bmiHeader
.biBitCount
= PIXELFORMATBPP(lockeddata
->PixelFormat
);
281 SetDIBits(hdc
, hbm
, 0, abs(pbmi
->bmiHeader
.biHeight
),
282 bitmap
->bitmapbits
, pbmi
, DIB_RGB_COLORS
);
285 SelectObject(hdc
, old
);
290 GdipFree(bitmap
->bitmapbits
);
291 bitmap
->bitmapbits
= NULL
;
292 bitmap
->lockmode
= 0;
297 GpStatus WINGDIPAPI
GdipCloneBitmapArea(REAL x
, REAL y
, REAL width
, REAL height
,
298 PixelFormat format
, GpBitmap
* srcBitmap
, GpBitmap
** dstBitmap
)
300 FIXME("(%f,%f,%f,%f,%i,%p,%p): stub\n", x
, y
, width
, height
, format
, srcBitmap
, dstBitmap
);
302 return NotImplemented
;
305 GpStatus WINGDIPAPI
GdipCloneBitmapAreaI(INT x
, INT y
, INT width
, INT height
,
306 PixelFormat format
, GpBitmap
* srcBitmap
, GpBitmap
** dstBitmap
)
308 FIXME("(%i,%i,%i,%i,%i,%p,%p): stub\n", x
, y
, width
, height
, format
, srcBitmap
, dstBitmap
);
310 return NotImplemented
;
313 GpStatus WINGDIPAPI
GdipCloneImage(GpImage
*image
, GpImage
**cloneImage
)
319 GpStatus stat
= GenericError
;
321 TRACE("%p, %p\n", image
, cloneImage
);
323 if (!image
|| !cloneImage
)
324 return InvalidParameter
;
326 hr
= CreateStreamOnHGlobal(0, TRUE
, &stream
);
330 hr
= IPicture_SaveAsFile(image
->picture
, stream
, FALSE
, &size
);
333 WARN("Failed to save image on stream\n");
337 /* Set seek pointer back to the beginning of the picture */
339 hr
= IStream_Seek(stream
, move
, STREAM_SEEK_SET
, NULL
);
343 stat
= GdipLoadImageFromStream(stream
, cloneImage
);
344 if (stat
!= Ok
) WARN("Failed to load image from stream\n");
347 IStream_Release(stream
);
351 GpStatus WINGDIPAPI
GdipCreateBitmapFromFile(GDIPCONST WCHAR
* filename
,
357 TRACE("(%s) %p\n", debugstr_w(filename
), bitmap
);
359 if(!filename
|| !bitmap
)
360 return InvalidParameter
;
362 stat
= GdipCreateStreamOnFile(filename
, GENERIC_READ
, &stream
);
367 stat
= GdipCreateBitmapFromStream(stream
, bitmap
);
369 IStream_Release(stream
);
374 GpStatus WINGDIPAPI
GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO
* info
,
375 VOID
*bits
, GpBitmap
**bitmap
)
377 DWORD height
, stride
;
380 FIXME("(%p, %p, %p) - partially implemented\n", info
, bits
, bitmap
);
382 height
= abs(info
->bmiHeader
.biHeight
);
383 stride
= ((info
->bmiHeader
.biWidth
* info
->bmiHeader
.biBitCount
+ 31) >> 3) & ~3;
385 if(info
->bmiHeader
.biHeight
> 0) /* bottom-up */
387 bits
= (BYTE
*)bits
+ (height
- 1) * stride
;
391 switch(info
->bmiHeader
.biBitCount
) {
393 format
= PixelFormat1bppIndexed
;
396 format
= PixelFormat4bppIndexed
;
399 format
= PixelFormat8bppIndexed
;
402 format
= PixelFormat24bppRGB
;
405 FIXME("don't know how to handle %d bpp\n", info
->bmiHeader
.biBitCount
);
407 return InvalidParameter
;
410 return GdipCreateBitmapFromScan0(info
->bmiHeader
.biWidth
, height
, stride
, format
,
416 GpStatus WINGDIPAPI
GdipCreateBitmapFromFileICM(GDIPCONST WCHAR
* filename
,
419 TRACE("(%s) %p\n", debugstr_w(filename
), bitmap
);
421 return GdipCreateBitmapFromFile(filename
, bitmap
);
424 GpStatus WINGDIPAPI
GdipCreateBitmapFromResource(HINSTANCE hInstance
,
425 GDIPCONST WCHAR
* lpBitmapName
, GpBitmap
** bitmap
)
428 GpStatus stat
= InvalidParameter
;
430 TRACE("%p (%s) %p\n", hInstance
, debugstr_w(lpBitmapName
), bitmap
);
432 if(!lpBitmapName
|| !bitmap
)
433 return InvalidParameter
;
436 hbm
= LoadImageW(hInstance
, lpBitmapName
, IMAGE_BITMAP
, 0, 0,
437 LR_CREATEDIBSECTION
);
440 stat
= GdipCreateBitmapFromHBITMAP(hbm
, NULL
, bitmap
);
447 GpStatus WINGDIPAPI
GdipCreateHBITMAPFromBitmap(GpBitmap
* bitmap
,
448 HBITMAP
* hbmReturn
, ARGB background
)
452 if (hbmReturn
) *hbmReturn
= NULL
;
454 return NotImplemented
;
457 GpStatus WINGDIPAPI
GdipConvertToEmfPlus(const GpGraphics
* ref
,
458 GpMetafile
* metafile
, BOOL
* succ
, EmfType emfType
,
459 const WCHAR
* description
, GpMetafile
** out_metafile
)
463 if(!ref
|| !metafile
|| !out_metafile
)
464 return InvalidParameter
;
467 *out_metafile
= NULL
;
470 FIXME("not implemented\n");
472 return NotImplemented
;
475 /* FIXME: this should create a bitmap in the given size with the attributes
476 * (resolution etc.) of the graphics object */
477 GpStatus WINGDIPAPI
GdipCreateBitmapFromGraphics(INT width
, INT height
,
478 GpGraphics
* target
, GpBitmap
** bitmap
)
483 if(!target
|| !bitmap
)
484 return InvalidParameter
;
487 FIXME("hacked stub\n");
489 ret
= GdipCreateBitmapFromScan0(width
, height
, 0, PixelFormat24bppRGB
,
495 GpStatus WINGDIPAPI
GdipCreateBitmapFromHICON(HICON hicon
, GpBitmap
** bitmap
)
501 TRACE("%p, %p\n", hicon
, bitmap
);
503 if(!bitmap
|| !GetIconInfo(hicon
, &iinfo
))
504 return InvalidParameter
;
506 *bitmap
= GdipAlloc(sizeof(GpBitmap
));
507 if(!*bitmap
) return OutOfMemory
;
509 icon_copy
= CreateIconIndirect(&iinfo
);
513 return InvalidParameter
;
516 desc
.cbSizeofstruct
= sizeof(PICTDESC
);
517 desc
.picType
= PICTYPE_ICON
;
518 desc
.u
.icon
.hicon
= icon_copy
;
520 if(OleCreatePictureIndirect(&desc
, &IID_IPicture
, TRUE
,
521 (LPVOID
*) &((*bitmap
)->image
.picture
)) != S_OK
){
522 DestroyIcon(icon_copy
);
527 (*bitmap
)->format
= PixelFormat32bppARGB
;
528 (*bitmap
)->image
.type
= ImageTypeBitmap
;
529 (*bitmap
)->image
.flags
= ImageFlagsNone
;
530 (*bitmap
)->width
= ipicture_pixel_width((*bitmap
)->image
.picture
);
531 (*bitmap
)->height
= ipicture_pixel_height((*bitmap
)->image
.picture
);
533 DeleteObject(iinfo
.hbmColor
);
534 DeleteObject(iinfo
.hbmMask
);
539 GpStatus WINGDIPAPI
GdipCreateBitmapFromScan0(INT width
, INT height
, INT stride
,
540 PixelFormat format
, BYTE
* scan0
, GpBitmap
** bitmap
)
542 BITMAPFILEHEADER
*bmfh
;
543 BITMAPINFOHEADER
*bmih
;
548 TRACE("%d %d %d %d %p %p\n", width
, height
, stride
, format
, scan0
, bitmap
);
550 if (!bitmap
) return InvalidParameter
;
552 if(width
<= 0 || height
<= 0 || (scan0
&& (stride
% 4))){
554 return InvalidParameter
;
558 return InvalidParameter
;
560 *bitmap
= GdipAlloc(sizeof(GpBitmap
));
561 if(!*bitmap
) return OutOfMemory
;
564 stride
= width
* (PIXELFORMATBPP(format
) / 8);
565 stride
= (stride
+ 3) & ~3;
568 datalen
= abs(stride
* height
);
569 size
= sizeof(BITMAPFILEHEADER
) + sizeof(BITMAPINFOHEADER
) + datalen
;
570 buff
= GdipAlloc(size
);
576 bmfh
= (BITMAPFILEHEADER
*) buff
;
577 bmih
= (BITMAPINFOHEADER
*) (bmfh
+ 1);
579 bmfh
->bfType
= (((WORD
)'M') << 8) + (WORD
)'B';
581 bmfh
->bfOffBits
= size
- datalen
;
583 bmih
->biSize
= sizeof(BITMAPINFOHEADER
);
584 bmih
->biWidth
= width
;
585 /* FIXME: use the rest of the data from format */
586 bmih
->biBitCount
= PIXELFORMATBPP(format
);
587 bmih
->biCompression
= BI_RGB
;
588 bmih
->biSizeImage
= datalen
;
594 bmih
->biHeight
= -height
;
595 memcpy(bmih
+ 1, scan0
, datalen
);
599 bmih
->biHeight
= height
;
600 memcpy(bmih
+ 1, scan0
+ stride
* (height
- 1), datalen
);
605 bmih
->biHeight
= height
;
606 memset(bmih
+ 1, 0, datalen
);
609 if(CreateStreamOnHGlobal(buff
, TRUE
, &stream
) != S_OK
){
610 ERR("could not make stream\n");
617 if(OleLoadPicture(stream
, 0, FALSE
, &IID_IPicture
,
618 (LPVOID
*) &((*bitmap
)->image
.picture
)) != S_OK
){
619 TRACE("Could not load picture\n");
620 IStream_Release(stream
);
627 (*bitmap
)->image
.type
= ImageTypeBitmap
;
628 (*bitmap
)->image
.flags
= ImageFlagsNone
;
629 (*bitmap
)->width
= width
;
630 (*bitmap
)->height
= height
;
631 (*bitmap
)->format
= format
;
636 GpStatus WINGDIPAPI
GdipCreateBitmapFromStream(IStream
* stream
,
641 TRACE("%p %p\n", stream
, bitmap
);
643 stat
= GdipLoadImageFromStream(stream
, (GpImage
**) bitmap
);
648 if((*bitmap
)->image
.type
!= ImageTypeBitmap
){
649 IPicture_Release((*bitmap
)->image
.picture
);
651 return GenericError
; /* FIXME: what error to return? */
658 GpStatus WINGDIPAPI
GdipCreateBitmapFromStreamICM(IStream
* stream
,
661 TRACE("%p %p\n", stream
, bitmap
);
663 return GdipCreateBitmapFromStream(stream
, bitmap
);
666 GpStatus WINGDIPAPI
GdipCreateCachedBitmap(GpBitmap
*bitmap
, GpGraphics
*graphics
,
667 GpCachedBitmap
**cachedbmp
)
671 TRACE("%p %p %p\n", bitmap
, graphics
, cachedbmp
);
673 if(!bitmap
|| !graphics
|| !cachedbmp
)
674 return InvalidParameter
;
676 *cachedbmp
= GdipAlloc(sizeof(GpCachedBitmap
));
680 stat
= GdipCloneImage(&(bitmap
->image
), &(*cachedbmp
)->image
);
682 GdipFree(*cachedbmp
);
689 GpStatus WINGDIPAPI
GdipCreateHICONFromBitmap(GpBitmap
*bitmap
, HICON
*hicon
)
691 FIXME("(%p, %p)\n", bitmap
, hicon
);
693 return NotImplemented
;
696 GpStatus WINGDIPAPI
GdipDeleteCachedBitmap(GpCachedBitmap
*cachedbmp
)
698 TRACE("%p\n", cachedbmp
);
701 return InvalidParameter
;
703 GdipDisposeImage(cachedbmp
->image
);
709 GpStatus WINGDIPAPI
GdipDrawCachedBitmap(GpGraphics
*graphics
,
710 GpCachedBitmap
*cachedbmp
, INT x
, INT y
)
712 TRACE("%p %p %d %d\n", graphics
, cachedbmp
, x
, y
);
714 if(!graphics
|| !cachedbmp
)
715 return InvalidParameter
;
717 return GdipDrawImage(graphics
, cachedbmp
->image
, (REAL
)x
, (REAL
)y
);
720 GpStatus WINGDIPAPI
GdipEmfToWmfBits(HENHMETAFILE hemf
, UINT cbData16
,
721 LPBYTE pData16
, INT iMapMode
, INT eFlags
)
723 FIXME("(%p, %d, %p, %d, %d): stub\n", hemf
, cbData16
, pData16
, iMapMode
, eFlags
);
724 return NotImplemented
;
727 GpStatus WINGDIPAPI
GdipDisposeImage(GpImage
*image
)
731 TRACE("%p\n", image
);
734 return InvalidParameter
;
736 IPicture_get_CurDC(image
->picture
, &hdc
);
738 IPicture_Release(image
->picture
);
739 if (image
->type
== ImageTypeBitmap
)
740 GdipFree(((GpBitmap
*)image
)->bitmapbits
);
746 GpStatus WINGDIPAPI
GdipFindFirstImageItem(GpImage
*image
, ImageItemData
* item
)
749 return InvalidParameter
;
751 return NotImplemented
;
754 GpStatus WINGDIPAPI
GdipGetImageBounds(GpImage
*image
, GpRectF
*srcRect
,
757 TRACE("%p %p %p\n", image
, srcRect
, srcUnit
);
759 if(!image
|| !srcRect
|| !srcUnit
)
760 return InvalidParameter
;
761 if(image
->type
== ImageTypeMetafile
){
762 *srcRect
= ((GpMetafile
*)image
)->bounds
;
763 *srcUnit
= ((GpMetafile
*)image
)->unit
;
765 else if(image
->type
== ImageTypeBitmap
){
766 srcRect
->X
= srcRect
->Y
= 0.0;
767 srcRect
->Width
= (REAL
) ((GpBitmap
*)image
)->width
;
768 srcRect
->Height
= (REAL
) ((GpBitmap
*)image
)->height
;
769 *srcUnit
= UnitPixel
;
772 srcRect
->X
= srcRect
->Y
= 0.0;
773 srcRect
->Width
= ipicture_pixel_width(image
->picture
);
774 srcRect
->Height
= ipicture_pixel_height(image
->picture
);
775 *srcUnit
= UnitPixel
;
778 TRACE("returning (%f, %f) (%f, %f) unit type %d\n", srcRect
->X
, srcRect
->Y
,
779 srcRect
->Width
, srcRect
->Height
, *srcUnit
);
784 GpStatus WINGDIPAPI
GdipGetImageDimension(GpImage
*image
, REAL
*width
,
787 TRACE("%p %p %p\n", image
, width
, height
);
789 if(!image
|| !height
|| !width
)
790 return InvalidParameter
;
792 if(image
->type
== ImageTypeMetafile
){
795 *height
= convert_unit(hdc
, ((GpMetafile
*)image
)->unit
) *
796 ((GpMetafile
*)image
)->bounds
.Height
;
798 *width
= convert_unit(hdc
, ((GpMetafile
*)image
)->unit
) *
799 ((GpMetafile
*)image
)->bounds
.Width
;
804 else if(image
->type
== ImageTypeBitmap
){
805 *height
= ((GpBitmap
*)image
)->height
;
806 *width
= ((GpBitmap
*)image
)->width
;
809 *height
= ipicture_pixel_height(image
->picture
);
810 *width
= ipicture_pixel_width(image
->picture
);
813 TRACE("returning (%f, %f)\n", *height
, *width
);
817 GpStatus WINGDIPAPI
GdipGetImageGraphicsContext(GpImage
*image
,
818 GpGraphics
**graphics
)
822 TRACE("%p %p\n", image
, graphics
);
824 if(!image
|| !graphics
)
825 return InvalidParameter
;
827 if(image
->type
!= ImageTypeBitmap
){
828 FIXME("not implemented for image type %d\n", image
->type
);
829 return NotImplemented
;
832 IPicture_get_CurDC(image
->picture
, &hdc
);
835 hdc
= CreateCompatibleDC(0);
836 IPicture_SelectPicture(image
->picture
, hdc
, NULL
, NULL
);
839 return GdipCreateFromHDC(hdc
, graphics
);
842 GpStatus WINGDIPAPI
GdipGetImageHeight(GpImage
*image
, UINT
*height
)
844 TRACE("%p %p\n", image
, height
);
846 if(!image
|| !height
)
847 return InvalidParameter
;
849 if(image
->type
== ImageTypeMetafile
){
852 *height
= roundr(convert_unit(hdc
, ((GpMetafile
*)image
)->unit
) *
853 ((GpMetafile
*)image
)->bounds
.Height
);
857 else if(image
->type
== ImageTypeBitmap
)
858 *height
= ((GpBitmap
*)image
)->height
;
860 *height
= ipicture_pixel_height(image
->picture
);
862 TRACE("returning %d\n", *height
);
867 GpStatus WINGDIPAPI
GdipGetImageHorizontalResolution(GpImage
*image
, REAL
*res
)
872 return InvalidParameter
;
875 FIXME("not implemented\n");
877 return NotImplemented
;
880 GpStatus WINGDIPAPI
GdipGetImagePaletteSize(GpImage
*image
, INT
*size
)
882 FIXME("%p %p\n", image
, size
);
885 return InvalidParameter
;
887 return NotImplemented
;
890 /* FIXME: test this function for non-bitmap types */
891 GpStatus WINGDIPAPI
GdipGetImagePixelFormat(GpImage
*image
, PixelFormat
*format
)
893 TRACE("%p %p\n", image
, format
);
895 if(!image
|| !format
)
896 return InvalidParameter
;
898 if(image
->type
!= ImageTypeBitmap
)
899 *format
= PixelFormat24bppRGB
;
901 *format
= ((GpBitmap
*) image
)->format
;
906 GpStatus WINGDIPAPI
GdipGetImageRawFormat(GpImage
*image
, GUID
*format
)
910 if(!image
|| !format
)
911 return InvalidParameter
;
916 /* FIXME: should be detected from embedded picture or stored separately */
919 case ImageTypeBitmap
: *format
= ImageFormatBMP
; break;
920 case ImageTypeMetafile
: *format
= ImageFormatEMF
; break;
922 WARN("unknown type %u\n", image
->type
);
923 *format
= ImageFormatUndefined
;
928 GpStatus WINGDIPAPI
GdipGetImageType(GpImage
*image
, ImageType
*type
)
930 TRACE("%p %p\n", image
, type
);
933 return InvalidParameter
;
940 GpStatus WINGDIPAPI
GdipGetImageVerticalResolution(GpImage
*image
, REAL
*res
)
945 return InvalidParameter
;
948 FIXME("not implemented\n");
950 return NotImplemented
;
953 GpStatus WINGDIPAPI
GdipGetImageWidth(GpImage
*image
, UINT
*width
)
955 TRACE("%p %p\n", image
, width
);
958 return InvalidParameter
;
960 if(image
->type
== ImageTypeMetafile
){
963 *width
= roundr(convert_unit(hdc
, ((GpMetafile
*)image
)->unit
) *
964 ((GpMetafile
*)image
)->bounds
.Width
);
968 else if(image
->type
== ImageTypeBitmap
)
969 *width
= ((GpBitmap
*)image
)->width
;
971 *width
= ipicture_pixel_width(image
->picture
);
973 TRACE("returning %d\n", *width
);
978 GpStatus WINGDIPAPI
GdipGetMetafileHeaderFromMetafile(GpMetafile
* metafile
,
979 MetafileHeader
* header
)
983 if(!metafile
|| !header
)
984 return InvalidParameter
;
987 FIXME("not implemented\n");
992 GpStatus WINGDIPAPI
GdipGetAllPropertyItems(GpImage
*image
, UINT size
,
993 UINT num
, PropertyItem
* items
)
998 FIXME("not implemented\n");
1000 return InvalidParameter
;
1003 GpStatus WINGDIPAPI
GdipGetPropertyCount(GpImage
*image
, UINT
* num
)
1008 FIXME("not implemented\n");
1010 return InvalidParameter
;
1013 GpStatus WINGDIPAPI
GdipGetPropertyIdList(GpImage
*image
, UINT num
, PROPID
* list
)
1018 FIXME("not implemented\n");
1020 return InvalidParameter
;
1023 GpStatus WINGDIPAPI
GdipGetPropertyItem(GpImage
*image
, PROPID id
, UINT size
,
1024 PropertyItem
* buffer
)
1029 FIXME("not implemented\n");
1031 return InvalidParameter
;
1034 GpStatus WINGDIPAPI
GdipGetPropertyItemSize(GpImage
*image
, PROPID pid
,
1039 TRACE("%p %x %p\n", image
, pid
, size
);
1042 return InvalidParameter
;
1045 FIXME("not implemented\n");
1047 return NotImplemented
;
1050 GpStatus WINGDIPAPI
GdipGetPropertySize(GpImage
*image
, UINT
* size
, UINT
* num
)
1055 FIXME("not implemented\n");
1057 return InvalidParameter
;
1060 GpStatus WINGDIPAPI
GdipImageGetFrameCount(GpImage
*image
,
1061 GDIPCONST GUID
* dimensionID
, UINT
* count
)
1065 if(!image
|| !dimensionID
|| !count
)
1066 return InvalidParameter
;
1069 FIXME("not implemented\n");
1071 return NotImplemented
;
1074 GpStatus WINGDIPAPI
GdipImageGetFrameDimensionsCount(GpImage
*image
,
1077 if(!image
|| !count
)
1078 return InvalidParameter
;
1087 GpStatus WINGDIPAPI
GdipImageGetFrameDimensionsList(GpImage
* image
,
1088 GUID
* dimensionIDs
, UINT count
)
1092 if(!image
|| !dimensionIDs
)
1093 return InvalidParameter
;
1096 FIXME("not implemented\n");
1101 GpStatus WINGDIPAPI
GdipImageSelectActiveFrame(GpImage
*image
,
1102 GDIPCONST GUID
* dimensionID
, UINT frameidx
)
1106 if(!image
|| !dimensionID
)
1107 return InvalidParameter
;
1110 FIXME("not implemented\n");
1115 GpStatus WINGDIPAPI
GdipLoadImageFromFile(GDIPCONST WCHAR
* filename
,
1121 TRACE("(%s) %p\n", debugstr_w(filename
), image
);
1123 if (!filename
|| !image
)
1124 return InvalidParameter
;
1126 stat
= GdipCreateStreamOnFile(filename
, GENERIC_READ
, &stream
);
1131 stat
= GdipLoadImageFromStream(stream
, image
);
1133 IStream_Release(stream
);
1138 /* FIXME: no icm handling */
1139 GpStatus WINGDIPAPI
GdipLoadImageFromFileICM(GDIPCONST WCHAR
* filename
,GpImage
**image
)
1141 TRACE("(%s) %p\n", debugstr_w(filename
), image
);
1143 return GdipLoadImageFromFile(filename
, image
);
1146 GpStatus WINGDIPAPI
GdipLoadImageFromStream(IStream
* stream
, GpImage
**image
)
1151 TRACE("%p %p\n", stream
, image
);
1153 if(!stream
|| !image
)
1154 return InvalidParameter
;
1156 if(OleLoadPicture(stream
, 0, FALSE
, &IID_IPicture
,
1157 (LPVOID
*) &pic
) != S_OK
){
1158 TRACE("Could not load picture\n");
1159 return GenericError
;
1162 IPicture_get_Type(pic
, &type
);
1164 if(type
== PICTYPE_BITMAP
){
1166 BITMAPCOREHEADER
* bmch
;
1170 pbmi
= GdipAlloc(sizeof(BITMAPINFOHEADER
) + 256 * sizeof(RGBQUAD
));
1173 *image
= GdipAlloc(sizeof(GpBitmap
));
1178 (*image
)->type
= ImageTypeBitmap
;
1180 (*((GpBitmap
**) image
))->width
= ipicture_pixel_width(pic
);
1181 (*((GpBitmap
**) image
))->height
= ipicture_pixel_height(pic
);
1183 /* get the pixel format */
1184 IPicture_get_Handle(pic
, (OLE_HANDLE
*)&hbm
);
1185 IPicture_get_CurDC(pic
, &hdc
);
1187 bmch
= (BITMAPCOREHEADER
*) (&pbmi
->bmiHeader
);
1188 bmch
->bcSize
= sizeof(BITMAPCOREHEADER
);
1192 hdc
= CreateCompatibleDC(0);
1193 old
= SelectObject(hdc
, hbm
);
1194 GetDIBits(hdc
, hbm
, 0, 0, NULL
, pbmi
, DIB_RGB_COLORS
);
1195 SelectObject(hdc
, old
);
1199 GetDIBits(hdc
, hbm
, 0, 0, NULL
, pbmi
, DIB_RGB_COLORS
);
1201 switch(bmch
->bcBitCount
)
1204 (*((GpBitmap
**) image
))->format
= PixelFormat1bppIndexed
;
1207 (*((GpBitmap
**) image
))->format
= PixelFormat4bppIndexed
;
1210 (*((GpBitmap
**) image
))->format
= PixelFormat8bppIndexed
;
1213 (*((GpBitmap
**) image
))->format
= PixelFormat16bppRGB565
;
1216 (*((GpBitmap
**) image
))->format
= PixelFormat24bppRGB
;
1219 (*((GpBitmap
**) image
))->format
= PixelFormat32bppRGB
;
1222 (*((GpBitmap
**) image
))->format
= PixelFormat48bppRGB
;
1225 FIXME("Bit depth %d is not fully supported yet\n", bmch
->bcBitCount
);
1226 (*((GpBitmap
**) image
))->format
= (bmch
->bcBitCount
<< 8) | PixelFormatGDI
;
1232 else if(type
== PICTYPE_METAFILE
|| type
== PICTYPE_ENHMETAFILE
){
1233 /* FIXME: missing initialization code */
1234 *image
= GdipAlloc(sizeof(GpMetafile
));
1235 if(!*image
) return OutOfMemory
;
1236 (*image
)->type
= ImageTypeMetafile
;
1239 *image
= GdipAlloc(sizeof(GpImage
));
1240 if(!*image
) return OutOfMemory
;
1241 (*image
)->type
= ImageTypeUnknown
;
1244 (*image
)->picture
= pic
;
1245 (*image
)->flags
= ImageFlagsNone
;
1251 GpStatus WINGDIPAPI
GdipLoadImageFromStreamICM(IStream
* stream
, GpImage
**image
)
1253 TRACE("%p %p\n", stream
, image
);
1255 return GdipLoadImageFromStream(stream
, image
);
1258 GpStatus WINGDIPAPI
GdipRemovePropertyItem(GpImage
*image
, PROPID propId
)
1263 return InvalidParameter
;
1266 FIXME("not implemented\n");
1268 return NotImplemented
;
1271 GpStatus WINGDIPAPI
GdipSetPropertyItem(GpImage
*image
, GDIPCONST PropertyItem
* item
)
1276 FIXME("not implemented\n");
1278 return NotImplemented
;
1281 GpStatus WINGDIPAPI
GdipSaveImageToFile(GpImage
*image
, GDIPCONST WCHAR
* filename
,
1282 GDIPCONST CLSID
*clsidEncoder
,
1283 GDIPCONST EncoderParameters
*encoderParams
)
1288 TRACE("%p (%s) %p %p\n", image
, debugstr_w(filename
), clsidEncoder
, encoderParams
);
1290 if (!image
|| !filename
|| !clsidEncoder
)
1291 return InvalidParameter
;
1293 if (!(image
->picture
))
1294 return InvalidParameter
;
1296 stat
= GdipCreateStreamOnFile(filename
, GENERIC_WRITE
, &stream
);
1298 return GenericError
;
1300 stat
= GdipSaveImageToStream(image
, stream
, clsidEncoder
, encoderParams
);
1302 IStream_Release(stream
);
1306 /*************************************************************************
1307 * Encoding functions -
1308 * These functions encode an image in different image file formats.
1310 #define BITMAP_FORMAT_BMP 0x4d42 /* "BM" */
1311 #define BITMAP_FORMAT_JPEG 0xd8ff
1312 #define BITMAP_FORMAT_GIF 0x4947
1313 #define BITMAP_FORMAT_PNG 0x5089
1314 #define BITMAP_FORMAT_APM 0xcdd7
1316 static GpStatus
encode_image_BMP(LPVOID bitmap_bits
, LPBITMAPINFO bitmap_info
,
1317 void **output
, unsigned int *output_size
)
1319 int num_palette_entries
;
1320 BITMAPFILEHEADER
*bmp_file_hdr
;
1321 BITMAPINFO
*bmp_info_hdr
;
1323 if (bitmap_info
->bmiHeader
.biClrUsed
) {
1324 num_palette_entries
= bitmap_info
->bmiHeader
.biClrUsed
;
1325 if (num_palette_entries
> 256) num_palette_entries
= 256;
1327 if (bitmap_info
->bmiHeader
.biBitCount
<= 8)
1328 num_palette_entries
= 1 << bitmap_info
->bmiHeader
.biBitCount
;
1330 num_palette_entries
= 0;
1334 sizeof(BITMAPFILEHEADER
) +
1335 sizeof(BITMAPINFOHEADER
) +
1336 num_palette_entries
* sizeof(RGBQUAD
) +
1337 bitmap_info
->bmiHeader
.biSizeImage
;
1339 *output
= GdipAlloc(*output_size
);
1341 bmp_file_hdr
= *output
;
1342 bmp_file_hdr
->bfType
= BITMAP_FORMAT_BMP
;
1343 bmp_file_hdr
->bfSize
= *output_size
;
1344 bmp_file_hdr
->bfOffBits
=
1345 sizeof(BITMAPFILEHEADER
) +
1346 sizeof(BITMAPINFOHEADER
) +
1347 num_palette_entries
* sizeof (RGBQUAD
);
1349 bmp_info_hdr
= (BITMAPINFO
*) ((unsigned char*)(*output
) + sizeof(BITMAPFILEHEADER
));
1350 memcpy(bmp_info_hdr
, bitmap_info
, sizeof(BITMAPINFOHEADER
) + num_palette_entries
* sizeof(RGBQUAD
));
1351 memcpy((unsigned char *)(*output
) +
1352 sizeof(BITMAPFILEHEADER
) +
1353 sizeof(BITMAPINFOHEADER
) +
1354 num_palette_entries
* sizeof(RGBQUAD
),
1355 bitmap_bits
, bitmap_info
->bmiHeader
.biSizeImage
);
1360 typedef GpStatus
encode_image_func(LPVOID bitmap_bits
, LPBITMAPINFO bitmap_info
,
1361 void **output
, unsigned int *output_size
);
1365 NUM_ENCODERS_SUPPORTED
1368 static const ImageCodecInfo codecs
[NUM_ENCODERS_SUPPORTED
];
1369 static encode_image_func
*const encode_image_funcs
[NUM_ENCODERS_SUPPORTED
] = {
1373 /*****************************************************************************
1374 * GdipSaveImageToStream [GDIPLUS.@]
1376 GpStatus WINGDIPAPI
GdipSaveImageToStream(GpImage
*image
, IStream
* stream
,
1377 GDIPCONST CLSID
* clsid
, GDIPCONST EncoderParameters
* params
)
1386 BITMAPINFO bmp_info
;
1388 encode_image_func
* encode_image
;
1390 unsigned int output_size
;
1398 TRACE("%p %p %p %p\n", image
, stream
, clsid
, params
);
1400 if(!image
|| !stream
)
1401 return InvalidParameter
;
1403 if (!image
->picture
)
1404 return GenericError
;
1406 hr
= IPicture_get_Type(image
->picture
, &type
);
1407 if (FAILED(hr
) || type
!= PICTYPE_BITMAP
)
1408 return GenericError
;
1410 /* select correct encoder */
1411 encode_image
= NULL
;
1412 for (i
= 0; i
< NUM_ENCODERS_SUPPORTED
; i
++) {
1413 if (IsEqualCLSID(clsid
, &codecs
[i
].Clsid
))
1414 encode_image
= encode_image_funcs
[i
];
1416 if (encode_image
== NULL
)
1417 return UnknownImageFormat
;
1419 /* extract underlying hbitmap representation from the IPicture */
1420 hr
= IPicture_get_Handle(image
->picture
, (OLE_HANDLE
*)&hbmp
);
1421 if (FAILED(hr
) || !hbmp
)
1422 return GenericError
;
1423 hr
= IPicture_get_CurDC(image
->picture
, &hdc
);
1425 return GenericError
;
1426 bm_is_selected
= (hdc
!= 0);
1427 if (!bm_is_selected
) {
1428 hdc
= CreateCompatibleDC(0);
1429 old_hbmp
= SelectObject(hdc
, hbmp
);
1432 /* get bits from HBITMAP */
1433 bmp_info
.bmiHeader
.biSize
= sizeof(bmp_info
.bmiHeader
);
1434 bmp_info
.bmiHeader
.biBitCount
= 0;
1435 GetDIBits(hdc
, hbmp
, 0, 0, NULL
, &bmp_info
, DIB_RGB_COLORS
);
1437 bmp_bits
= GdipAlloc(bmp_info
.bmiHeader
.biSizeImage
);
1440 GetDIBits(hdc
, hbmp
, 0, abs(bmp_info
.bmiHeader
.biHeight
), bmp_bits
, &bmp_info
, DIB_RGB_COLORS
);
1442 if (!bm_is_selected
) {
1443 SelectObject(hdc
, old_hbmp
);
1450 stat
= encode_image(bmp_bits
, &bmp_info
, &output
, &output_size
);
1452 IStream_Write(stream
, output
, output_size
, &dummy
);
1460 /*****************************************************************************
1461 * GdipSetImagePalette [GDIPLUS.@]
1463 GpStatus WINGDIPAPI
GdipSetImagePalette(GpImage
*image
,
1464 GDIPCONST ColorPalette
*palette
)
1468 if(!image
|| !palette
)
1469 return InvalidParameter
;
1472 FIXME("not implemented\n");
1474 return NotImplemented
;
1477 /*************************************************************************
1479 * Structures that represent which formats we support for encoding.
1482 /* ImageCodecInfo creation routines taken from libgdiplus */
1483 static const WCHAR bmp_codecname
[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'B', 'M', 'P', 0}; /* Built-in BMP */
1484 static const WCHAR bmp_extension
[] = {'*','.','B', 'M', 'P',';', '*','.', 'D','I', 'B',';', '*','.', 'R', 'L', 'E',0}; /* *.BMP;*.DIB;*.RLE */
1485 static const WCHAR bmp_mimetype
[] = {'i', 'm', 'a','g', 'e', '/', 'b', 'm', 'p', 0}; /* image/bmp */
1486 static const WCHAR bmp_format
[] = {'B', 'M', 'P', 0}; /* BMP */
1487 static const BYTE bmp_sig_pattern
[] = { 0x42, 0x4D };
1488 static const BYTE bmp_sig_mask
[] = { 0xFF, 0xFF };
1490 static const ImageCodecInfo codecs
[NUM_ENCODERS_SUPPORTED
] =
1493 /* Clsid */ { 0x557cf400, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } },
1494 /* FormatID */ { 0xb96b3cabU
, 0x0728U
, 0x11d3U
, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e} },
1495 /* CodecName */ bmp_codecname
,
1497 /* FormatDescription */ bmp_format
,
1498 /* FilenameExtension */ bmp_extension
,
1499 /* MimeType */ bmp_mimetype
,
1500 /* Flags */ ImageCodecFlagsEncoder
| ImageCodecFlagsDecoder
| ImageCodecFlagsSupportBitmap
| ImageCodecFlagsBuiltin
,
1504 /* SigPattern */ bmp_sig_pattern
,
1505 /* SigMask */ bmp_sig_mask
,
1509 /*****************************************************************************
1510 * GdipGetImageDecodersSize [GDIPLUS.@]
1512 GpStatus WINGDIPAPI
GdipGetImageDecodersSize(UINT
*numDecoders
, UINT
*size
)
1514 FIXME("%p %p stub!\n", numDecoders
, size
);
1516 if (!numDecoders
|| !size
)
1517 return InvalidParameter
;
1525 /*****************************************************************************
1526 * GdipGetImageDecoders [GDIPLUS.@]
1528 GpStatus WINGDIPAPI
GdipGetImageDecoders(UINT numDecoders
, UINT size
, ImageCodecInfo
*decoders
)
1530 FIXME("%u %u %p stub!\n", numDecoders
, size
, decoders
);
1533 return GenericError
;
1535 return NotImplemented
;
1538 /*****************************************************************************
1539 * GdipGetImageEncodersSize [GDIPLUS.@]
1541 GpStatus WINGDIPAPI
GdipGetImageEncodersSize(UINT
*numEncoders
, UINT
*size
)
1543 TRACE("%p %p\n", numEncoders
, size
);
1545 if (!numEncoders
|| !size
)
1546 return InvalidParameter
;
1548 *numEncoders
= NUM_ENCODERS_SUPPORTED
;
1549 *size
= sizeof (codecs
);
1554 /*****************************************************************************
1555 * GdipGetImageEncoders [GDIPLUS.@]
1557 GpStatus WINGDIPAPI
GdipGetImageEncoders(UINT numEncoders
, UINT size
, ImageCodecInfo
*encoders
)
1559 TRACE("%u %u %p\n", numEncoders
, size
, encoders
);
1562 (numEncoders
!= NUM_ENCODERS_SUPPORTED
) ||
1563 (size
!= sizeof (codecs
)))
1564 return GenericError
;
1566 memcpy(encoders
, codecs
, sizeof (codecs
));
1571 /*****************************************************************************
1572 * GdipCreateBitmapFromHBITMAP [GDIPLUS.@]
1574 GpStatus WINGDIPAPI
GdipCreateBitmapFromHBITMAP(HBITMAP hbm
, HPALETTE hpal
, GpBitmap
** bitmap
)
1581 TRACE("%p %p %p\n", hbm
, hpal
, bitmap
);
1584 return InvalidParameter
;
1586 /* TODO: Support for device-dependent bitmaps */
1588 FIXME("no support for device-dependent bitmaps\n");
1589 return NotImplemented
;
1592 if (GetObjectA(hbm
, sizeof(bm
), &bm
) != sizeof(bm
))
1593 return InvalidParameter
;
1595 /* TODO: Figure out the correct format for 16, 32, 64 bpp */
1596 switch(bm
.bmBitsPixel
) {
1598 format
= PixelFormat1bppIndexed
;
1601 format
= PixelFormat4bppIndexed
;
1604 format
= PixelFormat8bppIndexed
;
1607 format
= PixelFormat24bppRGB
;
1610 format
= PixelFormat32bppRGB
;
1613 format
= PixelFormat48bppRGB
;
1616 FIXME("don't know how to handle %d bpp\n", bm
.bmBitsPixel
);
1617 return InvalidParameter
;
1621 bits
= (BYTE
*)bm
.bmBits
+ (bm
.bmHeight
- 1) * bm
.bmWidthBytes
;
1624 FIXME("can only get image data from DIB sections\n");
1628 retval
= GdipCreateBitmapFromScan0(bm
.bmWidth
, bm
.bmHeight
, -bm
.bmWidthBytes
,
1629 format
, bits
, bitmap
);
1634 GpStatus WINGDIPAPI
GdipDeleteEffect(CGpEffect
*effect
)
1636 FIXME("(%p): stub\n", effect
);
1637 /* note: According to Jose Roca's GDI+ Docs, this is not implemented
1638 * in Windows's gdiplus */
1639 return NotImplemented
;
1642 /*****************************************************************************
1643 * GdipSetEffectParameters [GDIPLUS.@]
1645 GpStatus WINGDIPAPI
GdipSetEffectParameters(CGpEffect
*effect
,
1646 const VOID
*params
, const UINT size
)
1651 FIXME("not implemented\n");
1653 return NotImplemented
;
1656 /*****************************************************************************
1657 * GdipGetImageFlags [GDIPLUS.@]
1659 GpStatus WINGDIPAPI
GdipGetImageFlags(GpImage
*image
, UINT
*flags
)
1661 TRACE("%p %p\n", image
, flags
);
1663 if(!image
|| !flags
)
1664 return InvalidParameter
;
1666 *flags
= image
->flags
;
1671 GpStatus WINGDIPAPI
GdipTestControl(GpTestControlEnum control
, void *param
)
1673 TRACE("(%d, %p)\n", control
, param
);
1676 case TestControlForceBilinear
:
1678 FIXME("TestControlForceBilinear not handled\n");
1680 case TestControlNoICM
:
1682 FIXME("TestControlNoICM not handled\n");
1684 case TestControlGetBuildNumber
:
1685 *((DWORD
*)param
) = 3102;
1692 GpStatus WINGDIPAPI
GdipRecordMetafileFileName(GDIPCONST WCHAR
* fileName
,
1693 HDC hdc
, EmfType type
, GDIPCONST GpRectF
*pFrameRect
,
1694 MetafileFrameUnit frameUnit
, GDIPCONST WCHAR
*desc
,
1695 GpMetafile
**metafile
)
1697 FIXME("%s %p %d %p %d %s %p stub!\n", debugstr_w(fileName
), hdc
, type
, pFrameRect
,
1698 frameUnit
, debugstr_w(desc
), metafile
);
1700 return NotImplemented
;
1703 GpStatus WINGDIPAPI
GdipRecordMetafileFileNameI(GDIPCONST WCHAR
* fileName
, HDC hdc
, EmfType type
,
1704 GDIPCONST GpRect
*pFrameRect
, MetafileFrameUnit frameUnit
,
1705 GDIPCONST WCHAR
*desc
, GpMetafile
**metafile
)
1707 FIXME("%s %p %d %p %d %s %p stub!\n", debugstr_w(fileName
), hdc
, type
, pFrameRect
,
1708 frameUnit
, debugstr_w(desc
), metafile
);
1710 return NotImplemented
;
1713 GpStatus WINGDIPAPI
GdipImageForceValidation(GpImage
*image
)
1715 FIXME("%p\n", image
);
1720 /*****************************************************************************
1721 * GdipGetImageThumbnail [GDIPLUS.@]
1723 GpStatus WINGDIPAPI
GdipGetImageThumbnail(GpImage
*image
, UINT width
, UINT height
,
1724 GpImage
**ret_image
, GetThumbnailImageAbort cb
,
1727 FIXME("(%p %u %u %p %p %p) stub\n",
1728 image
, width
, height
, ret_image
, cb
, cb_data
);
1729 return NotImplemented
;
1732 /*****************************************************************************
1733 * GdipImageRotateFlip [GDIPLUS.@]
1735 GpStatus WINGDIPAPI
GdipImageRotateFlip(GpImage
*image
, RotateFlipType type
)
1737 FIXME("(%p %u) stub\n", image
, type
);
1738 return NotImplemented
;