Hanna
Sourcecode Batteriemanagementsystem
Makrodefinitionen | Funktionen
gfx_text.c-Dateireferenz

Font and text drawing routines. Mehr ...

#include "compiler.h"
#include "stddef.h"
#include "assert.h"
#include "gfx.h"
#include "gfx_text.h"
Include-Abhängigkeitsdiagramm für gfx_text.c:

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define CONFIG_FONT_PIXELS_PER_BYTE   8
 
#define EXTMEM_BUF_SIZE   20
 

Funktionen

void gfx_draw_char (const char c, const gfx_coord_t x, const gfx_coord_t y, const struct font *font, const gfx_color_t bg_color, const gfx_color_t text_color)
 Draws a character to the display. Mehr ...
 
static void gfx_draw_char_progmem (const char ch, const gfx_coord_t x, const gfx_coord_t y, const struct font *font, const gfx_color_t color)
 Helper function that draws a character from a font in progmem to the display. Mehr ...
 
void gfx_draw_progmem_string (char PROGMEM_PTR_T str, gfx_coord_t x, gfx_coord_t y, const struct font *font, const gfx_color_t bg_color, const gfx_color_t text_color)
 Draws a string located in program memory to the display. Mehr ...
 
void gfx_draw_progmem_string_aligned (char PROGMEM_PTR_T str, gfx_coord_t x, gfx_coord_t y, const struct font *font, const gfx_color_t bg_color, const gfx_color_t text_color, enum gfx_text_position text_pos, enum gfx_text_alignment text_align)
 Draws an aligned string located in program memory to the display. Mehr ...
 
void gfx_draw_string (const char *str, gfx_coord_t x, gfx_coord_t y, const struct font *font, const gfx_color_t bg_color, const gfx_color_t text_color)
 Draws a string to the display. Mehr ...
 
void gfx_draw_string_aligned (const char *str, gfx_coord_t x, gfx_coord_t y, const struct font *font, const gfx_color_t bg_color, const gfx_color_t text_color, enum gfx_text_position text_pos, enum gfx_text_alignment text_align)
 Draws an aligned string to the display. Mehr ...
 
void gfx_get_progmem_string_bounding_box (char PROGMEM_PTR_T str, const struct font *font, gfx_coord_t *width, gfx_coord_t *height)
 Computes the bounding box of a string located in program memory. Mehr ...
 
void gfx_get_string_bounding_box (const char *str, const struct font *font, gfx_coord_t *width, gfx_coord_t *height)
 Computes the bounding box of a string. Mehr ...
 

Ausführliche Beschreibung

Font and text drawing routines.

Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.

Definiert in Datei gfx_text.c.

Dokumentation der Funktionen

void gfx_draw_char ( const char  c,
const gfx_coord_t  x,
const gfx_coord_t  y,
const struct font font,
const gfx_color_t  bg_color,
const gfx_color_t  text_color 
)

Draws a character to the display.

Parameter
cCharacter to be drawn
xX coordinate on screen.
yY coordinate on screen.
fontFont to draw character in
bg_colorBackground color to draw behind the text string
text_colorForeground color to draw the text string in

Definiert in Zeile 234 der Datei gfx_text.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

static void gfx_draw_char_progmem ( const char  ch,
const gfx_coord_t  x,
const gfx_coord_t  y,
const struct font font,
const gfx_color_t  color 
)
static

Helper function that draws a character from a font in progmem to the display.

This function will first calculate the start offset in the font character data before iterating over the specific character data.

Only pixels in the character that should be enabled are done so, the caller is required to prepare the drawing area before printing a character to it. This is done by the gfx_draw_string() and gfx_draw_progmem_string() functions.

Parameter
chCharacter to be drawn
xX coordinate on screen.
yY coordinate on screen.
fontFont to draw character in
colorForeground color to draw the character in

Definiert in Zeile 174 der Datei gfx_text.c.

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

