コード例 #1
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();
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        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();
            }
        }