当前位置: 首页>>代码示例>>C#>>正文


C# ImageSource.GetType方法代码示例

本文整理汇总了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 { }
 }
开发者ID:c0a5tar,项目名称:Mystique,代码行数:18,代码来源:LazyImage.cs

示例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);
 }
开发者ID:sbambach,项目名称:ATF,代码行数:20,代码来源:Icon.cs

示例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();
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:30,代码来源:BaseCellView.cs

示例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);
 }
开发者ID:sbambach,项目名称:ATF,代码行数:31,代码来源:Icon.cs


注:本文中的ImageSource.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。