1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-10-31 19:04:44 +00:00

Add properties for font cell width/height

Can be used by visualizers.
This commit is contained in:
Andy McFadden 2020-08-12 20:48:45 -07:00
parent 31d466f0bd
commit 3f7d03c798
2 changed files with 21 additions and 1 deletions

View File

@ -18,7 +18,20 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
namespace CommonUtil { namespace CommonUtil {
/// <summary>
/// 8x8 monochrome cells. The right and bottom edges of each cell are left blank,
/// so glyphs can be packed tightly.
/// </summary>
public static class Font8x8 { public static class Font8x8 {
/// <summary>
/// Returns an 8-byte array for the specified character. Each byte represents one
/// row. The first byte holds the top row, and the most significant bit in each
/// byte is the leftmost pixel.
///
/// If no glyph is defined, returns the Unicode REPLACEMENT CHARACTER glyph.
/// </summary>
/// <param name="ch">Requested character.</param>
/// <returns>Reference to int[8] with data (do not modify contents).</returns>
public static int[] GetBitData(char ch) { public static int[] GetBitData(char ch) {
if (sBitData == null) { if (sBitData == null) {
InitBitData(); InitBitData();

View File

@ -141,8 +141,11 @@ namespace PluginCommon {
} }
/// <summary> /// <summary>
/// Draws an 8x8 character on the bitmap. /// Draws an 8x8 character cell on the bitmap.
/// </summary> /// </summary>
/// <remarks>
/// Might want a way to specify that the background shouldn't be drawn at all.
/// </remarks>
/// <param name="vb">Bitma to draw on.</param> /// <param name="vb">Bitma to draw on.</param>
/// <param name="ch">Character to draw.</param> /// <param name="ch">Character to draw.</param>
/// <param name="xc">X coord of upper-left pixel.</param> /// <param name="xc">X coord of upper-left pixel.</param>
@ -168,5 +171,9 @@ namespace PluginCommon {
yc++; yc++;
} }
} }
// Character cell dimensions.
public static int CharWidth { get { return 8; } }
public static int CharHeight { get { return 8; } }
} }
} }