Ejemplo n.º 1
0
 public static Image Load(Stream stream)
 {
     if (stream != null)
     {
         unsafe
         {
             IntPtr pNativeImage = IntPtr.Zero;
             var    wrapper      = new gdStreamWrapper(stream);
             pNativeImage = DLLImports.gdImageCreateFromPngCtx(ref wrapper.IOCallbacks);
             DLLImports.gdImageStruct *pStruct = (DLLImports.gdImageStruct *)pNativeImage;
             Image toRet = Image.Create(pStruct->sx, pStruct->sx);
             DLLImports.gdImageDestroy(toRet.gdImageStructPtr);
             toRet.gdImageStructPtr = pNativeImage;
             return(toRet);
         }
     }
     else
     {
         throw new InvalidOperationException(SR.NullStreamReferenced);
     }
 }
Ejemplo n.º 2
0
 /* Release */
 public void ReleaseStruct()
 {
     DLLImports.gdImageDestroy(gdImageStructPtr);
 }