mikroSDK Reference Manual
Graphic Library

Graphic Library. More...

Functions list

void gl_set_driver (gl_driver_t *driver)
 Sets the driver to the active state and enables drawing on whole display.
 
void gl_clear (gl_color_t color)
 Paint hole display with color. If driver is not set then function do nothing.
 
bool gl_set_crop_borders (gl_coord_t left, gl_coord_t top, gl_coord_t bottom, gl_coord_t right)
 Initialize borders for drawing on display.
 
void gl_set_font (const uint8_t *font)
 Initialize the active font to font. Active font is used for every text drawing.
 
void gl_set_font_orientation (gl_font_orientation_t orientation)
 Sets the active font orientation to orientation.
 
void gl_set_pen (gl_color_t color, uint16_t width)
 Sets the active pen width to width and its color to color. This affects every future drawing of shape by displaying pen so that one half of pen's width cover shape, and the rest of width is drew on the outside of shape.
 
void gl_set_pen_color (gl_color_t color)
 Sets the active pen's color to color.
 
void gl_set_pen_width (uint16_t width)
 Sets the active pen width to width. This affects every future drawing of shape by displaying pen so that one half of pen's width cover shape, and the rest of pen is drew on the outside of shape.
 
void gl_set_inner_pen (uint16_t width_inside_object)
 Sets width of inner part of active pen to width_inside_object. The old width of the pen drew on the outside of shape stays the same, ie. only width of inner part of shape is changed to given value. This affects every drawing of shape in the future.
 
uint16_t gl_get_inner_pen ()
 Returns the inner width of active pen.
 
void gl_set_outer_pen (uint16_t width_outside_object)
 Sets width of outer part of active pen to width_outside_object. The old width of the pen drew on the inside of shape stays the same, ie. only width of outer part of shape is changed to given value. This affects every drawing of shape in the future.
 
uint16_t gl_get_outer_pen ()
 Returns the outer width of active pen.
 
void gl_set_brush_style (gl_brush_style_t style)
 Sets active brush style to style.
 
void gl_set_brush_color (gl_color_t color)
 Sets active brush color to color.
 
void gl_set_brush_color_from (gl_color_t color)
 Sets the active start color to color.
 
void gl_set_brush_color_to (gl_color_t color)
 Sets the active end color to color.
 
void gl_set_font_background_color (gl_color_t background)
 Sets the active background color for texts to background.
 
void gl_set_font_background (bool enable)
 Sets active indicator for text backround to enable.
 
uint16_t gl_get_screen_width ()
 Returns the width of the display.
 
uint16_t gl_get_screen_height ()
 Returns the height of the display.
 
int gl_draw_image (gl_rectangle_t *dest, gl_rectangle_t *src, const uint8_t *__generic_ptr image)
 Draw image on display.
 
uint16_t gl_image_width (const uint8_t *__generic_ptr image)
 Gives width of the image.
 
uint16_t gl_image_height (const uint8_t *__generic_ptr image)
 Gives height of the image.
 
gl_image_format_t gl_image_format (const uint8_t *__generic_ptr image)
 Gives format of the image.
 
int gl_draw_jpeg_image (gl_rectangle_t *dest, gl_rectangle_t *src, const uint8_t *image)
 Draw image of jpeg format on display.
 
void gl_draw_bitmap_16bpp (gl_rectangle_t *dest, gl_rectangle_t *src, const uint8_t *image)
 Draw image of bitmap 16bpp format on display.
 
void gl_draw_bitmap_4bpp (gl_rectangle_t *dest, gl_rectangle_t *src, const uint8_t *image)
 Draw image of bitmap 4bpp format on display.
 
void gl_draw_bitmap_8bpp (gl_rectangle_t *dest, gl_rectangle_t *src, const uint8_t *image)
 Draw image of bitmap 8bpp format on display.
 
void gl_draw_bitmap_1bpp (gl_rectangle_t *dest, gl_rectangle_t *src, const uint8_t *image)
 Draw image of bitmap 1bpp format on display.
 
