private static async void SetImage(UIBarItem uiButton, ImageSource source)
 {
     uiButton.Image = await source.GetImageAsync();
 }
예제 #2
0
        public async Task<string> GetBase64FromImageSource(ImageSource imageSource, ImageType imageType = ImageType.Jpeg)
        {
            var image = await imageSource.GetImageAsync();

            switch (imageType)
            {
                case ImageType.Jpeg:
                    return image.AsJPEG(0.75f).GetBase64EncodedString(NSDataBase64EncodingOptions.None);
                case ImageType.Png:
                    return image.AsPNG().GetBase64EncodedString(NSDataBase64EncodingOptions.None);
            }

            return null;
        }
 private static async void SetImage(UIButton uiButton, ImageSource source)
 {
     uiButton.SetImage(await source.GetImageAsync(), UIControlState.Normal);
 }
예제 #4
0
        public async Task<ImageSource> GetProcessedImageSourceAsync(ImageSource imageSource, ImageOptions options)
        {
            var uiImage = await imageSource.GetImageAsync();

            return ProcessImageSource(options, uiImage);
        }