Esempio n. 1
0
        public static void Write(Image bmp, Stream stream)
        {
            DLLImports.gdImageSaveAlpha(bmp.gdImageStructPtr, 1);

            //MARSHALLING?
            DLLImports.gdImageStruct gdImageStruct = Marshal.PtrToStructure <DLLImports.gdImageStruct>(bmp.gdImageStructPtr);
            var wrapper = new gdStreamWrapper(stream);

            DLLImports.gdImagePngCtx(ref gdImageStruct, ref wrapper.IOCallbacks);
        }
Esempio n. 2
0
        //add png specific method later
        public static void Write(Image img, string filePath)
        {
            DLLImports.gdImageSaveAlpha(img.gdImageStructPtr, 1);

            if (!DLLImports.gdSupportsFileType(filePath, true))
            {
                throw new InvalidOperationException(SR.Format(SR.FileTypeNotSupported, filePath));
            }
            else
            {
                if (!DLLImports.gdImageFile(img.gdImageStructPtr, filePath))
                {
                    throw new FileLoadException(SR.Format(SR.WriteToFileFailed, filePath));
                }
            }
        }