void gl_draw_rect (gl_coord_t top_left_x, gl_coord_t top_left_y, gl_uint_t width, gl_uint_t height)
 Draws rectangle to displey driver with top left corner positioned at top_left_x and top_left_y coordinates using pen and brush previously set.
 
void gl_draw_rect_rounded (gl_coord_t top_left_x, gl_coord_t top_left_y, gl_uint_t width, gl_uint_t height, gl_uint_t radius)
 Draw rounded rectangle to diplsay driver using previously set pen and brush.
 
void gl_draw_point (gl_coord_t x, gl_coord_t y)
 Draw point to display driver using previously set pen.
 
void gl_draw_line (gl_coord_t x1, gl_coord_t y1, gl_coord_t x2, gl_coord_t y2)
 Draw line AB to display driver using previously set pen.
 
void gl_draw_circle (gl_coord_t x0, gl_coord_t y0, gl_uint_t radius)
 Draw circleto display driver using previously set pen and brush.
 
void gl_draw_ellipse (gl_coord_t x0, gl_coord_t y0, gl_uint_t half_a, gl_uint_t half_b)
 Draw ellipse to the display driver using previously set pen and brush.
 
void gl_draw_arc (gl_coord_t x, gl_coord_t y, gl_uint_t radius, gl_angle_t start, gl_angle_t end)
 Draw arc with center in given x and y coordinates and radius size. The start (end) of the arc is determined by start (end) angle made with x axis.
 
void gl_draw_char (uint8_t ch, gl_coord_t x, gl_coord_t y)
 Draws single character to display driver with top left pixel situated at given x and y coordinates.
 
void gl_draw_text (const uint8_t *__generic_ptr text, gl_coord_t x, gl_coord_t y)
 Draws text to display driver with top left pixel situated at given x and y coordinates using current font and pen.
 
gl_size_t gl_get_text_dimensions (const uint8_t *__generic_ptr text)
 Calculates text dimension for current font.
 

Function Documentation

◆ gl_clear()

void gl_clear ( gl_color_t color)

Borders set by user using gl_set_crop_borders will be ignored.

Parameters
[in]colorThe color that is used for painting. See gl_color_t definition for detailed explanation.

Example :

gl_driver_t driver;
...
TFT8_MAP_PINOUTS_16BIT(tft_cfg);
tft_cfg.board = &TFT_BOARD_7_CAPACITIVE;
tft8_init(&tft_cfg, &driver);
// Set driver.
gl_set_driver(&driver);
// Clear display
@ GL_WHITE
Definition gl_colors.h:237
void gl_clear(gl_color_t color)
Paint hole display with color. If driver is not set then function do nothing.
void gl_set_driver(gl_driver_t *driver)
Sets the driver to the active state and enables drawing on whole display.
The context structure for storing driver configuration.
Definition gl_types.h:148

◆ gl_draw_arc()

void gl_draw_arc ( gl_coord_t x,
gl_coord_t y,
gl_uint_t radius,
gl_angle_t start,
gl_angle_t end )

Coordinates are represented by special type gl_coord_t. Look of the shape can be cusomized using different pen and brush. To see how they can be set, visit gl.h .

Parameters
[in]xX coordinate of center.
[in]yy coordinate of center.
[in]radiusradius of arc.
[in]startthe angle made with x axis which determins where arc stars.
[in]endthe angle made withh x axis which determins where do arc ends.
Precondition
Before calling this function, be sure to initialize driver using gl_set_driver.
See also
gl_draw_circle, gl_set_pen, gl_set_brush_style, gl_set_brush_color, gl_set_brush_color_from, gl_set_brush_color_to.

◆ gl_draw_bitmap_16bpp()

void gl_draw_bitmap_16bpp ( gl_rectangle_t * dest,
gl_rectangle_t * src,
const uint8_t * image )

