mikroSDK Reference Manual
|
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. | |
void gl_clear | ( | gl_color_t | color | ) |
Borders set by user using gl_set_crop_borders will be ignored.
[in] | color | The color that is used for painting. See gl_color_t definition for detailed explanation. |
Example :
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 .
[in] | x | X coordinate of center. |
[in] | y | y coordinate of center. |
[in] | radius | radius of arc. |
[in] | start | the angle made with x axis which determins where arc stars. |
[in] | end | the angle made withh x axis which determins where do arc ends. |
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.
[in] | dest | Rectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation. |
[in] | src | Rectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation. |
[in] | image | Pointer to image. |
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.
[in] | dest | Rectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation. |
[in] | src | Rectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation. |
[in] | image | Pointer to image. |
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.
[in] | dest | Rectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation. |
[in] | src | Rectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation. |
[in] | image | Pointer to image. |
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.
[in] | dest | Rectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation. |
[in] | src | Rectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation. |
[in] | image | Pointer to image. |
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.
[in] | ch | Character to draw. |
[in] | x | X coordinate. See gl_coord_t definition for detailed explanation. |
[in] | y | Y coordinate. See gl_coord_t definition for detailed explanation. |
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 .
[in] | x0 | X coordinate of center. |
[in] | y0 | Y coordinate of center. |
[in] | radius | Circle radius. |
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 .
[in] | x0 | X coordinate of the center. |
[in] | y0 | Y coordinate of the center. |
[in] | half_a | Semi-length on the X axis. |
[in] | half_b | Semi-length on the Y axis. |
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 .
[in] | dest | Rectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation. |
[in] | src | Rectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation. |
[in] | image | Pointer to 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.
[in] | dest | Rectangle that represents destination where picture wil be drawn. See gl_rectangle_t structure definition for detailed explanation. |
[in] | src | Rectangle that represents part of image that will be draw into destination, et. dest rectangle. See gl_rectangle_t structure definition for detailed explanation. |
[in] | image | Pointer to image. |
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 .
[in] | x1 | X coordinate of point A. |
[in] | y1 | Y coordinate of point A. |
[in] | x2 | X coordinate of point B. |
[in] | y2 | Y coordinate of point B. |
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 .
[in] | x | X coordinate of point. |
[in] | y | Y coordinate of point. |
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 .
[in] | top_left_x | X coordinate of rectangle's top and left corner. |
[in] | top_left_y | Y coordinate of rectangle's top and left corner. |
[in] | width | Width of rectangle. |
[in] | height | Height of rectangle. |
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 .
[in] | top_left_x | X coordinate of rectangle's top and left corner. |
[in] | top_left_y | Y coordinate of rectangle's top and left corner. |
[in] | width | Width of rectangle. |
[in] | height | Height of rectangle. |
[in] | radius | Radius of rounded corners. |
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.
[in] | text | Text to draw. |
[in] | x | X coordinate. See gl_coord_t definition for detailed explanation. |
[in] | y | Y coordinate. See gl_coord_t definition for detailed explanation. |
uint16_t gl_get_inner_pen | ( | ) |
Example :
uint16_t gl_get_outer_pen | ( | ) |
uint16_t gl_get_screen_height | ( | ) |
uint16_t gl_get_screen_width | ( | ) |
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.
[in] | text | Text to measure. |
text
if font is set, otherwise returns size = {0, 0}. See gl_size_t definition for detailed explanation.gl_image_format_t gl_image_format | ( | const uint8_t *__generic_ptr | image | ) |
The information is read from the image.
[in] | image | Pointer to image. |
uint16_t gl_image_height | ( | const uint8_t *__generic_ptr | image | ) |
The information is read from the image.
[in] | image | Pointer to image. |
uint16_t gl_image_width | ( | const uint8_t *__generic_ptr | image | ) |
The information is read from the image.
[in] | image | Pointer to image. |
void gl_set_brush_color | ( | gl_color_t | color | ) |
This affects every drawing in the future when brush style if GL_BRUSH_STYLE_FILL.
[in] | color | the color for painting non gradient style. See gl_color_t definition for detailed explanation. |
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.
[in] | color | determins the color from which the gradient starts. See gl_color_t definition for detailed explanation. |
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.
[in] | color | determins the color with which the gradient ends. See gl_color_t definition for detailed explanation. |
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.
[in] | style | a style for painting shapes. See gl_brush_style_t definition for detailed explanation. |
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.
[in] | left | Left border. |
[in] | top | Top border. |
[in] | bottom | Bottom border. |
[in] | right | Right border. |
Example :
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.
[in] | driver | the driver that will be set as active. See gl_driver_t definition for detailed explanation. |
Example :
void gl_set_font | ( | const uint8_t * | font | ) |
[in] | font | The font generated by NectoStudio. |
Example :
void gl_set_font_background | ( | bool | enable | ) |
[in] | enable | the indicator for determining if background behind character should be painted. |
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.
[in] | background | the color of the background of character. See gl_color_t definition for detailed explanation. |
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.
[in] | orientation | the font orientation. See gl_set_font_orientation definition for detailed explanation. |
Example :
void gl_set_inner_pen | ( | uint16_t | width_inside_object | ) |
[in] | width_inside_object | the 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 :
void gl_set_outer_pen | ( | uint16_t | width_outside_object | ) |
[in] | width_outside_object | the 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 :
void gl_set_pen | ( | gl_color_t | color, |
uint16_t | width ) |
[in] | color | the color of the pen. See gl_color_t definition for detailed explanation. |
[in] | width | the 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 :
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.
[in] | color | The color of the pen. See gl_color_t definition for detailed explanation. |
Example :
void gl_set_pen_width | ( | uint16_t | width | ) |
[in] | width | the 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 :