Example #1
0
		static CGColorSpace CreateDeviceRGB ()
		{
			if (deviceRGB != null)
				return deviceRGB;

			deviceRGB = CGColorSpace.CreateDeviceRGB ();
			return deviceRGB;
		}
Example #2
0
        public CGGradient(CGColorSpace colorspace, float [] components, float [] locations)
        {
            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));
        }
Example #3
0
        public CGColor(CGColorSpace colorspace, float [] 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);
        }
Example #4
0
        public static CGShading CreateAxial(CGColorSpace colorspace, PointF start, PointF 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));
        }
Example #5
0
 public static CGColorSpace CreateIndexed(CGColorSpace baseSpace, int lastIndex, byte[] colorTable)
 {
     return new CGColorSpace (CGColorSpaceCreateIndexed (baseSpace == null ? IntPtr.Zero : baseSpace.handle, lastIndex, colorTable), true);
 }
Example #6
0
 public static CGColorSpace CreatePattern(CGColorSpace baseSpace)
 {
     return new CGColorSpace (CGColorSpaceCreatePattern (baseSpace == null ? IntPtr.Zero : baseSpace.handle), true);
 }
Example #7
0
		public CGImage CreateCGImage (CIImage image, System.Drawing.RectangleF fromRect, CIFormat ciImageFormat, CGColorSpace colorSpace)
		{
			return CreateCGImage (image, fromRect, CIImage.CIFormatToInt (ciImageFormat), colorSpace);
		}
Example #8
0
 public CGBitmapContext(byte [] data, int width, int height, int bitsPerComponent, int bytesPerRow, CGColorSpace colorSpace, CGBitmapFlags bitmapInfo)
     : base(CGBitmapContextCreate(data, (UIntPtr)width, (UIntPtr)height, (UIntPtr)bitsPerComponent, (UIntPtr)bytesPerRow, colorSpace.handle, (uint)bitmapInfo), true)
 {
 }
Example #9
0
 public CGImage WithColorSpace(CGColorSpace cs)
 {
     return(new CGImage(CGImageCreateCopyWithColorSpace(handle, cs.handle), true));
 }
Example #10
0
		public CGImage WithColorSpace (CGColorSpace cs)
		{
			return new CGImage (CGImageCreateCopyWithColorSpace (handle, cs.handle), true);
		}
Example #11
0
 public CGBitmapContext(IntPtr data, int width, int height, int bitsPerComponent, int bytesPerRow, CGColorSpace colorSpace, CGImageAlphaInfo bitmapInfo)
     : base(CGBitmapContextCreate (data, (UIntPtr) width, (UIntPtr) height, (UIntPtr) bitsPerComponent, (UIntPtr) bytesPerRow, colorSpace.handle, (uint) bitmapInfo), true)
 {
 }
Example #12
0
		public void SetFillColorSpace (CGColorSpace space)
		{
			CGContextSetFillColorSpace (handle, space.handle);
		}
Example #13
0
		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);
					}
				}
			}
		}
Example #14
0
 public static CGColorSpace CreatePattern(CGColorSpace baseSpace)
 {
     return(new CGColorSpace(CGColorSpaceCreatePattern(baseSpace == null ? IntPtr.Zero : baseSpace.handle), true));
 }
Example #15
0
 public static CGColorSpace CreateIndexed(CGColorSpace baseSpace, int lastIndex, byte[] colorTable)
 {
     return(new CGColorSpace(CGColorSpaceCreateIndexed(baseSpace == null ? IntPtr.Zero : baseSpace.handle, new IntPtr(lastIndex), colorTable), true));
 }
Example #16
0
        public CGColor(CGColorSpace colorspace, CGPattern pattern, float [] 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 ();
        }
Example #17
0
		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);
		}
Example #18
0
		public void SetStrokeColorSpace (CGColorSpace space)
		{
			CGContextSetStrokeColorSpace (handle, space.handle);
		}
Example #19
0
 public void SetFillColorSpace(CGColorSpace space)
 {
     CGContextSetFillColorSpace(handle, space.handle);
 }
Example #20
0
 public void SetStrokeColorSpace(CGColorSpace space)
 {
     CGContextSetStrokeColorSpace(handle, space.handle);
 }
Example #21
0
		public CGImage (int width, int height, int bitsPerComponent, int bitsPerPixel, int bytesPerRow,
				CGColorSpace colorSpace, CGImageAlphaInfo alphaInfo, CGDataProvider provider,
				float [] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
		{
			if (colorSpace == null)
				throw new ArgumentNullException ("colorSpace");
			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");
			if (provider == null)
				throw new ArgumentNullException ("provider");

			handle = CGImageCreate (width, height, bitsPerComponent, bitsPerPixel, bytesPerRow,
						colorSpace.Handle, (CGBitmapFlags) alphaInfo, provider.Handle,
						decode,
						shouldInterpolate, intent);
		}