This function is declared as 'weak' witch means that user can redefine it and his new definition will be linked instead of definition from library. That way user can save RAM space when he draws an image but not of this image format. He just have to define this function with empty body. Also, user can write his own definition so that image is draw his way.

Parameters
[in]destRectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation.
[in]srcRectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation.
[in]imagePointer to image.
Returns
Returns zero if image is successfuly drawn, otherwise a number greater then zero iz returned.
Precondition
Before drawing driver must be set by gl_set_driver.
Note
Image must be generated by NectoStudio's resource generator.

◆ gl_draw_bitmap_1bpp()

void gl_draw_bitmap_1bpp ( gl_rectangle_t * dest,
gl_rectangle_t * src,
const uint8_t * image )

This function is declared as 'weak' witch means that user can redefine it and his new definition will be linked instead of definition from library. That way user can save RAM space when he draws an image but not of this image format. He just have to define this function with empty body. Also, user can write his own definition so that image is draw his way.

Parameters
[in]destRectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation.
[in]srcRectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation.
[in]imagePointer to image.
Returns
Returns zero if image is successfuly drawn, otherwise a number greater then zero iz returned.
Precondition
Before drawing driver must be set by gl_set_driver.
Note
Image must be generated by NectoStudio's resource generator.

◆ gl_draw_bitmap_4bpp()

void gl_draw_bitmap_4bpp ( gl_rectangle_t * dest,
gl_rectangle_t * src,
const uint8_t * image )

This function is declared as 'weak' witch means that user can redefine it and his new definition will be linked instead of definition from library. That way user can save RAM space when he draws an image but not of this image format. He just have to define this function with empty body. Also, user can write his own definition so that image is draw his way.

Parameters
[in]destRectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation.
[in]srcRectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation.
[in]imagePointer to image.
Returns
Returns zero if image is successfuly drawn, otherwise a number greater then zero iz returned.
Precondition
Before drawing driver must be set by gl_set_driver.
Note
Image must be generated by NectoStudio's resource generator.

◆ gl_draw_bitmap_8bpp()

void gl_draw_bitmap_8bpp ( gl_rectangle_t * dest,
gl_rectangle_t * src,
const uint8_t * image )

This function is declared as 'weak' witch means that user can redefine it and his new definition will be linked instead of definition from library. That way user can save RAM space when he draws an image but not of this image format. He just have to define this function with empty body. Also, user can write his own definition so that image is draw his way.

Parameters
[in]destRectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation.
[in]srcRectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation.
[in]imagePointer to image.
Returns
Returns zero if image is successfuly drawn, otherwise a number greater then zero iz returned.
Precondition
Before drawing driver must be set by gl_set_driver.
Note
Image must be generated by NectoStudio's resource generator.

◆ gl_draw_char()

void gl_draw_char ( uint8_t ch,
gl_coord_t x,
gl_coord_t y )

Character look depends on currently active font, pen, and orientation. Background color can also be specified.

Parameters
[in]chCharacter to draw.
[in]xX coordinate. See gl_coord_t definition for detailed explanation.
[in]yY coordinate. See gl_coord_t definition for detailed explanation.
Precondition
Before calling this function, be sure to initialize driver using gl_set_driver.
See also
gl_set_font gl_set_font_orientation gl_set_pen gl_set_font_background_color gl_set_font_background

◆ gl_draw_circle()

void gl_draw_circle ( gl_coord_t x0,
gl_coord_t y0,
gl_uint_t radius )

Coordinates are represented by special type gl_coord_t. Look of the shape can be cusomized using different pen and brush. To see how they can be set, visit gl.h .

Parameters
[in]x0X coordinate of center.
[in]y0Y coordinate of center.
[in]radiusCircle radius.
Precondition
Before calling this function, be sure to initialize driver using gl_set_driver.
See also
gl_draw_ellipse, gl_draw_arc, gl_set_pen, gl_set_brush_style, gl_set_brush_color, gl_set_brush_color_from, gl_set_brush_color_to.

◆ gl_draw_ellipse()

