Exemple #1
0
        public static IComObject <ID2D1LinearGradientBrush> CreateLinearGradientBrush(this ID2D1RenderTarget context, D2D1_LINEAR_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.CreateLinearGradientBrush(gradientBrushProperties, props.Pointer, stops, out var brush).ThrowOnError();
                return(new ComObject <ID2D1LinearGradientBrush>(brush));
            }
        }
Exemple #2
0
 public static IComObject <ID2D1LinearGradientBrush> CreateLinearGradientBrush(this IComObject <ID2D1RenderTarget> context, D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES gradientBrushProperties, IComObject <ID2D1GradientStopCollection> stops, D2D1_BRUSH_PROPERTIES?brushProperties = null) => CreateLinearGradientBrush(context?.Object, gradientBrushProperties, stops?.Object, brushProperties);