nativeObject = ptr;
}
+ // Usually called when cloning images that need to have
+ // not only the handle saved, but also the underlying stream
+ // (when using MS GDI+ and IStream we must ensure the stream stays alive for all the life of the Image)
+ internal Bitmap(IntPtr ptr, Stream stream)
+ {
+ // under Win32 stream is owned by SD/GDI+ code
+ if (GDIPlus.RunningOnWindows ())
+ this.stream = stream;
+ nativeObject = ptr;
+ }
+
public Bitmap (int width, int height) : this (width, height, PixelFormat.Format32bppArgb)
{
}
public Bitmap (int width, int height, Graphics g)
- {
+ {
+ if (g == null)
+ throw new ArgumentNullException ("g");
+
IntPtr bmp;
Status s = GDIPlus.GdipCreateBitmapFromGraphics (width, height, g.nativeObject, out bmp);
GDIPlus.CheckStatus (s);
public Bitmap (string filename, bool useIcm)
{
+ if (filename == null)
+ throw new ArgumentNullException ("filename");
+
IntPtr imagePtr;
Status st;
public Bitmap (Type type, string resource)
{
+ if (resource == null)
+ throw new ArgumentException ("resource");
+
Stream s = type.Assembly.GetManifestResourceStream (type, resource);
if (s == null) {
string msg = Locale.GetText ("Resource '{0}' was not found.", resource);
GDIPlus.CheckStatus (status);
}
- public void UnlockBits (BitmapData bitmap_data)
+ public void UnlockBits (BitmapData bitmapdata)
{
- Status status = GDIPlus.GdipBitmapUnlockBits (nativeObject, bitmap_data);
+ Status status = GDIPlus.GdipBitmapUnlockBits (nativeObject, bitmapdata);
GDIPlus.CheckStatus (status);
}
}