From 8304765abdd4e5858149ea0c76b327c2f6d15e6f Mon Sep 17 00:00:00 2001 From: Evan Stade Date: Tue, 31 Jul 2007 19:16:00 -0700 Subject: [PATCH] gdiplus: Added partial implementation of GdipSaveImageToStream. --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/image.c | 13 +++++++++ include/Makefile.in | 1 + include/gdiplus.h | 2 ++ include/gdiplusflat.h | 2 ++ include/gdiplusimaging.h | 56 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 include/gdiplusimaging.h diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 26f7dd0189e..4a09aac3a4a 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -495,7 +495,7 @@ @ stub GdipSaveAddImage @ stdcall GdipSaveGraphics(ptr ptr) @ stub GdipSaveImageToFile -@ stub GdipSaveImageToStream +@ stdcall GdipSaveImageToStream(ptr ptr ptr) @ stub GdipScaleLineTransform @ stdcall GdipScaleMatrix(ptr long long long) @ stub GdipScalePathGradientTransform diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 0a164bb7a8d..28d4862fea6 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -273,3 +273,16 @@ GpStatus WINGDIPAPI GdipLoadImageFromStreamICM(IStream* stream, GpImage **image) return Ok; } + +GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream, + GDIPCONST CLSID* clsid, GDIPCONST EncoderParameters* params) +{ + if(!image || !stream) + return InvalidParameter; + + /* FIXME: CLSID, EncoderParameters not used */ + + IPicture_SaveAsFile(image->picture, stream, FALSE, NULL); + + return Ok; +} diff --git a/include/Makefile.in b/include/Makefile.in index a79ae12e1d3..05dc60e2814 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -167,6 +167,7 @@ SRCDIR_INCLUDES = \ gdiplusenums.h \ gdiplusflat.h \ gdiplusgpstubs.h \ + gdiplusimaging.h \ gdiplusinit.h \ gdiplusmem.h \ gdiplusmetaheader.h \ diff --git a/include/gdiplus.h b/include/gdiplus.h index 6b42093e832..1f4ae78a932 100644 --- a/include/gdiplus.h +++ b/include/gdiplus.h @@ -33,6 +33,7 @@ namespace Gdiplus #include "gdiplusinit.h" #include "gdipluspixelformats.h" #include "gdiplusmetaheader.h" +#include "gdiplusimaging.h" #include "gdiplusgpstubs.h" namespace DllExports @@ -50,6 +51,7 @@ namespace Gdiplus #include "gdiplusinit.h" #include "gdipluspixelformats.h" #include "gdiplusmetaheader.h" +#include "gdiplusimaging.h" #include "gdiplusgpstubs.h" #include "gdiplusflat.h" diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 0fea6044eb7..809868b131a 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -152,6 +152,8 @@ GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile*,MetafileHeader GpStatus WINGDIPAPI GdipGetPropertyItemSize(GpImage*,PROPID,UINT*); GpStatus WINGDIPAPI GdipImageGetFrameCount(GpImage*,GDIPCONST GUID*,UINT*); GpStatus WINGDIPAPI GdipLoadImageFromStreamICM(IStream*,GpImage**); +GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage*,IStream*, + GDIPCONST CLSID*,GDIPCONST EncoderParameters*); GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes**); GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes*); diff --git a/include/gdiplusimaging.h b/include/gdiplusimaging.h new file mode 100644 index 00000000000..c76aba5d440 --- /dev/null +++ b/include/gdiplusimaging.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _GDIPLUSIMAGING_H +#define _GDIPLUSIMAGING_H + +#ifdef __cplusplus +class EncoderParameter +{ +public: + GUID Guid; + ULONG NumberOfValues; + ULONG Type; + VOID* Value; +}; + +class EncoderParameters +{ +public: + UINT Count; + EncoderParameter Parameter[1]; +}; +#else /* end of c++ typedefs */ + +typedef struct EncoderParameter +{ + GUID Guid; + ULONG NumberOfValues; + ULONG Type; + VOID* Value; +} EncoderParameter; + +typedef struct EncoderParameters +{ + UINT Count; + EncoderParameter Parameter[1]; +} EncoderParameters; + +#endif /* end of c typedefs */ + +#endif /* _GDIPLUSIMAGING_H */