void gl_draw_ellipse ( gl_coord_t x0,
gl_coord_t y0,
gl_uint_t half_a,
gl_uint_t half_b )

Coordinates are represented by special type gl_coord_t. Look of the shape can be cusomized using different pen and brush. To see how they can be set, visit gl.h .

Parameters
[in]x0X coordinate of the center.
[in]y0Y coordinate of the center.
[in]half_aSemi-length on the X axis.
[in]half_bSemi-length on the Y axis.
Precondition
Before calling this function, be sure to initialize the driver using gl_set_driver.
See also
gl_draw_circle, gl_draw_arc, gl_set_pen, gl_set_brush_style, gl_set_brush_color, gl_set_brush_color_from, gl_set_brush_color_to.

◆ gl_draw_image()

int gl_draw_image ( gl_rectangle_t * dest,
gl_rectangle_t * src,
const uint8_t *__generic_ptr image )

Draw image on display for all supported formats. Function specialized for drawing exact image format, can be redefined by user. For that option look at gl_image_format_handlers.h .

Parameters
[in]destRectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation.
[in]srcRectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation.
[in]imagePointer to image.
Returns
Returns zero if image is successfuly drawn, otherwise a number greater then zero iz returned.
Precondition
Before drawing driver must be set by gl_set_driver.
Note
Image must be generated by NectoStudio's resource generator.
See also
gl_draw_jpeg_image, gl_draw_bitmap_16bpp, gl_draw_bitmap_8bpp, gl_draw_bitmap_4bpp, gl_draw_bitmap_1bpp

◆ gl_draw_jpeg_image()

int gl_draw_jpeg_image ( gl_rectangle_t * dest,
gl_rectangle_t * src,
const uint8_t * image )

This function is declared as 'weak' witch means that user can redefine it and his new definition will be linked instead of definition from library. That way user can save RAM space when he draws an image but not jpeg format image. He just have to define this function with empty body. Also, user can write his own definition so that image is draw his way.

Parameters
[in]destRectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation.
[in]srcRectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation.
[in]imagePointer to image.
Returns
Returns zero if image is successfuly drawn, otherwise a number greater then zero iz returned.
Precondition
Before drawing driver must be set by gl_set_driver.
Note
Image must be generated by NectoStudio's resource generator.

◆ gl_draw_line()

void gl_draw_line ( gl_coord_t x1,
gl_coord_t y1,
gl_coord_t x2,
gl_coord_t y2 )

Coordinates are represented by special type gl_coord_t. Look of the shape can be cusomized using different pen. To see how they can be set, visit gl.h .

Parameters
[in]x1X coordinate of point A.
[in]y1Y coordinate of point A.
[in]x2X coordinate of point B.
[in]y2Y coordinate of point B.
Precondition
Before calling this function, be sure to initialize driver using gl_set_driver.
See also
gl_draw_line, gl_set_pen_width, gl_set_pen_color.

◆ gl_draw_point()

void gl_draw_point ( gl_coord_t x,
gl_coord_t y )

Coordinates are represented by special type gl_coord_t. Look of the shape can be cusomized using different pen. To see how they can be set, visit gl.h .

Parameters
[in]xX coordinate of point.
[in]yY coordinate of point.
Precondition
Before calling this function, be sure to initialize driver using gl_set_driver.
See also
gl_draw_line, gl_set_pen_width, gl_set_pen_color.

◆ gl_draw_rect()

void gl_draw_rect ( gl_coord_t top_left_x,
gl_coord_t top_left_y,
gl_uint_t width,
gl_uint_t height )

Coordinates are represented by special type gl_coord_t. Look of the shape can be cusomized using different pen and brush. To see how they can be set, visit gl.h .

Parameters
[in]top_left_xX coordinate of rectangle's top and left corner.
[in]top_left_yY coordinate of rectangle's top and left corner.
[in]widthWidth of rectangle.
[in]heightHeight of rectangle.
Precondition
Before calling this function, be sure to initialize driver using gl_set_driver.
See also
gl_draw_rect_rounded, gl_set_pen, gl_set_brush_color, gl_set_brush_style

