On 06/30/17 16:14, Dmitry Timoshkov wrote:
Piotr Caban <piotr(a)codeweavers.com> wrote:
+static GpStatus METAFILE_CreateCompressedImageStream(GpImage *image, IStream **stream, DWORD *size) +{ + static const CLSID png_clsid = { 0x557cf406, 0x1a04, 0x11d3, + { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; + LARGE_INTEGER zero; + STATSTG statstg; + GpStatus stat; + HRESULT hr; + + *size = 0; + + hr = CreateStreamOnHGlobal(NULL, TRUE, stream); + if (FAILED(hr)) return hresult_to_status(hr); + + stat = GdipSaveImageToStream(image, *stream, &png_clsid, NULL);
Even internally gdiplus shouldn't do this kind of hacks IMO, if there is a need for a shortcut for a particular encoder class id it's better to add a helper. Have a look at the encoder/decoder tests how it's supposed to look like. I've done it this way because I don't think we should go through enumerating all supported formats internally. How about using encode_image_png function directly?
Thanks, Piotr