示例#1
0
        public static CGShading CreateAxial(CGColorSpace colorspace, CGPoint start, CGPoint end, CGFunction function, bool extendStart, bool extendEnd)
        {
            if (colorspace is null)
            {
                throw new ArgumentNullException(nameof(colorspace));
            }
            if (function is null)
            {
                throw new ArgumentNullException(nameof(function));
            }

            return(new CGShading(CGShadingCreateAxial(colorspace.GetCheckedHandle(), start, end, function.GetCheckedHandle(), extendStart, extendEnd), true));
        }
示例#2
0
        static IntPtr Create(CGColorSpace colorspace, nfloat [] components, nfloat []?locations)
        {
            // those parameters are __nullable but would return a `nil` instance back,
            // which is not something we can handle nicely from a .NET constructor
            if (colorspace is null)
            {
                throw new ArgumentNullException(nameof(colorspace));
            }
            if (components is null)
            {
                throw new ArgumentNullException(nameof(components));
            }

            return(CGGradientCreateWithColorComponents(colorspace.GetCheckedHandle(), components, locations, components.Length / (colorspace.Components + 1)));
        }