public D2D1SolidColorBrush CreateSolidColorBrush(D2D1ColorF color, D2D1BrushProperties brushProperties)
        {
            ID2D1SolidColorBrush solidColorBrush;

            GCHandle brushPropertiesHandle = GCHandle.Alloc(brushProperties);

            try
            {
                this.GetHandle<ID2D1RenderTarget>().CreateSolidColorBrush(ref color, brushPropertiesHandle.AddrOfPinnedObject(), out solidColorBrush);
            }
            finally
            {
                brushPropertiesHandle.Free();
            }

            return new D2D1SolidColorBrush(solidColorBrush);
        }
        public D2D1RadialGradientBrush CreateRadialGradientBrush(D2D1RadialGradientBrushProperties radialGradientBrushProperties, D2D1BrushProperties brushProperties, D2D1GradientStopCollection gradientStopCollection)
        {
            if (gradientStopCollection == null)
            {
                throw new ArgumentOutOfRangeException("gradientStopCollection");
            }

            ID2D1RadialGradientBrush radialGradientBrush;

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

            try
            {
                this.GetHandle<ID2D1RenderTarget>().CreateRadialGradientBrush(ref radialGradientBrushProperties, brushPropertiesHandle.AddrOfPinnedObject(), gradientStopCollection.GetHandle<ID2D1GradientStopCollection>(), out radialGradientBrush);
            }
            finally
            {
                brushPropertiesHandle.Free();
            }

            return new D2D1RadialGradientBrush(radialGradientBrush);
        }
        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);
        }