IntPtr nativeEncoderParams = encoderParams.ToNativePtr ();
st = GDIPlus.GdipSaveAdd (nativeObject, nativeEncoderParams);
- Marshal.FreeHGlobal (nativeEncoderParams);
+ Marshal.FreeHGlobal (nativeEncoderParams);\r
+ GDIPlus.CheckStatus (st);
}
public void SaveAdd (Image image, EncoderParameters encoderParams)
IntPtr nativeEncoderParams = encoderParams.ToNativePtr ();
st = GDIPlus.GdipSaveAddImage (nativeObject, image.NativeObject, nativeEncoderParams);
- Marshal.FreeHGlobal (nativeEncoderParams);
+ Marshal.FreeHGlobal (nativeEncoderParams);\r
+ GDIPlus.CheckStatus (st);
}
public int SelectActiveFrame(FrameDimension dimension, int frameIndex)
[Browsable (false)]
public PropertyItem[] PropertyItems {
get {
- int propNums, propsSize, propPtr, propSize;
- IntPtr properties;
+ int propNums, propsSize, propSize;
+ IntPtr properties, propPtr;
PropertyItem[] items;
GdipPropertyItem gdipProperty = new GdipPropertyItem ();
Status status;
GDIPlus.CheckStatus (status);
propSize = Marshal.SizeOf (gdipProperty);
- propPtr = properties.ToInt32();
+ propPtr = properties;
- for (int i = 0; i < propNums; i++, propPtr += propSize)
+ for (int i = 0; i < propNums; i++, propPtr = new IntPtr (propPtr.ToInt64 () + propSize))
{
gdipProperty = (GdipPropertyItem) Marshal.PtrToStructure
- ((IntPtr)propPtr, typeof (GdipPropertyItem));
+ (propPtr, typeof (GdipPropertyItem));
items [i] = new PropertyItem ();
GdipPropertyItem.MarshalTo (gdipProperty, items [i]);
}
throw new NotImplementedException ();
Status status = GDIPlus.GdipCloneImage (NativeObject, out newimage);
-
GDIPlus.CheckStatus (status);
-
- if (this is Bitmap)
- return new Bitmap (newimage);
+
+ if (this is Bitmap){
+ Bitmap b = new Bitmap (newimage);
+
+ if (colorPalette != null)
+ b.colorPalette = colorPalette.Clone ();
+
+ return b;
+ }
throw new NotImplementedException ();
}