Macros | Functions
String_api

Macros

#define GRAPHICS_ABSENT_CHAR_REPLACEMENT   '.'
 

Functions

int32_t Graphics_getStringWidth (const Graphics_Context *context, const int8_t *string, int32_t length)
 
void Graphics_drawString (const Graphics_Context *context, int8_t *string, int32_t length, int32_t x, int32_t y, bool opaque)
 
uint8_t Graphics_getStringBaseline (const Graphics_Context *context)
 
void Graphics_drawStringCentered (const Graphics_Context *context, int8_t *string, int32_t length, int32_t x, int32_t y, bool opaque)
 
uint8_t Graphics_getStringHeight (const Graphics_Context *context)
 
uint8_t Graphics_getStringMaxWidth (const Graphics_Context *context)
 

Detailed Description

Macro Definition Documentation

#define GRAPHICS_ABSENT_CHAR_REPLACEMENT   '.'

Function Documentation

int32_t Graphics_getStringWidth ( const Graphics_Context context,
const int8_t *  string,
int32_t  length 
)

Determines the width of a string.

Parameters
contextis a pointer to the drawing context to use.
stringis the string in question.
lengthis the length of the string.

This function determines the width of a string (or portion of the string) when drawn with a particular font. The length parameter allows a portion of the string to be examined without having to insert a NULL character at the stopping point (would not be possible if the string was located in flash); specifying a length of -1 will cause the width of the entire string to be computed.

Returns
Returns the width of the string in pixels.

References Graphics_Font::data, Graphics_FontEx::data, Graphics_FontEx::first, Graphics_Context::font, Graphics_Font::format, GRAPHICS_ABSENT_CHAR_REPLACEMENT, GRAPHICS_FONT_EX_MARKER, Graphics_FontEx::last, Graphics_Font::offset, and Graphics_FontEx::offset.

Referenced by Graphics_drawStringCentered().

void Graphics_drawString ( const Graphics_Context context,
int8_t *  string,
int32_t  length,
int32_t  x,
int32_t  y,
bool  opaque 
)

Draws a string.

Parameters
contextis a pointer to the drawing context to use.
stringis a pointer to the string to be drawn.
lengthis the number of characters from the string that should be drawn on the screen.
xis the X coordinate of the upper left corner of the string position on the screen.
yis the Y coordinate of the upper left corner of the string position on the screen.
opaqueis true if the background of each character should be drawn and false if it should not (leaving the background as is).

This function draws a string of test on the screen. The length parameter allows a portion of the string to be examined without having to insert a NULL character at the stopping point (which would not be possible if the string was located in flash); specifying a length of -1 will cause the entire string to be rendered (subject to clipping).

Returns
None.

References Graphics_Context::background, Graphics_Context::clipRegion, Graphics_Font::data, Graphics_FontEx::data, Graphics_Context::display, Graphics_FontEx::first, Graphics_Context::font, Graphics_Context::foreground, Graphics_Font::format, GRAPHICS_ABSENT_CHAR_REPLACEMENT, Graphics_drawLineH(), Graphics_drawPixelOnDisplay(), GRAPHICS_FONT_EX_MARKER, GRAPHICS_FONT_FMT_UNCOMPRESSED, Graphics_FontEx::last, Graphics_Font::offset, Graphics_FontEx::offset, Graphics_Rectangle::xMax, Graphics_Rectangle::xMin, Graphics_Rectangle::yMax, and Graphics_Rectangle::yMin.

Referenced by Graphics_drawCheckBox(), Graphics_drawRadioButton(), and Graphics_drawStringCentered().

uint8_t Graphics_getStringBaseline ( const Graphics_Context context)

Gets the baseline of a string.

Parameters
contextis a pointer to the drawing context to query.

This function determines the baseline position of a string. The baseline is the offset between the top of the string and the bottom of the capital letters. The only string data that exists below the baseline are the descenders on some lower-case letters (such as ``y'').

Returns
Returns the baseline of the string, in pixels.

References Graphics_Font::baseline, and Graphics_Context::font.

void Graphics_drawStringCentered ( const Graphics_Context context,
int8_t *  string,
int32_t  length,
int32_t  x,
int32_t  y,
bool  opaque 
)

Draws a centered string.

Parameters
contextis a pointer to the drawing context to use.
stringis a pointer to the string to be drawn.
lengthis the number of characters from the string that should be drawn on the screen.
xis the X coordinate of the center of the string position on the screen.
yis the Y coordinate of the center of the string position on the screen.
opaqueis true if the background of each character should be drawn and false if it should not (leaving the background as is).

This function draws a string of test on the screen centered upon the provided position. The lLength parameter allows a portion of the string to be examined without having to insert a NULL character at the stopping point (which would not be possible if the string was located in flash); specifying a length of -1 will cause the entire string to be rendered (subject to clipping).

Returns
None.

References Graphics_Font::baseline, Graphics_Context::font, Graphics_drawString(), and Graphics_getStringWidth().

uint8_t Graphics_getStringHeight ( const Graphics_Context context)

Gets the height of a string.

Parameters
contextis a pointer to the drawing context to query.

This function determines the height of a string. The height is the offset between the top of the string and the bottom of the string, including any ascenders and descenders. Note that this will not account for the case where the string in question does not have any characters that use descenders but the font in the drawing context does contain characters with descenders.

Returns
Returns the height of the string, in pixels.

References Graphics_Context::font, and Graphics_Font::height.

uint8_t Graphics_getStringMaxWidth ( const Graphics_Context context)

Gets the maximum width of a character in a string.

Parameters
contextis a pointer to the drawing context to query.

This function determines the maximum width of a character in a string. The maximum width is the width of the widest individual character in the font used to render the string, which may be wider than the widest character that is used to render a particular string.

Returns
Returns the maximum width of a character in a string, in pixels.

References Graphics_Context::font, and Graphics_Font::maxWidth.


Copyright 2016, Texas Instruments Incorporated