Пример #1
0
        /// <summary>
        /// Converts a <see cref="UIImage"/> to a splat <see cref="IBitmap"/>.
        /// </summary>
        /// <param name="value">The native bitmap to convert from.</param>
        /// <param name="copy">Whether to copy the android bitmap or not.</param>
        /// <returns>A <see cref="IBitmap"/> bitmap.</returns>
        public static IBitmap FromNative(this UIImage value, bool copy = false)
        {
            if (copy)
            {
                return(new CocoaBitmap((UIImage)value.Copy()));
            }

            return(new CocoaBitmap(value));
        }
Пример #2
0
        /// <summary>
        /// Converts a <see cref="UIImage"/> to a splat <see cref="IBitmap"/>.
        /// </summary>
        /// <param name="value">The native bitmap to convert from.</param>
        /// <param name="copy">Whether to copy the android bitmap or not.</param>
        /// <returns>A <see cref="IBitmap"/> bitmap.</returns>
        public static IBitmap FromNative(this UIImage value, bool copy = false)
        {
            if (value is null)
            {
                throw new System.ArgumentNullException(nameof(value));
            }

            if (copy)
            {
                return(new CocoaBitmap((UIImage)value.Copy()));
            }

            return(new CocoaBitmap(value));
        }