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


C# Image.Apply方法代码示例

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


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

示例1: Yuv444

		internal Yuv444(Image original) :
			this(original.Size, original.CoordinateSystem, original.Crop)
		{
			unsafe
			{
				int x = 0;
				int width = this.Size.Width;

				byte* yRow = (byte*)this.Y.Pointer;
				byte* yDestination = yRow;

				byte* uRow = (byte*)this.U.Pointer;
				byte* uDestination = uRow;

				byte* vRow = (byte*)this.V.Pointer;
				byte* vDestination = vRow;

				original.Apply(color =>
				{
					*(yDestination++) = color.Y;
					*(uDestination++) = color.U;
					*(vDestination++) = color.V;
					x++;
					if (x >= width)
					{
						x = 0;

						yRow += this.Y.Stride;
						yDestination = yRow;

						uRow += this.U.Stride;
						uDestination = uRow;

						vRow += this.V.Stride;
						vDestination = vRow;
					}
				});
			}
		}
开发者ID:imintsystems,项目名称:Kean,代码行数:39,代码来源:Yuv444.cs

示例2: Yuyv

		internal Yuyv(Image original) :
			this(original.Size, original.CoordinateSystem, original.Crop)
		{
			unsafe
			{
				int y = 0;
				int x = 0;
				int width = this.Size.Width;

				byte* row = (byte*)this.Pointer;
				byte* yDestination = row;
				byte* uDestination = row + 1;
				byte* vDestination = row + 3;

				original.Apply(color =>
				{
					*yDestination = color.Y;
					yDestination += 2;
					if (x % 2 == 0)
					{
						*uDestination = color.U;
						*vDestination = color.V;
						uDestination += 4;
						vDestination += 4;
					}
					x++;
					if (x >= width)
					{
						x = 0;
						y++;

						row += this.Stride;
						yDestination = row;
						uDestination = row + 1;
						vDestination = row + 3;
					}
				});
			}
		}
开发者ID:imintsystems,项目名称:Kean,代码行数:39,代码来源:Yuyv.cs

示例3: Bgr

		internal Bgr(Image original) :
			this(original.Size, original.CoordinateSystem, original.Crop)
		{
			unsafe
			{
				byte* row = (byte*)this.Pointer;
				int rowLength = this.Size.Width;
				Color.Bgr* rowEnd = (Color.Bgr*)row + rowLength;
				Color.Bgr* destination = (Color.Bgr*)row;
				original.Apply((color) =>
				{
					*(destination++) = color;
					if (destination >= rowEnd)
					{
						row += this.Stride;
						destination = (Color.Bgr*)row;
						rowEnd = (Color.Bgr*)row + rowLength;
					}
				});
			}
		}
开发者ID:imintsystems,项目名称:Kean,代码行数:21,代码来源:Bgr.cs

示例4: Bgra

		internal Bgra(Image original) :
			this(original.Size, original.CoordinateSystem, original.Crop)
		{
			unsafe
			{
				int* destination = (int*)this.Pointer;
				original.Apply(color => *((Color.Bgra*)destination++) = new Color.Bgra(color, 255));
			}
		}
开发者ID:imintsystems,项目名称:Kean,代码行数:9,代码来源:Bgra.cs


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