Fonteditor/CharViewHandler.cs
/// <summary>
/// Draws a character in the given picture box
/// </summary>
Draws a character in the given picture box
Draws a character in the given picture box
public void Draw(Graphics graphics, Character character, bool showBits, bool showBoundary = false)
        {
            if (character == null) return;
            int usedWidth = character.Width;
            int usedHeight = character.Height;
            int bX = (int)Math.Ceiling(usedWidth * cBorderFactor); bX += bX % 2;
            int bY = (int)Math.Ceiling(usedHeight * cBorderFactor); bY += bY % 2;
            int fullWidth = usedWidth + bX;
            int fullHeight = usedHeight + bY;
            byte[,] matrix = new byte[fullWidth, fullHeight];
            int xOffs= (fullWidth - usedWidth) / 2;
            int yOffs= (fullHeight- usedHeight) / 2;
            for (int y = 0; y < usedWidth; y++)
            {
                for (int x = 0; x < usedHeight; x++)
                {
                    matrix[xOffs + x, yOffs + y] = character.Matrix[x, y];
                }
            }
            DrawMatrix(graphics, matrix, fullWidth, fullHeight, showBits, showBoundary, usedWidth, usedHeight);
        }
public void Draw ( Graphics graphics , Character character , bool showBits , bool showBoundary = false ) { if ( character == null ) return ; int usedWidth = character . Width ; int usedHeight = character . Height ; int bX = ( int ) Math . Ceiling ( usedWidth * cBorderFactor ) ; bX += bX % 2 ; int bY = ( int ) Math . Ceiling ( usedHeight * cBorderFactor ) ; bY += bY % 2 ; int fullWidth = usedWidth + bX ; int fullHeight = usedHeight + bY ; byte [ , ] matrix = new byte [ fullWidth , fullHeight ] ; int xOffs = ( fullWidth - usedWidth ) / 2 ; int yOffs = ( fullHeight - usedHeight ) / 2 ; for ( int y = 0 ; y < usedWidth ; y ++ ) { for ( int x = 0 ; x < usedHeight ; x ++ ) { matrix [ xOffs + x , yOffs + y ] = character . Matrix [ x , y ] ; } } DrawMatrix ( graphics , matrix , fullWidth , fullHeight , showBits , showBoundary , usedWidth , usedHeight ) ; }
Draws a character in the given picture box
Draws a character in the given picture box
graphics
Graphics
character
Character
showBits
bool
showBoundary
bool