◆ gl_draw_rect_rounded()

void gl_draw_rect_rounded ( gl_coord_t top_left_x,
gl_coord_t top_left_y,
gl_uint_t width,
gl_uint_t height,
gl_uint_t radius )

Coordinates are represented by special type gl_coord_t. Look of the shape can be cusomized using different pen and brush. To see how they can be set, visit gl.h .

Parameters
[in]top_left_xX coordinate of rectangle's top and left corner.
[in]top_left_yY coordinate of rectangle's top and left corner.
[in]widthWidth of rectangle.
[in]heightHeight of rectangle.
[in]radiusRadius of rounded corners.
Precondition
Before calling this function, be sure to initialize driver using gl_set_driver.
See also
gl_draw_rect, gl_set_pen, gl_set_brush_color, gl_set_brush_style, gl_set_brush_color_from, gl_set_brush_color_to.

◆ gl_draw_text()

void gl_draw_text ( const uint8_t *__generic_ptr text,
gl_coord_t x,
gl_coord_t y )

To draw text with background use gl_set_font_background and gl_set_font_background_color. It is possible to choose text orientation by using gl_set_font_orientation.

Parameters
[in]textText to draw.
[in]xX coordinate. See gl_coord_t definition for detailed explanation.
[in]yY coordinate. See gl_coord_t definition for detailed explanation.
Precondition
Before calling this function, be sure to initialize driver using gl_set_driver.
See also
gl_set_font, gl_set_font_orientation, gl_set_pen, gl_set_font_background_color, gl_set_font_background.

◆ gl_get_inner_pen()

uint16_t gl_get_inner_pen ( )
Returns
the active pen's inner width, ie. part of pen that overlaps shape.

Example :

// First way:
gl_set_pen_width(20); // Set pen width 20 pixels. Automatic 10 pixels will be out of shape, and 10 in that shape.
uint16_t size = gl_get_inner_pen(); // Get inner pen.
gl_draw_rect(50, 50, 50, 50); // Draw rectangle.
gl_draw_text("Hello world!", 50 + size, 50 + size); // Draw text inside rectangle but not over the pen.
// Second way:
gl_draw_rect(60, 60, 40, 40);
gl_draw_text("Hello world!", 60, 60);
uint16_t gl_get_inner_pen()
Returns the inner width of active pen.
void gl_draw_text(const uint8_t *__generic_ptr text, gl_coord_t x, gl_coord_t y)
Draws text to display driver with top left pixel situated at given x and y coordinates using current ...
void gl_set_pen_width(uint16_t width)
Sets the active pen width to width. This affects every future drawing of shape by displaying pen so t...
void gl_set_inner_pen(uint16_t width_inside_object)
Sets width of inner part of active pen to width_inside_object. The old width of the pen drew on the o...
void gl_set_outer_pen(uint16_t width_outside_object)
Sets width of outer part of active pen to width_outside_object. The old width of the pen drew on the ...
void gl_draw_rect(gl_coord_t top_left_x, gl_coord_t top_left_y, gl_uint_t width, gl_uint_t height)
Draws rectangle to displey driver with top left corner positioned at top_left_x and top_left_y coordi...

◆ gl_get_outer_pen()

uint16_t gl_get_outer_pen ( )
Returns
the width of outer pen, ie. part of pen that doesn't overlap shape.

◆ gl_get_screen_height()

uint16_t gl_get_screen_height ( )
Returns
If the driver is not set returns zero, otherwise returns the height of the active display indicated by driver.
Precondition
The driver must be set first since only after that the dimension of display is known.

◆ gl_get_screen_width()

uint16_t gl_get_screen_width ( )
Returns
If the driver is not set returns zero, otherwise returns the width of the active display indicated by driver.
Precondition
The driver must be set first since only after that the dimension of display is known.

◆ gl_get_text_dimensions()

