예제 #1
0
        public void CopyFromBitmap(D2D1Point2U destPoint, D2D1Bitmap srcBitmap)
        {
            if (srcBitmap == null)
            {
                throw new ArgumentNullException("srcBitmap");
            }

            GCHandle destPointHandle = GCHandle.Alloc(destPoint, GCHandleType.Pinned);

            try
            {
                this.bitmap.CopyFromBitmap(destPointHandle.AddrOfPinnedObject(), srcBitmap.bitmap, IntPtr.Zero);
            }
            finally
            {
                destPointHandle.Free();
            }
        }
예제 #2
0
        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();
            }
        }