public static CGImageDestination FromData(NSData data, string typeIdentifier, int imageCount, CGImageDestinationOptions options)
#endif
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (typeIdentifier == null)
            {
                throw new ArgumentNullException("typeIdentifier");
            }

            var    dict   = options == null ? null : options.ToDictionary();
            var    typeId = NSString.CreateNative(typeIdentifier);
            IntPtr p      = CGImageDestinationCreateWithData(data.Handle, typeId, imageCount, dict == null ? IntPtr.Zero : dict.Handle);

            NSString.ReleaseNative(typeId);
            var ret = p == IntPtr.Zero ? null : new CGImageDestination(p, true);

            if (dict != null)
            {
                dict.Dispose();
            }
            return(ret);
        }
Example #2
0
        public void AddImage(CGImageSource source, int index, CGImageDestinationOptions?options = null)
        {
            if (source is null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            using var dict = options?.ToDictionary();
            CGImageDestinationAddImageFromSource(Handle, source.Handle, index, dict.GetHandle());
        }
Example #3
0
        public void AddImage(CGImage image, CGImageDestinationOptions?options = null)
        {
            if (image is null)
            {
                throw new ArgumentNullException(nameof(image));
            }

            using var dict = options?.ToDictionary();
            CGImageDestinationAddImage(Handle, image.Handle, dict.GetHandle());
        }
        public void AddImage(CGImageSource source, int index, CGImageDestinationOptions options = null)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            var dict = options == null ? null : options.ToDictionary();

            CGImageDestinationAddImageFromSource(handle, source.Handle, index, dict == null ? IntPtr.Zero : dict.Handle);
            if (dict != null)
            {
                dict.Dispose();
            }
        }
        public void AddImage(CGImage image, CGImageDestinationOptions options = null)
        {
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }

            var dict = options == null ? null : options.ToDictionary();

            CGImageDestinationAddImage(handle, image.Handle, dict == null ? IntPtr.Zero : dict.Handle);
            if (dict != null)
            {
                dict.Dispose();
            }
        }
        public void AddImageAndMetadata(CGImage image, CGImageMetadata meta, CGImageDestinationOptions options)
        {
            NSDictionary o = null;

            if (options != null)
            {
                o = options.ToDictionary();
            }
            try {
                AddImageAndMetadata(image, meta, o);
            }
            finally {
                if (options != null)
                {
                    o.Dispose();
                }
            }
        }
        public bool CopyImageSource(CGImageSource image, CGImageDestinationOptions options, out NSError error)
#endif
        {
            NSDictionary o = null;

            if (options != null)
            {
                o = options.ToDictionary();
            }
            try {
                return(CopyImageSource(image, o, out error));
            }
            finally {
                if (options != null)
                {
                    o.Dispose();
                }
            }
        }
Example #8
0
        public static CGImageDestination?Create(NSMutableData data, string typeIdentifier, int imageCount, CGImageDestinationOptions?options = null)
        {
            if (data is null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (typeIdentifier is null)
            {
                throw new ArgumentNullException(nameof(typeIdentifier));
            }

            using var dict = options?.ToDictionary();
            var typeId = CFString.CreateNative(typeIdentifier);

            try {
                IntPtr p = CGImageDestinationCreateWithData(data.Handle, typeId, imageCount, dict.GetHandle());
                return(p == IntPtr.Zero ? null : new CGImageDestination(p, true));
            } finally {
                CFString.ReleaseNative(typeId);
            }
        }
Example #9
0
 public void AddImageAndMetadata(CGImage image, CGImageMetadata meta, CGImageDestinationOptions?options)
 {
     using var o = options?.ToDictionary();
     AddImageAndMetadata(image, meta, o);
 }