private RectU TransformRectangle(RectU pRectangle) { return(new RectU(Convert.ToUInt32(pRectangle.Left + CurrentBounds.Left), Convert.ToUInt32(pRectangle.Top + CurrentBounds.Top), pRectangle.Width, pRectangle.Height)); }
public unsafe static void OverlayToTarget(RenderTarget target, ImageAdapter image) { SizeU size = new SizeU((uint)image.Width, (uint)image.Height); D2DBitmap d2dImage = target.CreateBitmap(size, new BitmapProperties(new PixelFormat(Microsoft.WindowsAPICodePack.DirectX.Graphics.Format.B8G8R8A8UNorm, AlphaMode.Premultiplied), target.Dpi.X, target.Dpi.Y)); uint left = 0; uint top = 0; RectU rect = new RectU(left, top, left + (uint)image.Width, top + (uint)image.Height); //System.Drawing.Imaging.BitmapData bmData = value.LockBits(new Rectangle(0, 0, value.Width, value.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, value.PixelFormat); d2dImage.CopyFromMemory(rect, (IntPtr)image.ImageBuffer, (uint)image.Width * 4); RectF rf = new RectF(0, 0, image.Width, image.Height); target.DrawBitmap(d2dImage, 1, BitmapInterpolationMode.Linear,rf ); d2dImage.Dispose(); }