public void CopyFromRenderTarget(D2D1Point2U destPoint, D2D1RenderTarget renderTarget, D2D1RectU srcRect) { if (renderTarget == null) { throw new ArgumentNullException("renderTarget"); } GCHandle destPointHandle = GCHandle.Alloc(destPoint, GCHandleType.Pinned); GCHandle srcRectHandle = GCHandle.Alloc(srcRect, GCHandleType.Pinned); try { this.bitmap.CopyFromRenderTarget(destPointHandle.AddrOfPinnedObject(), renderTarget.GetHandle<ID2D1RenderTarget>(), srcRectHandle.AddrOfPinnedObject()); } finally { destPointHandle.Free(); srcRectHandle.Free(); } }
public void CopyFromMemory(D2D1RectU destRect, IntPtr srcData, uint pitch) { GCHandle destRectHandle = GCHandle.Alloc(destRect, GCHandleType.Pinned); try { this.bitmap.CopyFromMemory(destRectHandle.AddrOfPinnedObject(), srcData, pitch); } finally { destRectHandle.Free(); } }
public void CopyFromBitmap(D2D1Point2U destPoint, D2D1Bitmap srcBitmap, D2D1RectU srcRect) { if (srcBitmap == null) { throw new ArgumentNullException("srcBitmap"); } GCHandle destPointHandle = GCHandle.Alloc(destPoint, GCHandleType.Pinned); GCHandle srcRectHandle = GCHandle.Alloc(srcRect, GCHandleType.Pinned); try { this.bitmap.CopyFromBitmap(destPointHandle.AddrOfPinnedObject(), srcBitmap.bitmap, srcRectHandle.AddrOfPinnedObject()); } finally { destPointHandle.Free(); srcRectHandle.Free(); } }