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


C# IImageProvider.GetInfoAsync方法代码示例

本文整理汇总了C#中IImageProvider.GetInfoAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IImageProvider.GetInfoAsync方法的具体用法?C# IImageProvider.GetInfoAsync怎么用?C# IImageProvider.GetInfoAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IImageProvider的用法示例。


在下文中一共展示了IImageProvider.GetInfoAsync方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSize

		private static Size GetSize(IImageProvider provider)
		{
			if (provider is IImageSize)
			{
				return (provider as IImageSize).Size;
			}

			return provider.GetInfoAsync().AsTask().Result.ImageSize;
		}
开发者ID:nagyistoce,项目名称:Lumia-Imaging-SDK-Extras,代码行数:9,代码来源:DepthOfFieldEffect.cs

示例2: CreateFromTileSource

		/// <summary>
		/// Constructs an image source of a given size by repeating a given tile.
		/// </summary>
		/// <param name="requestedSize">The requested dimensions of a source.</param>
		/// <param name="tileSource">The IImageProvider that will be repeated.</param>
		/// <remarks>This is a convinience method that will look up the tileSource size before calling the public constructor. A rendering operation may be needed to compute the size, depending on the source. This may lead to reduced performance.</remarks>
		public static async Task<RepeatedTileImageSource> CreateFromTileSource(Size requestedSize, IImageProvider tileSource)
		{
			var tileSize = (await tileSource.GetInfoAsync()).ImageSize;

			return new RepeatedTileImageSource(requestedSize, tileSource, tileSize);
		}
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:12,代码来源:RepeatedTileImageSource.cs

示例3: LoadPhotoInternalAsync

        private async Task<SoftwareBitmap> LoadPhotoInternalAsync(IImageProvider unnormalizedSource)
        {
            DisposableHelper.TryDisposeAndSetToNull(ref m_source);

            var info = await unnormalizedSource.GetInfoAsync().AsTask().ConfigureAwait(false);
            var unnormalizedSourceSize = info.ImageSize;

            if ((uint)unnormalizedSourceSize.Width == 0 || (uint)unnormalizedSourceSize.Height == 0)
            {
                throw new ArgumentException("Image source appears to be zero sized.");
            }

            // Normalize source bitmap to ~5 MP
            m_sourceSize = NormalizeSourceSize(unnormalizedSourceSize);

			using(var bitmapRenderer = new SoftwareBitmapRenderer(unnormalizedSource))
            {
                bitmapRenderer.Size = m_sourceSize;
                bitmapRenderer.OutputOption = OutputOption.PreserveAspectRatio;
                bitmapRenderer.RenderOptions = RenderOptions.Cpu;

                var normalizedSourceBitmap = await bitmapRenderer.RenderAsync().AsTask().ConfigureAwait(false);

                m_source = new SoftwareBitmapImageSource(normalizedSourceBitmap);
            }

            using(var bitmapRenderer = new SoftwareBitmapRenderer(m_source))
            {
                bitmapRenderer.Size = PreviewSize;
                bitmapRenderer.OutputOption = OutputOption.PreserveAspectRatio;
                bitmapRenderer.RenderOptions = RenderOptions.Cpu;
                
                return await bitmapRenderer.RenderAsync().AsTask().ConfigureAwait(false);
            }
		}
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:35,代码来源:ImageProcessorRenderer.cs

示例4: GetSize

		private static Size GetSize(IImageProvider imageProvider)
		{
			return imageProvider.GetInfoAsync().AsTask().Result.ImageSize;
		}
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:4,代码来源:DepthOfFieldEffect.cs


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