示例#1
0
 /// <summary>
 /// Converts a <see cref="ICanvas"/> to a byte array.
 /// The array is build up of [ (32 + 64 x PolygonEdgeCount ) x PolygonCount ] bits.
 /// </summary>
 /// <example>
 /// given canvas of two triangles (total 56 bytes):
 /// bit     |   Description
 ///   0- 31     RGBA triangle 1 (4x byte)
 ///  32- 95     Coordinate 1 triangle 1 (tuple of 2x int)
 ///  96-159     Coordinate 2 triangle 1 (tuple of 2x int)
 /// 160-223     Coordinate 3 triangle 1 (tuple of 2x int)
 /// 224-255     RGBA triangle 2 (4x bytes)
 /// 256-319     Coordinate 1 triangle 2 (tuple of 2x int)
 /// 320-383     Coordinate 2 triangle 2 (tuple of 2x int)
 /// 384-447     Coordinate 3 triangle 2 (tuple of 2x int)
 /// </example>
 /// <param name="canvas">The canvas to convert</param>
 /// <returns>Byte array representing the canvas</returns>
 public static bool[] AsBitArray(this ICanvas canvas)
 {
     return(canvas.AsByteArray().AsBitArray());
 }