mikroSDK Reference Manual
Graphics Library

Graphics Library API reference. More...

Modules

 Basic Library Configuration
 Basic Library Configuration API Reference.
 
 Drawing Images
 Image Drawing API.
 
 Image Graphics Format Handlers
 Declaration of function open for user redefinition.
 
 Drawing Shapes
 Shape Drawing API.
 
 Writing Text
 Text Writing API.
 

Detailed Description

API for configuring and manipulating Graphics library.

Example

#include "gl.h"
#include "board.h"
#include "tft8.h"
static gl_driver_t driver;
static tft8_cfg_t tft_cfg;
void main()
{
// initialize driver
TFT8_MAP_PINOUTS_16BIT(tft_cfg);
tft_cfg.board = &TFT_BOARD_7_CAPACITIVE;
tft8_init(&tft_cfg, &driver);
// prepare display for drawing
gl_set_driver(&driver); // set initialized driver
gl_clear(GL_ALICE_BLUE); // clear display
// it's not necessary to set crop borders, by default they cover the whole screen
// dont think about display dimension, make it wrong and let it be set according to display measures from driver.
gl_set_crop_borders(-1, -1, 1050, 1000);
gl_set_pen(GL_ORANGE, 10); // set thicker orange pen (outline of the shape)
gl_set_brush_color(GL_YELLOW); // brush color (inside the shape)
gl_draw_circle(10,10,100);
// if you want to adjust drawing to fit your screen better
// you can use gl_get_screen_width() and gl_get_screen_height()
// for better coordinate manipulation
gl_set_pen_width(0); // disable pen (shape outline)
gl_set_brush_style(GL_BRUSH_STYLE_GRADIENT_TOP_DOWN); // you can use gradient styles for coloring
// objects with no area use pen only, such as lines and points
gl_draw_line(200,140,160,190);
gl_draw_line(200,140,240,190);
gl_draw_line(200,220,160,290);
gl_draw_line(200,220,240,290);
gl_draw_rect_rounded(190,128,20,100,5);
gl_draw_circle(200,100,30);
}


GL_BRUSH_STYLE_GRADIENT_TOP_DOWN
Definition: gl_types.h:47
GL_BLUE
Definition: gl_colors.h:87
gl_driver_t
The context structure for storing driver configuration.
Definition: gl_types.h:129
gl_set_brush_color
void gl_set_brush_color(gl_color_t color)
Sets active brush color.
GL_GREEN
Definition: gl_colors.h:133
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)
Draw a rectangle on display.
GL_YELLOW
Definition: gl_colors.h:224
gl_set_brush_color_from
void gl_set_brush_color_from(gl_color_t color)
Sets the active start color.
GL_ORANGE
Definition: gl_colors.h:183
GL_PINK
Definition: gl_colors.h:193
gl_set_pen_width
void gl_set_pen_width(uint16_t width)
Sets the active pen width.
gl_get_screen_height
uint16_t gl_get_screen_height()
Returns the height of the display.
gl_set_driver
void gl_set_driver(gl_driver_t *driver)
Sets the driver to the active state and enables drawing on whole display.
gl_draw_line
void gl_draw_line(gl_coord_t x1, gl_coord_t y1, gl_coord_t x2, gl_coord_t y2)
Draw a line on the display.
gl_get_screen_width
uint16_t gl_get_screen_width()
Returns the width of the display.
gl_set_crop_borders
bool gl_set_crop_borders(gl_coord_t left, gl_coord_t right, gl_coord_t top, gl_coord_t bottom)
Initialize borders for drawing on display.
gl_set_brush_style
void gl_set_brush_style(gl_brush_style_t style)
Sets active brush style.
gl_clear
void gl_clear(gl_color_t color)
Paint whole display.
gl_set_brush_color_to
void gl_set_brush_color_to(gl_color_t color)
Sets the active end color.
GL_BRUSH_STYLE_FILL
Definition: gl_types.h:46
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)
Draw a rounded rectangle on display.
GL_LIGHT_GREEN
Definition: gl_colors.h:151
gl_set_pen
void gl_set_pen(gl_color_t color, uint16_t width)
Sets the active pen width and color.
GL_BLACK
Definition: gl_colors.h:85
gl.h
Graphics Library.
gl_draw_circle
void gl_draw_circle(gl_coord_t x0, gl_coord_t y0, gl_uint_t radius)
Draw a circle on display.
GL_ALICE_BLUE
Definition: gl_colors.h:78