void gfx_draw_progmem_string ( char PROGMEM_PTR_T  str,
gfx_coord_t  x,
gfx_coord_t  y,
const struct font font,
const gfx_color_t  bg_color,
const gfx_color_t  text_color 
)

Draws a string located in program memory to the display.

This function will draw a string located in program memory to the display, this differs from gfx_draw_string() by using constant string data from the program memory instead of string data in RAM.

Using program memory for constant strings will reduce the applications need for RAM, and thus lower the overall size footprint.

Parameter
strPointer to string located in program memory
xX coordinate on screen.
yY coordinate on screen.
fontFont to draw string in
bg_colorBackground color to draw behind the text string
text_colorForeground color to draw the text string in

Definiert in Zeile 389 der Datei gfx_text.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

void gfx_draw_progmem_string_aligned ( char PROGMEM_PTR_T  str,
gfx_coord_t  x,
gfx_coord_t  y,
const struct font font,
const gfx_color_t  bg_color,
const gfx_color_t  text_color,
enum gfx_text_position  text_pos,
enum gfx_text_alignment  text_align 
)

Draws an aligned string located in program memory to the display.

This function will draw a string located in program memory to the display with the specified alignment. This differs from gfx_draw_aligned_string() by using constant string data from the program memory instead of string data in RAM.

Parameter
strPointer to string located in program memory
xX coordinate on screen.
yY coordinate on screen.
fontFont to draw string in
bg_colorBackground color to draw behind the text string
text_colorForeground color to draw the text string in
text_posPosition of the coordinate relative to the text paragraph
text_alignAlignment of text lines within the paragraph bounding box

Definiert in Zeile 414 der Datei gfx_text.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

void gfx_draw_string ( const char *  str,
gfx_coord_t  x,
gfx_coord_t  y,
const struct font font,
const gfx_color_t  bg_color,
const gfx_color_t  text_color 
)

Draws a string to the display.

This function will draw a string located in memory to the display.

Parameter
strPointer to string
xX coordinate on screen.
yY coordinate on screen.
fontFont to draw string in
bg_colorBackground color to draw behind the text string
text_colorForeground color to draw the text string in

Definiert in Zeile 272 der Datei gfx_text.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

void gfx_draw_string_aligned ( const char *  str,
gfx_coord_t  x,
gfx_coord_t  y,
const struct font font,
const gfx_color_t  bg_color,
const gfx_color_t  text_color,
enum gfx_text_position  text_pos,
enum gfx_text_alignment  text_align 
)

Draws an aligned string to the display.

This function will draw a string located in memory to the display with the specified alignment.

Parameter
strPointer to string
xX coordinate on screen.
yY coordinate on screen.
fontFont to draw string in
bg_colorBackground color to draw behind the text string
text_colorForeground color to draw the text string in
text_posPosition of the coordinate relative to the text paragraph
text_alignAlignment of text lines within the paragraph bounding box

Definiert in Zeile 295 der Datei gfx_text.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

void gfx_get_progmem_string_bounding_box ( char PROGMEM_PTR_T  str,
const struct font font,
gfx_coord_t width,
gfx_coord_t height 
)

Computes the bounding box of a string located in program memory.

Zu beachten
If string is empty the returned width will be 1 pixel and the height equal to the font height.
Parameter
strString in program memory to calculate bounding box for
fontFont used
widthPointer to width result
heightPointer to height result

Definiert in Zeile 565 der Datei gfx_text.c.

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

void gfx_get_string_bounding_box ( const char *  str,
const struct font font,
gfx_coord_t width,
gfx_coord_t height 
)

Computes the bounding box of a string.

Zu beachten
If string is empty the returned width will be 1 pixel and the height equal to the font height.
Parameter
strString to calculate bounding box for
fontFont used
widthPointer to width result
heightPointer to height result

Definiert in Zeile 519 der Datei gfx_text.c.

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird: