static CGColor CreateByMatchingToColorSpace(CGColorSpace space, CGColorRenderingIntent intent, CGColor color, NSDictionary options) { var h = CGColorCreateCopyByMatchingToColorSpace(space == null ? IntPtr.Zero : space.Handle, intent, color == null ? IntPtr.Zero : color.Handle, options == null ? IntPtr.Zero : options.Handle); return(h == IntPtr.Zero ? null : new CGColor(h)); }
public override bool Equals(object o) { CGColor other = o as CGColor; if (other == null) { return(false); } return(CGColorEqualToColor(this.handle, other.handle)); }
public CGColor(CGColor source, nfloat alpha) { if (source == null) { throw new ArgumentNullException("source"); } if (source.handle == IntPtr.Zero) { throw new ObjectDisposedException("source"); } handle = CGColorCreateCopyWithAlpha(source.handle, alpha); }
public CGGradient (CGColorSpace colorspace, CGColor [] colors) { if (colors == null) throw new ArgumentNullException ("colors"); IntPtr csh = colorspace == null ? IntPtr.Zero : colorspace.handle; using (var array = CFArray.FromNativeObjects (colors)) handle = CGGradientCreateWithColors (csh, array.Handle, null); }
public CGGradient (CGColorSpace colorspace, CGColor [] colors, nfloat [] locations) { // colors is __nullable but would return a `nil` instance back, // which is not something we can handle nicely from a .NET constructor if (colors == null) throw new ArgumentNullException ("colors"); IntPtr csh = colorspace == null ? IntPtr.Zero : colorspace.handle; using (var array = CFArray.FromNativeObjects (colors)) handle = CGGradientCreateWithColors (csh, array.Handle, locations); }
static CGColor CreateByMatchingToColorSpace (CGColorSpace space, CGColorRenderingIntent intent, CGColor color, NSDictionary options) { var h = CGColorCreateCopyByMatchingToColorSpace (space == null ? IntPtr.Zero : space.Handle, intent, color == null ? IntPtr.Zero : color.Handle, options == null ? IntPtr.Zero : options.Handle); return h == IntPtr.Zero ? null : new CGColor (h); }
public CGColor (CGColor source, nfloat alpha) { if (source == null) throw new ArgumentNullException ("source"); if (source.handle == IntPtr.Zero) throw new ObjectDisposedException ("source"); handle = CGColorCreateCopyWithAlpha (source.handle, alpha); }
public static CGColor GetWindowColor(MACaptionAppearanceDomain domain, ref MACaptionAppearanceBehavior behavior) { nint b = (int) behavior; var rv = new CGColor (MACaptionAppearanceCopyWindowColor ((int) domain, ref b), owns: true); behavior = (MACaptionAppearanceBehavior) (int) b; return rv; }
public void SetShadowWithColor (CGSize offset, nfloat blur, CGColor color) { CGContextSetShadowWithColor (handle, offset, blur, color == null ? IntPtr.Zero : color.handle); }
public void SetShadow (CGSize offset, nfloat blur, CGColor color = null) { if (color == null) CGContextSetShadow (handle, offset, blur); else CGContextSetShadowWithColor (handle, offset, blur, color.handle); }
public void SetStrokeColorWithColor (CGColor color) { SetStrokeColor (color); }
public void SetStrokeColor (CGColor color) { CGContextSetStrokeColorWithColor (handle, color == null ? IntPtr.Zero : color.handle); }
public void SetFillColorWithColor (CGColor color) { SetFillColor (color); }