當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。