Skip to content

Graphics library

The graphics library provides a general Graphics object and brings ready-to-use advanced graphic elements like clock or histogram.

Numeric values passed to the graphics elements use integer numbers.

Values using integer numbers

This section explains how values are coded using integer numbers only.

Using integers only allows to avoid loading the library for real numbers, which requires 6 KB of memory.

A value is coded using two numbers:

  • a significand, int32_t number, already multiplied by the multiplier; and
  • a multiplier, int32_t unit, with 1 = default, 10 or 100.

value = significand / multiplier = number / unit

The unit provides the scale of the degrees passed.

The following calls of the draw() function are equivalent:

draw(90); // = 90 / 1
draw(90, 1); // = 90 / 1
draw(900, 10); // = 900 / 10
draw(9000, 100); // = 9000 / 100

Functions like cos32x100 and sin32x100 receive and return values multiplied by 100. The unit is set to 100.

int32_t cos32x100(int32_t degreesX100)
int32_t sin32x100(int32_t degreesX100)

int32_t are used instead of int64_t as some platforms do not support 64-bit numbers.

Back to top