public CGColor (CGColorSpace colorspace, nfloat [] components) { if (components == null) throw new ArgumentNullException ("components"); if (colorspace == null) throw new ArgumentNullException ("colorspace"); if (colorspace.handle == IntPtr.Zero) throw new ObjectDisposedException ("colorspace"); handle = CGColorCreate (colorspace.handle, components); }
public static CGShading CreateAxial (CGColorSpace colorspace, CGPoint start, CGPoint end, CGFunction function, bool extendStart, bool extendEnd) { if (colorspace == null) throw new ArgumentNullException ("colorspace"); if (colorspace.Handle == IntPtr.Zero) throw new ObjectDisposedException ("colorspace"); if (function == null) throw new ArgumentNullException ("function"); if (function.Handle == IntPtr.Zero) throw new ObjectDisposedException ("function"); return new CGShading (CGShadingCreateAxial (colorspace.Handle, start, end, function.Handle, extendStart, extendEnd), true); }
public CGColor (CGColorSpace colorspace, CGPattern pattern, nfloat [] components) { if (colorspace == null) throw new ArgumentNullException ("colorspace"); if (colorspace.handle == IntPtr.Zero) throw new ObjectDisposedException ("colorspace"); if (pattern == null) throw new ArgumentNullException ("pattern"); if (components == null) throw new ArgumentNullException ("components"); handle = CGColorCreateWithPattern (colorspace.handle, pattern.handle, components); if (handle == IntPtr.Zero) throw new ArgumentException (); }
public CIImage(ICIImageProvider provider, nuint width, nuint height, CIFormat pixelFormat, CGColorSpace colorSpace, CIImageProviderOptions options) : this(provider, width, height, CIImage.CIFormatToInt (pixelFormat), colorSpace, options == null ? null : options.Dictionary) { }
public CGBitmapContext(byte [] data, nint width, nint height, nint bitsPerComponent, nint bytesPerRow, CGColorSpace colorSpace, CGBitmapFlags bitmapInfo) { if (data != null) buffer = GCHandle.Alloc (data, GCHandleType.Pinned); Handle = CGBitmapContextCreate (data, width, height, bitsPerComponent, bytesPerRow, GetHandle (colorSpace), (uint) bitmapInfo); }
public static CGColorSpace CreateICCProfile(nfloat[] range, CGDataProvider profile, CGColorSpace alternate) #endif { nint nComponents = range == null ? 0 : range.Length / 2; IntPtr p = profile == null ? IntPtr.Zero : profile.Handle; IntPtr a = alternate == null ? IntPtr.Zero : alternate.Handle; var ptr = CGColorSpaceCreateICCBased(nComponents, range, p, a); return(ptr == IntPtr.Zero ? null : new CGColorSpace(ptr, true)); }
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 static CIImage FromData(NSData bitmapData, nint bytesPerRow, CGSize size, CIFormat pixelFormat, CGColorSpace colorSpace) { return FromData (bitmapData, bytesPerRow, size, CIImage.CIFormatToInt (pixelFormat), colorSpace); }
public static CGColorSpace CreatePattern(CGColorSpace baseSpace) { var ptr = CGColorSpaceCreatePattern(baseSpace == null ? IntPtr.Zero : baseSpace.handle); return(ptr == IntPtr.Zero ? null : new CGColorSpace(ptr, true)); }
public static CGColorSpace CreatePattern (CGColorSpace baseSpace) { var ptr = CGColorSpaceCreatePattern (baseSpace == null ? IntPtr.Zero : baseSpace.handle); return ptr == IntPtr.Zero ? null : new CGColorSpace (ptr, true); }
public CGImage WithColorSpace(CGColorSpace cs) { var h = CGImageCreateCopyWithColorSpace(handle, cs == null ? IntPtr.Zero : cs.handle); return(h == IntPtr.Zero ? null : new CGImage(h, true)); }
public void SetStrokeColorSpace (CGColorSpace space) { CGContextSetStrokeColorSpace (handle, space == null ? IntPtr.Zero : space.handle); }
public static CGColorSpace CreateIndexed (CGColorSpace baseSpace, int lastIndex, byte[] colorTable) { var ptr = CGColorSpaceCreateIndexed (baseSpace == null ? IntPtr.Zero : baseSpace.handle, lastIndex, colorTable); return ptr == IntPtr.Zero ? null : new CGColorSpace (ptr, true); }
public CGBitmapContext(byte [] data, nint width, nint height, nint bitsPerComponent, nint bytesPerRow, CGColorSpace colorSpace, CGBitmapFlags bitmapInfo) { if (data != null) { buffer = GCHandle.Alloc(data, GCHandleType.Pinned); } Handle = CGBitmapContextCreate(data, width, height, bitsPerComponent, bytesPerRow, GetHandle(colorSpace), (uint)bitmapInfo); }
public CGImage CreateCGImage(CIImage image, CGRect fromRect, CIFormat ciImageFormat, CGColorSpace colorSpace) { return CreateCGImage (image, fromRect, CIImage.CIFormatToInt (ciImageFormat), colorSpace); }
public static CIImage FromProvider(ICIImageProvider provider, nuint width, nuint height, CIFormat pixelFormat, CGColorSpace colorSpace, CIImageProviderOptions options) { return FromProvider (provider, width, height, CIImage.CIFormatToInt (pixelFormat), colorSpace, options == null ? null : options.Dictionary); }
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 CGBitmapContext(byte [] data, nint width, nint height, nint bitsPerComponent, nint bytesPerRow, CGColorSpace colorSpace, CGBitmapFlags bitmapInfo) { if (data != null) { buffer = GCHandle.Alloc(data, GCHandleType.Pinned); // This requires a pinned GCHandle, because unsafe code is scoped to the current block, and the address of the byte array will be used after this function returns. } Handle = CGBitmapContextCreate(data, width, height, bitsPerComponent, bytesPerRow, GetHandle(colorSpace), (uint)bitmapInfo); }
public static CGColorSpace CreateICCProfile (nfloat[] range, CGDataProvider profile, CGColorSpace alternate) { nint nComponents = range == null ? 0 : range.Length / 2; IntPtr p = profile == null ? IntPtr.Zero : profile.Handle; IntPtr a = alternate == null ? IntPtr.Zero : alternate.Handle; var ptr = CGColorSpaceCreateICCBased (nComponents, range, p, a); return ptr == IntPtr.Zero ? null : new CGColorSpace (ptr, true); }
public static CIImage FromCGImage(CGImage image, CGColorSpace colorSpace) { if (colorSpace == null) throw new ArgumentNullException ("colorSpace"); using (var arr = NSArray.FromIntPtrs (new IntPtr [] { colorSpace.Handle })){ using (var keys = NSArray.FromIntPtrs (new IntPtr [] { CIImageColorSpaceKey.Handle } )){ using (var dict = NSDictionary.FromObjectsAndKeysInternal (arr, keys)){ return FromCGImage (image, dict); } } } }
public CGBitmapContext(IntPtr data, nint width, nint height, nint bitsPerComponent, nint bytesPerRow, CGColorSpace colorSpace, CGBitmapFlags bitmapInfo) : base(CGBitmapContextCreate(data, width, height, bitsPerComponent, bytesPerRow, GetHandle(colorSpace), (uint)bitmapInfo), true) { }
public CGColorConverter(CGColorSpace from, CGColorSpace to) { handle = CGColorConverterCreateSimple (NativeObjectHelper.GetHandle (from), NativeObjectHelper.GetHandle (to)); if (handle == IntPtr.Zero) throw new Exception ("Failed to create CGColorConverter"); }
public static CGColorSpace CreateIndexed(CGColorSpace baseSpace, int lastIndex, byte[] colorTable) { var ptr = CGColorSpaceCreateIndexed(baseSpace == null ? IntPtr.Zero : baseSpace.handle, lastIndex, colorTable); return(ptr == IntPtr.Zero ? null : new CGColorSpace(ptr, true)); }
public CGImage (int width, int height, int bitsPerComponent, int bitsPerPixel, int bytesPerRow, CGColorSpace colorSpace, CGImageAlphaInfo alphaInfo, CGDataProvider provider, nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent) { if (width < 0) throw new ArgumentException ("width"); if (height < 0) throw new ArgumentException ("height"); if (bitsPerPixel < 0) throw new ArgumentException ("bitsPerPixel"); if (bitsPerComponent < 0) throw new ArgumentException ("bitsPerComponent"); if (bytesPerRow < 0) throw new ArgumentException ("bytesPerRow"); handle = CGImageCreate (width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpace == null ? IntPtr.Zero : colorSpace.Handle, (CGBitmapFlags) alphaInfo, provider == null ? IntPtr.Zero : provider.Handle, decode, shouldInterpolate, intent); }
public static CGColorSpace CreateIccProfile(nfloat[] range, CGDataProvider profile, CGColorSpace alternate)
public CGImage WithColorSpace (CGColorSpace cs) { var h = CGImageCreateCopyWithColorSpace (handle, cs == null ? IntPtr.Zero : cs.handle); return h == IntPtr.Zero ? null : new CGImage (h, true); }
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 IntPtr GetHandle(CGColorSpace colorSpace) { if (colorSpace == null) return IntPtr.Zero; return colorSpace.Handle; }
public CGGradient (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 == null) throw new ArgumentNullException ("colorspace"); if (components == null) throw new ArgumentNullException ("components"); handle = CGGradientCreateWithColorComponents (colorspace.handle, components, locations, components.Length / (colorspace.Components+1)); }
public CGBitmapContext(IntPtr data, nint width, nint height, nint bitsPerComponent, nint bytesPerRow, CGColorSpace colorSpace, CGBitmapFlags bitmapInfo) : base(CGBitmapContextCreate (data, width, height, bitsPerComponent, bytesPerRow, GetHandle (colorSpace), (uint) bitmapInfo), true) { }