public void CopyFromBitmap(D2D1Bitmap srcBitmap, D2D1RectU srcRect)
        {
            if (srcBitmap == null)
            {
                throw new ArgumentNullException("srcBitmap");
            }

            GCHandle srcRectHandle = GCHandle.Alloc(srcRect, GCHandleType.Pinned);

            try
            {
                this.bitmap.CopyFromBitmap(IntPtr.Zero, srcBitmap.bitmap, srcRectHandle.AddrOfPinnedObject());
            }
            finally
            {
                srcRectHandle.Free();
            }
        }
        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();
            }
        }
        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();
            }
        }
        public void CopyFromBitmap(D2D1Bitmap srcBitmap, D2D1RectU srcRect)
        {
            if (srcBitmap == null)
            {
                throw new ArgumentNullException("srcBitmap");
            }

            GCHandle srcRectHandle = GCHandle.Alloc(srcRect, GCHandleType.Pinned);

            try
            {
                this.bitmap.CopyFromBitmap(IntPtr.Zero, srcBitmap.bitmap, srcRectHandle.AddrOfPinnedObject());
            }
            finally
            {
                srcRectHandle.Free();
            }
        }
        public D2D1BitmapBrush CreateBitmapBrush(D2D1Bitmap bitmap)
        {
            if (bitmap == null)
            {
                throw new ArgumentNullException("bitmap");
            }

            ID2D1BitmapBrush bitmapBrush;
            this.GetHandle<ID2D1RenderTarget>().CreateBitmapBrush(bitmap.GetHandle<ID2D1Bitmap>(), IntPtr.Zero, IntPtr.Zero, out bitmapBrush);
            return new D2D1BitmapBrush(bitmapBrush);
        }
        public D2D1BitmapBrush CreateBitmapBrush(D2D1Bitmap bitmap, D2D1BitmapBrushProperties bitmapBrushProperties, D2D1BrushProperties brushProperties)
        {
            if (bitmap == null)
            {
                throw new ArgumentNullException("bitmap");
            }

            ID2D1BitmapBrush bitmapBrush;

            GCHandle bitmapBrushPropertiesHandle = GCHandle.Alloc(bitmapBrushProperties, GCHandleType.Pinned);
            GCHandle brushPropertiesHandle = GCHandle.Alloc(brushProperties, GCHandleType.Pinned);

            try
            {
                this.GetHandle<ID2D1RenderTarget>().CreateBitmapBrush(bitmap.GetHandle<ID2D1Bitmap>(), bitmapBrushPropertiesHandle.AddrOfPinnedObject(), brushPropertiesHandle.AddrOfPinnedObject(), out bitmapBrush);
            }
            finally
            {
                bitmapBrushPropertiesHandle.Free();
                brushPropertiesHandle.Free();
            }

            return new D2D1BitmapBrush(bitmapBrush);
        }
        public void DrawBitmap(D2D1Bitmap bitmap, D2D1RectF destinationRectangle, float opacity, D2D1BitmapInterpolationMode interpolationMode, D2D1RectF sourceRectangle)
        {
            if (bitmap == null)
            {
                throw new ArgumentNullException("bitmap");
            }

            GCHandle destinationRectangleHandle = GCHandle.Alloc(destinationRectangle, GCHandleType.Pinned);
            GCHandle sourceRectangleHandle = GCHandle.Alloc(sourceRectangle, GCHandleType.Pinned);

            try
            {
                this.GetHandle<ID2D1RenderTarget>().DrawBitmap(bitmap.GetHandle<ID2D1Bitmap>(), destinationRectangleHandle.AddrOfPinnedObject(), opacity, interpolationMode, sourceRectangleHandle.AddrOfPinnedObject());
            }
            finally
            {
                destinationRectangleHandle.Free();
                sourceRectangleHandle.Free();
            }
        }
        public void DrawBitmap(D2D1Bitmap bitmap, D2D1RectF destinationRectangle)
        {
            if (bitmap == null)
            {
                throw new ArgumentNullException("bitmap");
            }

            GCHandle destinationRectangleHandle = GCHandle.Alloc(destinationRectangle, GCHandleType.Pinned);

            try
            {
                this.GetHandle<ID2D1RenderTarget>().DrawBitmap(bitmap.GetHandle<ID2D1Bitmap>(), destinationRectangleHandle.AddrOfPinnedObject(), 1.0f, D2D1BitmapInterpolationMode.Linear, IntPtr.Zero);
            }
            finally
            {
                destinationRectangleHandle.Free();
            }
        }
        public void DrawBitmap(D2D1Bitmap bitmap)
        {
            if (bitmap == null)
            {
                throw new ArgumentNullException("bitmap");
            }

            this.GetHandle<ID2D1RenderTarget>().DrawBitmap(bitmap.GetHandle<ID2D1Bitmap>(), IntPtr.Zero, 1.0f, D2D1BitmapInterpolationMode.Linear, IntPtr.Zero);
        }
        public void FillOpacityMask(D2D1Bitmap opacityMask, D2D1Brush brush, D2D1OpacityMaskContent content, D2D1RectF destinationRectangle, D2D1RectF sourceRectangle)
        {
            if (opacityMask == null)
            {
                throw new ArgumentNullException("opacityMask");
            }

            if (brush == null)
            {
                throw new ArgumentNullException("brush");
            }

            GCHandle destinationRectangleHandle = GCHandle.Alloc(destinationRectangle, GCHandleType.Pinned);
            GCHandle sourceRectangleHandle = GCHandle.Alloc(sourceRectangle, GCHandleType.Pinned);

            try
            {
                this.GetHandle<ID2D1RenderTarget>().FillOpacityMask(opacityMask.GetHandle<ID2D1Bitmap>(), brush.GetHandle<ID2D1Brush>(), content, destinationRectangleHandle.AddrOfPinnedObject(), sourceRectangleHandle.AddrOfPinnedObject());
            }
            finally
            {
                destinationRectangleHandle.Free();
                sourceRectangleHandle.Free();
            }
        }
        public void FillOpacityMask(D2D1Bitmap opacityMask, D2D1Brush brush, D2D1OpacityMaskContent content)
        {
            if (opacityMask == null)
            {
                throw new ArgumentNullException("opacityMask");
            }

            if (brush == null)
            {
                throw new ArgumentNullException("brush");
            }

            this.GetHandle<ID2D1RenderTarget>().FillOpacityMask(opacityMask.GetHandle<ID2D1Bitmap>(), brush.GetHandle<ID2D1Brush>(), content, IntPtr.Zero, IntPtr.Zero);
        }