Fonteditor/ArrayUtil.cs
/// <summary>
/// Reads simple stringfied array into a 2d array of bytes
/// </summary>
/// <param name="arrayAsText"></param>
/// <param name="width">Character width</param>
/// <param name="height">Character height</param>
/// <returns>2d byte array of palette indexes</returns>
Reads simple stringfied array into a 2d array of bytes
Reads simple stringfied array into a 2d array of bytes
public static byte[,] Read2dArrayFromString(string arrayAsText, UInt16 width, UInt16 height)
        {
            byte[,] retMatrix = new byte[width, height];
            String[] byteStrings = SplitAtComma(arrayAsText, width, height);
            int d = 0;
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    retMatrix[x, y] = Convert.ToByte(byteStrings[d++]);
                }
            }
            return retMatrix;
        }
public static byte [ , ] Read2dArrayFromString ( string arrayAsText , UInt16 width , UInt16 height ) { byte [ , ] retMatrix = new byte [ width , height ] ; String [ ] byteStrings = SplitAtComma ( arrayAsText , width , height ) ; int d = 0 ; for ( int y = 0 ; y < height ; y ++ ) { for ( int x = 0 ; x < width ; x ++ ) { retMatrix [ x , y ] = Convert . ToByte ( byteStrings [ d ++ ] ) ; } } return retMatrix ; }
Reads simple stringfied array into a 2d array of bytes
Reads simple stringfied array into a 2d array of bytes
2d byte array of palette indexes
2d byte array of palette indexes
arrayAsText
string
None
width
UInt16
None
height
UInt16
None