gl_size_t gl_get_text_dimensions ( const uint8_t *__generic_ptr text)

The size of the text depends on the font which has been set by gl_set_font.

Parameters
[in]textText to measure.
Returns
Size of text if font is set, otherwise returns size = {0, 0}. See gl_size_t definition for detailed explanation.
Precondition
Before calling this function, be sure to initialize font by calling gl_set_font.
See also
gl_draw_text, gl_draw_char, gl_set_font.

◆ gl_image_format()

gl_image_format_t gl_image_format ( const uint8_t *__generic_ptr image)

The information is read from the image.

Parameters
[in]imagePointer to image.
Returns
If the image is not null returns format of image, otherwise returns zero. See gl_image_format_t structure definition for detailed explanation.
Note
Image must be generated by NectoStudio's resource generator.

◆ gl_image_height()

uint16_t gl_image_height ( const uint8_t *__generic_ptr image)

The information is read from the image.

Parameters
[in]imagePointer to image.
Returns
If the image is not null returns height of the image, otherwise returns zero.
Note
Image must be generated by NectoStudio's resource generator.

◆ gl_image_width()

uint16_t gl_image_width ( const uint8_t *__generic_ptr image)

The information is read from the image.

Parameters
[in]imagePointer to image.
Returns
If the image is not null returns width of the image, otherwise returns zero.
Note
Image must be generated by NectoStudio's resource generator.

◆ gl_set_brush_color()

void gl_set_brush_color ( gl_color_t color)

This affects every drawing in the future when brush style if GL_BRUSH_STYLE_FILL.

Parameters
[in]colorthe color for painting non gradient style. See gl_color_t definition for detailed explanation.

◆ gl_set_brush_color_from()

void gl_set_brush_color_from ( gl_color_t color)

The active start color is used whenever a drawing of shape with some of gradient style is performed.

Parameters
[in]colordetermins the color from which the gradient starts. See gl_color_t definition for detailed explanation.

◆ gl_set_brush_color_to()

void gl_set_brush_color_to ( gl_color_t color)

The active end color is used whenever drawing of shape with some of gradient style is performed.

Parameters
[in]colordetermins the color with which the gradient ends. See gl_color_t definition for detailed explanation.

◆ gl_set_brush_style()

void gl_set_brush_style ( gl_brush_style_t style)

This affects every drawing in the future. By setting brush style its determined how shapes will be collored.

Parameters
[in]stylea style for painting shapes. See gl_brush_style_t definition for detailed explanation.

◆ gl_set_crop_borders()

bool gl_set_crop_borders ( gl_coord_t left,
gl_coord_t top,
gl_coord_t bottom,
gl_coord_t right )

Calculates intersection of display's borders and rectangle determined by left, top, bottom and right and change borders of active state to calculated ones. It affects every future drawing by cropping every part of the text or object which cross the set borders. If rectangle between left, top, bottom and right coordinates is completely out of display or left is greater then right or top is greater then bottom, then state will be same as if function was called with 0, 0, display_height, display_width, and whole display is available for future drawing. Every border is given by its coordinate. Left and right is given by x-axis and top and bottom by y-axis. See gl_coord_t definition for detailed explanation.

Parameters
[in]leftLeft border.
[in]topTop border.
[in]bottomBottom border.
[in]rightRight border.
Returns
If the driver is not set returns false, otherwise returns true.
Precondition
The driver must be set first since only after that the dimension (borders) of display is known.

Example :

