本文整理汇总了C#中Square.RotateCCW方法的典型用法代码示例。如果您正苦于以下问题:C# Square.RotateCCW方法的具体用法?C# Square.RotateCCW怎么用?C# Square.RotateCCW使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Square
的用法示例。
在下文中一共展示了Square.RotateCCW方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public Bitmap Process(Bitmap inputBitmap)
{
if (inputBitmap == null)
throw new ArgumentNullException("inputBitmap");
if (Lerp == null)
throw new InvalidOperationException("Lerp is null");
if (Threshold == null)
throw new InvalidOperationException("Threshold is null");
Bitmap outputBitmap = new Bitmap(2 * inputBitmap.Width, 2 * inputBitmap.Height, inputBitmap.PixelFormat);
var inputBitmapData = inputBitmap.LockBits(new Rectangle(0, 0, inputBitmap.Width, inputBitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
var inputBitmapDataPixels = (BGRA*)inputBitmapData.Scan0.ToPointer();
var outputBitmapData = outputBitmap.LockBits(new Rectangle(0, 0, outputBitmap.Width, outputBitmap.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
var outputBitmapPixels = (BGRA*)outputBitmapData.Scan0.ToPointer();
//outputBitmap.LockBitsUnlock(PixelFormat.
for (int y = 0; y < inputBitmap.Height; y++)
{
var Row0 = outputBitmapPixels + (y * 2 + 0) * outputBitmap.Width;
var Row1 = outputBitmapPixels + (y * 2 + 1) * outputBitmap.Width;
for (int x = 0; x < inputBitmap.Width; x++)
{
//var square0 = new Square(this, inputBitmapDataPixels + y * inputBitmapData.Width + x, inputBitmapData.Width, inputBitmapData.Height, x, y);
var square0 = new Square(this, inputBitmapDataPixels, inputBitmapData.Width, inputBitmapData.Height, x, y);
var square90 = square0.RotateCCW();
var square180 = square90.RotateCCW();
var square270 = square180.RotateCCW();
Row0[2 * x + 0] = square0.Resolve();
Row0[2 * x + 1] = square90.Resolve();
Row1[2 * x + 1] = square180.Resolve();
Row1[2 * x + 0] = square270.Resolve();
//outputBitmap.SetPixel(2 * x + 0, 2 * y + 0, square0.Resolve().ToColor());
//outputBitmap.SetPixel(2 * x + 1, 2 * y + 0, square90.Resolve().ToColor());
//outputBitmap.SetPixel(2 * x + 1, 2 * y + 1, square180.Resolve().ToColor());
//outputBitmap.SetPixel(2 * x + 0, 2 * y + 1, square270.Resolve().ToColor());
}
}
outputBitmap.UnlockBits(outputBitmapData);
inputBitmap.UnlockBits(inputBitmapData);
return outputBitmap;
}