public SKAutoLockPixels(SKBitmap bitmap, bool doLock) { this.bitmap = bitmap; this.doLock = doLock; if (bitmap != null && doLock) { bitmap.LockPixels(); } }
public SKAutoLockPixels (SKBitmap bitmap, bool doLock) { this.bitmap = bitmap; this.doLock = doLock; if (bitmap != null && doLock) { bitmap.LockPixels (); } }
public override void DrawImage(ActualImage actualImage, double x, double y) { //create Gdi bitmap from actual image int w = actualImage.Width; int h = actualImage.Height; switch (actualImage.PixelFormat) { case Agg.PixelFormat.ARGB32: { using (SKBitmap newBmp = new SKBitmap(actualImage.Width, actualImage.Height)) { newBmp.LockPixels(); byte[] actualImgBuffer = ActualImage.GetBuffer(actualImage); System.Runtime.InteropServices.Marshal.Copy( actualImgBuffer, 0, newBmp.GetPixels(), actualImgBuffer.Length); newBmp.UnlockPixels(); } //newBmp.internalBmp.LockPixels(); //byte[] actualImgBuffer = ActualImage.GetBuffer(actualImage); //System.Runtime.InteropServices.Marshal.Copy( // actualImgBuffer, // 0, // newBmp.internalBmp.GetPixels(), // actualImgBuffer.Length); //newBmp.internalBmp.UnlockPixels(); //return newBmp; //copy data from acutal buffer to internal representation bitmap //using (MySkBmp bmp = MySkBmp.CopyFrom(actualImage)) //{ // _skCanvas.DrawBitmap(bmp.internalBmp, (float)x, (float)y); //} } break; case Agg.PixelFormat.RGB24: { } break; case Agg.PixelFormat.GrayScale8: { } break; default: throw new NotSupportedException(); } }