gl_driver_t driver;
...
TFT8_MAP_PINOUTS_16BIT(tft_cfg);
tft_cfg.board = &TFT_BOARD_7_CAPACITIVE;
tft8_init(&tft_cfg, &driver);
// Set driver.
gl_set_driver(&driver);
gl_set_pen_width(0); // Turn off pen.
...
// Specify area on display for drawing.
gl_set_crop_borders(-1, -1, -1, -1); // Set hole display enabled becouse the area is invalid
gl_draw_lrect(50,50, 50, 50); // Hole rect is visible
...
// Specify area on display for drawing
gl_set_crop_borders(-5,-3, 75, 75); // Set borders for drawing on y=75 and x = 75 at right and bottom, while top and right borders are corrected to zeros.
gl_draw_rect(50, 50, 50,50); // Part of rect is cropped, and display has only rect between 50,50,75, 75
...
// Specify area on display for drawing
gl_set_crop_borders(250,250, 300, 300); // Set borders for drawing between coordinates y=250 and y=300, x=250 and x=300
gl_draw_rect(50, 50, 50,50); // Since rectangle does not apears in previously specified area, hole rect is not visble.
bool gl_set_crop_borders(gl_coord_t left, gl_coord_t top, gl_coord_t bottom, gl_coord_t right)
Initialize borders for drawing on display.

◆ gl_set_driver()

void gl_set_driver ( gl_driver_t * driver)

The given driver should contain information about display's width and height and, the most important, pointer to funciton for drawing one rectangle into the display.

Parameters
[in]driverthe driver that will be set as active. See gl_driver_t definition for detailed explanation.

Example :

gl_driver_t driver;
...
TFT8_MAP_PINOUTS_16BIT(tft_cfg);
tft_cfg.board = &TFT_BOARD_7_CAPACITIVE;
tft8_init(&tft_cfg, &driver);
// Set driver.
gl_set_driver(&driver);

◆ gl_set_font()

void gl_set_font ( const uint8_t * font)
Parameters
[in]fontThe font generated by NectoStudio.

Example :

extern const uint8_t* my_font;
gl_set_font(my_font);
...
gl_draw_text('Hello World', 50, 50);
gl_size_t size;
size = gl_get_text_dimensions("Hello World");
gl_draw_rect(50 + size.width , 50, 20, size.height);
void gl_set_font(const uint8_t *font)
Initialize the active font to font. Active font is used for every text drawing.
gl_size_t gl_get_text_dimensions(const uint8_t *__generic_ptr text)
Calculates text dimension for current font.
The context structure for storing width and height in number of pixels on the screen.
Definition gl_types.h:121
gl_uint_t width
Definition gl_types.h:122
gl_uint_t height
Definition gl_types.h:123

◆ gl_set_font_background()

void gl_set_font_background ( bool enable)
Parameters
[in]enablethe indicator for determining if background behind character should be painted.
See also
gl_set_font_background_color

◆ gl_set_font_background_color()

void gl_set_font_background_color ( gl_color_t background)

This will affect drawing text only if background is enabled. To enable drawing use gl_set_font_background.

Parameters
[in]backgroundthe color of the background of character. See gl_color_t definition for detailed explanation.

◆ gl_set_font_orientation()

void gl_set_font_orientation ( gl_font_orientation_t orientation)

Active font orientation determins direction of string and characters inside string whenever text is drawn. By default font orientation is horizontal.

Parameters
[in]orientationthe font orientation. See gl_set_font_orientation definition for detailed explanation.

Example :

extern const uint8_t* my_font;
gl_set_font(my_font);
...
gl_set_font_orientation(GL_FONT_HORIZONTAL);
gl_draw_text('Horizontal text', 50, 50);
gl_draw_text('Vertical text rotated to right', 50, 50);
gl_draw_text('Vertical text', 50, 50);
@ GL_FONT_VERTICAL_COLUMN
Definition gl_types.h:89
@ GL_FONT_VERTICAL
Definition gl_types.h:88
@ GL_FONT_HORIZONTAL
Definition gl_types.h:87
void gl_set_font_orientation(gl_font_orientation_t orientation)
Sets the active font orientation to orientation.

◆ gl_set_inner_pen()

void gl_set_inner_pen ( uint16_t width_inside_object)
Parameters
[in]width_inside_objectthe width of inner pen, ie. part of pen that overlaps shape.

If the shape is less then inner part of pen, the rest of inner pen will just be ignored, it wont afect outer pen to change.

