public static NativeBmp CreateNativeWrapper(System.Drawing.Bitmap bmp) { var bmpdata = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, bmp.PixelFormat); int bpp = 24; switch (bmpdata.PixelFormat) { case System.Drawing.Imaging.PixelFormat.Format24bppRgb: { bpp = 24; } break; case System.Drawing.Imaging.PixelFormat.Format32bppArgb: { bpp = 32; } break; default: { throw new NotSupportedException(); } } NativeBmp nativeBmp = CreateNativeWrapper(bmp.Width, bmp.Height, bmpdata.Stride, bpp, bmpdata.Scan0); bmp.UnlockBits(bmpdata); return(nativeBmp); }
public void DrawImage(NativeBmp bmp, Point[] fourCorners) { NativePixelLibInterOp.drawImage2(this.nativeCanvasPtr, bmp.Handle, fourCorners[0].X, fourCorners[0].Y, fourCorners[1].X, fourCorners[1].Y, fourCorners[2].X, fourCorners[2].Y, fourCorners[3].X, fourCorners[3].Y); }
public static void DrawImage(IntPtr canvasPtr, NativeBmp nativeBmp, int x, int y, int w, int h) { int x1 = x; int y1 = y; int x2 = x1 + w; int y2 = y1 - h; //flip coord NativePixelLibInterOp.drawImage(canvasPtr, nativeBmp.Handle, x1, y1, x2, y2); }
public void DrawImage(NativeBmp bmp, int x, int y, int w, int h) { NativePixelLibInterOp.DrawImage( this.nativeCanvasPtr, bmp, x, y, w, this.h - h); }
public void DrawImage(NativeBmp bmp, int x, int y) { NativePixelLibInterOp.DrawImage( this.nativeCanvasPtr, bmp, x, y, bmp.Width, this.h - bmp.Height); }