// Shift Char.Width pixels to the right + 1 Pixel for Seperation.
shift+=c.w+1;
}
bmp.Save(path);
Console.WriteLine("Bitmap saved!");
}
}
publicclassFont{
publicbyte[,]data{get;privateset;}
publicList<Char>chars{get;privateset;}
publicFont(byte[,]data){
this.chars=newList<Char>();
this.data=data;
this.getCharacters();
}
/// <summary>
/// attempts to read all characters stored in the data[,] information by splitting all characters using the grayscale value of '150' as given in the task.
/// all readable characters will be stored in the chars-List<Char>
/// </summary>
privatevoidgetCharacters(){
inti=0,count=0;
// a new list, containing byte[]s to store the vertical row of pixels for each character
List<byte[]>strip=newList<byte[]>();
// clear the character list, just in case this font was already written before.
chars.Clear();
do{
// Do we have a seperating greyscale code?
if(data[i,0]==150&&i>0){
// create a new 2 dimensional byte where we can temporarily write the character into