/// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap6"]/*' /> /// <devdoc> /// <para> /// Initializes a new instance of the Bitmap class with the specified /// size and format. /// </para> /// </devdoc> public Bitmap(int width, int height, PixelFormat format) { IntPtr bitmap = IntPtr.Zero; int status = SafeNativeMethods.GdipCreateBitmapFromScan0(width, height, 0, (int)format, NativeMethods.NullHandleRef, out bitmap); if (status != SafeNativeMethods.Ok) { throw SafeNativeMethods.StatusException(status); } SetNativeImage(bitmap); }
/// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.Bitmap5"]/*' /> /// <devdoc> /// <para> /// Initializes a new instance of the /// Bitmap class with the specified size, pixel format, and pixel data. /// </para> /// </devdoc> public Bitmap(int width, int height, int stride, PixelFormat format, IntPtr scan0) { IntSecurity.ObjectFromWin32Handle.Demand(); IntPtr bitmap = IntPtr.Zero; int status = SafeNativeMethods.GdipCreateBitmapFromScan0(width, height, stride, (int)format, new HandleRef(null, scan0), out bitmap); if (status != SafeNativeMethods.Ok) { throw SafeNativeMethods.StatusException(status); } SetNativeImage(bitmap); }