Exemple #1
0
        private void CreateBitmaps()
        {
            CharBitmaps.Clear();

            var bb = new SolidBrush(Color.Black);
            var pr = new Pen(Color.DarkCyan);

            for (int charIndex = 0; charIndex < CodePage.CharacterCount; charIndex++)
            {
                var charBitmap = new Bitmap(CharacterWidth, CharacterHeight);
                var g          = Graphics.FromImage(charBitmap);

                var charData = _charData.Skip(charIndex * BytesPerChar).Take(BytesPerChar).ToArray();
                var pixels   = BinaryTools.BytesToBits(charData);

                var pixel = 0;

                for (int y = 0; y < CharacterHeight; y++)
                {
                    for (int x = 0; x < CharacterWidth; x++)
                    {
                        if (pixels[pixel])
                        {
                            g.FillRectangle(bb, x, y, 1, 1);
                        }

                        pixel++;
                    }
                }

                CharBitmaps.Add(charBitmap);
            }
        }
Exemple #2
0
        private byte[] CreateCharData(List <Bitmap> characters)
        {
            var charData = new List <byte>();

            foreach (var cb in characters)
            {
                charData.AddRange(BinaryTools.BitmapTo1BppData(cb));
            }

            return(charData.ToArray());
        }