Example #1
0
 public static CGFont CreateFromProvider(CGDataProvider provider)
 {
     // the API accept a `nil` argument but returns `nil`, we take a shortcut (no native call)
     // and have a unit tests to make sure this behavior does not change over time
     if (provider == null)
     {
         return(null);
     }
     return(new CGFont(CGFontCreateWithDataProvider(provider.Handle), true));
 }
Example #2
0
        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));
        }
Example #3
0
        public static CGImage FromPNG(CGDataProvider provider, nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
        {
            var handle = CGImageCreateWithPNGDataProvider(provider == null ? IntPtr.Zero : provider.Handle, decode, shouldInterpolate, intent);

            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            return(new CGImage(handle, true));
        }
Example #4
0
 public void UpdateDataProvider(CGDataProvider provider)
 {
     UpdateDataProvider (provider, true);
 }
Example #5
0
 public void UpdateDataProvider(CGDataProvider provider, bool final)
 {
     if (provider == null)
         throw new ArgumentNullException ("provider");
     CGImageSourceUpdateDataProvider (handle, provider.Handle, final);
 }
Example #6
0
        public static CGImageSource FromDataProvider(CGDataProvider provider, CGImageOptions options)
        {
            if (provider == null)
                throw new ArgumentNullException ("provider");

            using (var dict = options == null ? null : options.ToDictionary ()) {
                var result = CGImageSourceCreateWithDataProvider (provider.Handle, dict == null ? IntPtr.Zero : dict.Handle);
                return result == IntPtr.Zero ? null : new CGImageSource (result, true);
            }
        }
Example #7
0
 public static CGImageSource FromDataProvider(CGDataProvider provider)
 {
     return FromDataProvider (provider, null);
 }
Example #8
0
 public static CGColorSpace CreateIccProfile(nfloat[] range, CGDataProvider profile, CGColorSpace alternate)
Example #9
0
 public static CGColorSpace CreateIccData(CGDataProvider provider)
 {
     return(CreateIccData(provider.GetHandle()));
 }
Example #10
0
        public static CGImage CreateMask(int width, int height, int bitsPerComponent, int bitsPerPixel, int bytesPerRow, CGDataProvider provider, nfloat [] decode, bool shouldInterpolate)
        {
            if (width < 0)
            {
                throw new ArgumentException("width");
            }
            if (height < 0)
            {
                throw new ArgumentException("height");
            }
            if (bitsPerPixel < 0)
            {
                throw new ArgumentException("bitsPerPixel");
            }
            if (bytesPerRow < 0)
            {
                throw new ArgumentException("bytesPerRow");
            }

            var handle = CGImageMaskCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, provider == null ? IntPtr.Zero : provider.Handle, decode, shouldInterpolate);

            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            return(new CGImage(handle, true));
        }
Example #11
0
		public static CGImage CreateMask (int width, int height, int bitsPerComponent, int bitsPerPixel, int bytesPerRow, CGDataProvider provider, nfloat [] decode, bool shouldInterpolate)
		{
			if (width < 0)
				throw new ArgumentException ("width");
			if (height < 0)
				throw new ArgumentException ("height");
			if (bitsPerPixel < 0)
				throw new ArgumentException ("bitsPerPixel");
			if (bytesPerRow < 0)
				throw new ArgumentException ("bytesPerRow");

			var handle = CGImageMaskCreate (width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, provider == null ? IntPtr.Zero : provider.Handle, decode, shouldInterpolate);
			if (handle == IntPtr.Zero)
				return null;

			return new CGImage (handle, true);
		}
Example #12
0
		public static CGImage FromPNG (CGDataProvider provider, nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
		{
			var handle = CGImageCreateWithPNGDataProvider (provider == null ? IntPtr.Zero : provider.Handle, decode, shouldInterpolate, intent);
			if (handle == IntPtr.Zero)
				return null;

			return new CGImage (handle, true);
		}
Example #13
0
		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);
		}
Example #14
0
		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);
		}
Example #15
0
		public CGPDFDocument (CGDataProvider provider)
		{
			if (provider == null)
				throw new ArgumentNullException ("provider");
			handle = CGPDFDocumentCreateWithProvider (provider.Handle);
		}
Example #16
0
		public static CGFont CreateFromProvider (CGDataProvider provider)
		{
			// the API accept a `nil` argument but returns `nil`, we take a shortcut (no native call)
			// and have a unit tests to make sure this behavior does not change over time
			if (provider == null)
				return null;
			return new CGFont (CGFontCreateWithDataProvider (provider.Handle), true);
		}