本文整理汇总了C#中ImageSource.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ImageSource.GetType方法的具体用法?C# ImageSource.GetType怎么用?C# ImageSource.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageSource
的用法示例。
在下文中一共展示了ImageSource.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetImage
private static void SetImage(LazyImage image, ImageSource bitmap, Uri checkUri)
{
try
{
if (bitmap != null)
{
if (checkUri == null || image.UriSource == checkUri)
{
if (!bitmap.IsFrozen)
{
System.Diagnostics.Debug.WriteLine("unfreezed. source type is:" + bitmap.GetType());
}
image.Source = bitmap;
}
}
}
catch { }
}
示例2: SwapColorsWithoutCloningIfPossible
private static ImageSource SwapColorsWithoutCloningIfPossible(ImageSource imageSource, ColorCallback colorCallback)
{
ImageSource source = imageSource;
if (imageSource == null)
{
return source;
}
DrawingImage image = imageSource as DrawingImage;
if (image != null)
{
SwapColorsWithoutCloning(image.Drawing, colorCallback);
return source;
}
BitmapSource bitmapSource = imageSource as BitmapSource;
if (bitmapSource == null)
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "UnexpectedImageSourceType", new object[] { imageSource.GetType().Name }));
}
return SwapColors(bitmapSource, colorCallback);
}
示例3: UpdateBitmap
async void UpdateBitmap(ImageSource source, ImageSource previousSource = null)
{
if (Equals(source, previousSource))
return;
_imageView.SetImageResource(global::Android.Resource.Color.Transparent);
Bitmap bitmap = null;
IImageSourceHandler handler;
if (source != null && (handler = Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null)
{
try
{
bitmap = await handler.LoadImageAsync(source, Context);
}
catch (TaskCanceledException)
{
}
catch (IOException ex)
{
Log.Warning("Xamarin.Forms.Platform.Android.BaseCellView", "Error updating bitmap: {0}", ex);
}
}
_imageView.SetImageBitmap(bitmap);
if (bitmap != null)
bitmap.Dispose();
}
示例4: SwapColors
/// <summary>
/// Swap the colors in an image based on a color mapping provided by the ColorCallback</summary>
/// <param name="imageSource">Original image</param>
/// <param name="colorCallback">Callback to provide the color mapping</param>
/// <returns>Color-swapped image</returns>
public static ImageSource SwapColors(ImageSource imageSource, ColorCallback colorCallback)
{
if (colorCallback == null)
{
throw new ArgumentNullException("colorCallback");
}
ImageSource source = imageSource;
if (imageSource == null)
{
return source;
}
DrawingImage image = imageSource as DrawingImage;
if (image != null)
{
source = image = image.Clone();
SwapColorsWithoutCloning(image.Drawing, colorCallback);
source.Freeze();
return source;
}
BitmapSource bitmapSource = imageSource as BitmapSource;
if (bitmapSource == null)
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "UnexpectedImageSourceType", new object[] { imageSource.GetType().Name }));
}
return SwapColors(bitmapSource, colorCallback);
}