Number Drawing - TBTerra/pictor GitHub Wiki

Draw Number Functions

The functions used for drawing numbers as decimal & hexadecimal digits, these functions require a font to be included in order to be used.


Commands

void pictorDrawD(const int16_t Number, const point Pos, const uint16_t ForegroundColour, const uint16_t BackgroundColour, const font * Font, uint8_t scale, uint8_t len);

Draws a number in decimal onto the screen at the specified position with a set font, and foreground and background colours. The number is padded to fill the specified length using spaces, use a length of 0 to ignore padding.

Parameters:

  1. Number - Number to be written to the screen.
  2. Pos - Point structure to the top-left corner of the first character's intended location.
  3. `ForegroundColour - Colour of the characters as a 656-RGB encoded colour.
  4. `BackgroundColour - Colour of the background as a 656-RGB encoded colour.
  5. Font - Pointer to the font array to be used for the characters.
  6. scale - Integer character size scale (Note: a scale of 1 gives a character 8 pixels tall by 8 pixels wide).
  7. len - Output width padded with spaces, the value is not truncated even if the result is larger than the length specified. To remove padding use the value 0.

uint8_t pictorDrawX(const uint8_t Value, const point Pos, const uint16_t ForegroundColour, const uint16_t BackgroundColour, const font * Font, uint8_t scale);

Draws a value in hexadecimal onto the screen at the specified position with a set font, and foreground and background colours.

Parameters:

  1. Value - 8-bit value to be written to the screen.
  2. Pos - Point structure to the top-left corner of the first character's intended location.
  3. ForegroundColour - Colour of the characters as a 656-RGB encoded colour.
  4. BackgroundColour - Colour of the background as a 656-RGB encoded colour.
  5. Font - Pointer to the font array to be used for the characters.
  6. scale - Integer character size scale (Note: a scale of 1 gives a character 8 pixels tall by 8 pixels wide).

Return Value:

  • Number of characters written to the screen.
⚠️ **GitHub.com Fallback** ⚠️