Example :

gl_set_brush_color(GL_RED); // Set brush color.
gl_set_brush_style(GL_BRUSH_STYLE_FILL); // Set brush style to paint all shape with one color.
gl_set_pen_color(GL_GREEN); // Set pen color.
...
gl_set_pen_width(20); // Set pen width 20 pixels. Automatic 10 pixels will be out of shape, and 10 in that shape.
gl_draw_circle(50, 50, 35); // Draw circle with ring.
// Circle has radius r = 25 pixels, and ring is between r = 25pixels and r = 45pixels.
...
gl_set_outer_pen(0); // Set outer pen.
gl_set_inner_pen(20); // Set inner pen.
gl_draw_circle(50, 100, 35); // Draw circle with ring.
// Circle has radius r = 15 pixels, and ring is between r = 15 pixels and r = 35 pixels.
...
gl_set_outer_pen(20); // Set outer pen.
gl_set_inner_pen(0); // Set inner pen.
gl_draw_circle(50, 100, 35); // Draw circle with ring.
// Circle has radius r = 35 pixels, and ring is between r = 35 pixels and r = 55 pixels.
@ GL_RED
Definition gl_colors.h:213
@ GL_GREEN
Definition gl_colors.h:148
@ GL_BRUSH_STYLE_FILL
Definition gl_types.h:62
void gl_set_pen_color(gl_color_t color)
Sets the active pen's color to color.
void gl_set_brush_style(gl_brush_style_t style)
Sets active brush style to style.
void gl_set_brush_color(gl_color_t color)
Sets active brush color to color.
void gl_draw_circle(gl_coord_t x0, gl_coord_t y0, gl_uint_t radius)
Draw circleto display driver using previously set pen and brush.

◆ gl_set_outer_pen()

void gl_set_outer_pen ( uint16_t width_outside_object)
Parameters
[in]width_outside_objectthe width of outer pen, ie. part of pen that doesn't overlap shape.

If the shape is less then inner part of pen, the rest of inner pen will just be ignored, it won't affect outer pen to change.

Example :

◆ gl_set_pen()

void gl_set_pen ( gl_color_t color,
uint16_t width )
Parameters
[in]colorthe color of the pen. See gl_color_t definition for detailed explanation.
[in]widththe width of the pen.

If the shape is less then inner part of pen, the rest of inner pen will just be ignored, it wont afect outer pen to change.

Example :

...
gl_draw_circle(50, 50 20);
gl_draw_rect(100, 50, 20, 30);
...
gl_draw_circle(50, 50 20);
gl_draw_rect(100, 50, 20, 30);
@ GL_YELLOW
Definition gl_colors.h:239
void gl_set_pen(gl_color_t color, uint16_t width)
Sets the active pen width to width and its color to color. This affects every future drawing of shape...

◆ gl_set_pen_color()

void gl_set_pen_color ( gl_color_t color)

This affects every future drawing of shape by painting pen in given color if pen width is not zero.

Parameters
[in]colorThe color of the pen. See gl_color_t definition for detailed explanation.

Example :

gl_set_pen(GL_RED, 10); // Set both pen color and width.
gl_draw_rect(10, 50, 10, 10); // Draw rectangle with red pen 10 pixels width.
...
gl_set_pen_color(GL_GREEN); // Change only pen color.
gl_draw_rect(50, 50, 50, 50); // Draw with green pen 10 pixels width.

◆ gl_set_pen_width()

void gl_set_pen_width ( uint16_t width)
Parameters
[in]widththe width of the pen.

If the shape is less then inner part of pen, the rest of inner pen will just be ignored, it wont afect outer pen to change.

Example :

gl_set_pen(GL_RED, 10); // Set both pen color and width.
gl_draw_rect(10, 50, 10, 10); // Draw rectangle with red pen 10 pixels width.
...
gl_set_pen_width(5); // Change only pen width.
gl_draw_rect(50, 50, 50, 50); // Draw with red pen 5 pixels width.