Exemplo n.º 1
0
        public static IComObject <ID2D1RadialGradientBrush> CreateRadialGradientBrush(this ID2D1RenderTarget context, D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES gradientBrushProperties, ID2D1GradientStopCollection stops, D2D1_BRUSH_PROPERTIES?brushProperties = null)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (stops == null)
            {
                throw new ArgumentNullException(nameof(stops));
            }

            using (var props = brushProperties.StructureToMemory())
            {
                context.CreateRadialGradientBrush(gradientBrushProperties, props.Pointer, stops, out var brush).ThrowOnError();
                return(new ComObject <ID2D1RadialGradientBrush>(brush));
            }
        }
Exemplo n.º 2
0
        public static IComObject <T> CreateSolidColorBrush <T>(this ID2D1RenderTarget renderTarget, _D3DCOLORVALUE color, D2D1_BRUSH_PROPERTIES?properties = null) where T : ID2D1SolidColorBrush
        {
            if (renderTarget == null)
            {
                throw new ArgumentNullException(nameof(renderTarget));
            }

            if (properties.HasValue)
            {
                using (var props = properties.Value.StructureToMemory())
                {
                    renderTarget.CreateSolidColorBrush(ref color, props.Pointer, out var brush).ThrowOnError();
                    return(new ComObject <T>((T)brush));
                }
            }

            renderTarget.CreateSolidColorBrush(ref color, IntPtr.Zero, out var brush2).ThrowOnError();
            return(new ComObject <T>((T)brush2));
        }
Exemplo n.º 3
0
 public static IComObject <ID2D1RadialGradientBrush> CreateRadialGradientBrush(this IComObject <ID2D1RenderTarget> context, D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES gradientBrushProperties, IComObject <ID2D1GradientStopCollection> stops, D2D1_BRUSH_PROPERTIES?brushProperties = null) => CreateRadialGradientBrush(context?.Object, gradientBrushProperties, stops?.Object, brushProperties);
Exemplo n.º 4
0
 public static IComObject <T> CreateSolidColorBrush <T>(this IComObject <ID2D1RenderTarget> renderTarget, _D3DCOLORVALUE color, D2D1_BRUSH_PROPERTIES?properties = null) where T : ID2D1SolidColorBrush => CreateSolidColorBrush <T>(renderTarget?.Object, color, properties);
        public static ComObject <T> CreateSolidColorBrush <T>(this ID2D1DeviceContext device, _D3DCOLORVALUE color, D2D1_BRUSH_PROPERTIES?properties = null) where T : ID2D1SolidColorBrush
        {
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }

            using (var props = properties.StructureToMemory())
            {
                device.CreateSolidColorBrush(ref color, props.Pointer, out var brush).ThrowOnError();
                return(new ComObject <T>((T)brush));
            }
        }
 public static ComObject <T> CreateSolidColorBrush <T>(this ComObject <ID2D1DeviceContext> device, _D3DCOLORVALUE color, D2D1_BRUSH_PROPERTIES?properties = null) where T : ID2D1SolidColorBrush => CreateSolidColorBrush <T>(device?.Object, color, properties);
Exemplo n.º 7
0
 public static IComObject <ID2D1Brush> CreateSolidColorBrush(this IComObject <ID2D1DeviceContext> context, _D3DCOLORVALUE color, D2D1_BRUSH_PROPERTIES?properties = null) => CreateSolidColorBrush <ID2D1Brush>(context?.Object, color, properties);
Exemplo n.º 8
0
 public static IComObject <ID2D1SolidColorBrush> CreateSolidColorBrush(this IComObject <ID2D1RenderTarget> device, _D3DCOLORVALUE color, D2D1_BRUSH_PROPERTIES?properties = null) => CreateSolidColorBrush <ID2D1SolidColorBrush>(device?.Object, color, properties);