Graphics Lib 1.0
Implementation of diferent functions to Draw Lines, Circles, Ellipses,Grids, and Polygons

Code size:10K Author:x-logan
Source files included:yes Version:1.0
Use circleOS:yes (1.3) Creation date:2007-11-18 20:37:40
Hardware modification:no Modification date:2009-01-22 12:00:02
Based on the STM32 Primer:All
Downloads:2053 Views:22107
Average ratings:3.04/5 (760 rates)

Download: (47 KB)


Revision by Raisonance :

This archive is updated with a Ride project adapted to Primer2.


This is a graphics library, there are 5 functions to Draw a Line, Circle, Ellipse, a Grid and a Polygon.


Breve descriptions of fuctions:

void GRAPHICS_DrawGrid(u8 x , u8 y, u8 Element_Width, u8 Element_Height, u8 Width, u8 Height, u16 Color, u16 Fill_Color, bool Fill,        
                                                    bool Grid);

This function Draw a Grid of With x Height with a made of Element_With x Element_Height rectangles. It can be specified if you want to draw a filled grid, or if you only want to draw the flled part of the grid.

void GRAPHICS_DrawLine(u8 START_x, u8 START_y, u8 END_x, u8 END_y, u16 Color);

This is an implementation of the Bresenham's line algorithm. It defines START POINT (START_x, START_y) and goes through the screen  setting a pixel  in the screen to the END POINT (END_x, END_y).

void GRAPHICS_DrawCircle(u8 CENTER_x, u8 CENTER_y, u8 RADIUS_r, u16 Color, u16 Fill_Color, bool Fill, bool Circle);

This is a variant of the Bresenham's line algorithm, the circle one. Given the center of the circle (CENTER_x, CENTER_y) with the radious RADIOUS_r it can draw a circle in the LCD. It can be specified if its gone a be a filled Circle or only the circumference of the circle.


void GRAPHICS_DrawEllipse( u8 CENTER_x, u8 CENTER_y, u8 RADIUS_a, u8 RADIUS_b, u16 Color, u16 Fill_Color, bool Fill,                                                                           bool Ellipse);

This is another variant of the Bresenham's line algorithm (by Jerry Van Aken), the ellipse one. Given the center of the circle (CENTER_x, CENTER_y) with the major axus RADIOUS_a and minor axis RADIOUS_b it can draw an ellipse. Same as before it can be specified the if it would be a fill present or not.

void GRAPHICS_DrawPolygon(s16 *points, s16 NUM_Points, u16 Line_Color)

This function will go across al the points specified in points, drawing a line between the par of points (x,y). the number of points must be specified.


- Revisions

1.0 First Releese