This code demonstrates how to create an image view in memory and write data into it to create a checkerboard pattern. Tiles are drawn pixel by pixel.
using System.Diagnostics;
using System;
{
public class CheckerBoard
{
{
const ulong tileCount = 10;
byte[] blackValue = new byte[]{ 0 };
byte[] whiteValue = new byte[]{ 255 };
ulong tilSizeInPixel = (ulong)(shape[0] / tileCount);
for (ulong i = 0; i < shape[0]; ++i)
{
for (ulong j = 0; j < shape[1]; ++j)
{
ulong tileIndexX = (ulong)(i / tilSizeInPixel);
ulong tileIndexY = (ulong)(j / tilSizeInPixel);
if ((tileIndexX + tileIndexY) % 2 == 0)
else
}
}
return image;
}
public static void Main(string[] args)
{
Stopwatch sw = new Stopwatch();
sw.Start();
var imageCheckerBoard = Build(1000);
sw.Stop();
Console.WriteLine("Checkerboard image generated in " + sw.ElapsedMilliseconds + " ms");
Console.WriteLine(imageCheckerBoard.ToString());
Console.WriteLine("SUCCESS");
}
}
}
Stores information about a data type.
Definition DataType.cs:24
This factory is aimed at creating dataset views.
Definition ImageViewFactory.cs:21
static ImageView Allocate(VectorXu64 shape, DataType type, ImageProperties properties, MetadataNode metadata)
Creates a memory image with the given shape and type.
Definition ImageViewFactory.cs:86
Interface representing an N dimensional image.
Definition ImageView.cs:30
unsafe void Write(VectorXu64 index, byte[] src)
Write value from a buffer at the given index.
Definition ImageView.cs:373
A dynamically sized arithmetic vector.
Definition VectorXu64.cs:14
Definition CreateDataFrame.cs:6
Definition AccessCapabilities.cs:11
DataTypeId
A collection of built-in data types.
Definition DataTypeId.cs:15