Beispiel #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));
 }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #4
0
 public void UpdateDataProvider(CGDataProvider provider)
 {
     UpdateDataProvider (provider, true);
 }
Beispiel #5
0
 public void UpdateDataProvider(CGDataProvider provider, bool final)
 {
     if (provider == null)
         throw new ArgumentNullException ("provider");
     CGImageSourceUpdateDataProvider (handle, provider.Handle, final);
 }
Beispiel #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);
            }
        }
Beispiel #7
0
 public static CGImageSource FromDataProvider(CGDataProvider provider)
 {
     return FromDataProvider (provider, null);
 }
Beispiel #8
0
 public static CGColorSpace CreateIccProfile(nfloat[] range, CGDataProvider profile, CGColorSpace alternate)
Beispiel #9
0
 public static CGColorSpace CreateIccData(CGDataProvider provider)
 {
     return(CreateIccData(provider.GetHandle()));
 }
Beispiel #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));
        }
Beispiel #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);
		}
Beispiel #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);
		}
Beispiel #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);
		}
Beispiel #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);
		}
Beispiel #15
0
		public CGPDFDocument (CGDataProvider provider)
		{
			if (provider == null)
				throw new ArgumentNullException ("provider");
			handle = CGPDFDocumentCreateWithProvider (provider.Handle);
		}
Beispiel #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);
		}