本文整理汇总了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;
}
});
}
}
示例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;
}
});
}
}
示例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;
}
});
}
}
示例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));
}
}