Exemple #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));
 }
        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));
        }
Exemple #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));
        }
Exemple #4
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));
        }
 public static CGColorSpace CreateIccProfile(nfloat[] range, CGDataProvider profile, CGColorSpace alternate)
 public static CGColorSpace CreateIccData(CGDataProvider provider)
 {
     return(CreateIccData(provider.GetHandle()));
 }
 public CGPDFDocument(CGDataProvider provider)
     : base(CGPDFDocumentCreateWithProvider(Runtime.ThrowOnNull(provider, nameof(provider)).Handle), true)
 {
 }