Graphic Display v1.0.0
Control any mochrome display, with any microcontroller, in any amount.
Loading...
Searching...
No Matches
Graphic Display Functions

Graphic Display functions, used during Graphic Display Operation. More...

Functions

gd_error_e GD_Init (gd_t *Gd, gd_params_t *params)
 Initializes the Graphic Display module, configured with the parameters provided.
 
gd_error_e GD_Fill (gd_t *Gd, gd_color_e color)
 Fill the Frame Buffer with the provided color.
 
gd_error_e GD_UpdateScreen (gd_t *Gd)
 Update and refresh the update screen with the data into Frame Buffer.
 
gd_error_e GD_DrawPixel (gd_t *Gd, uint32_t x, uint32_t y, gd_color_e color)
 Write a color into the desired pixel in the frame buffer.
 
gd_error_e GD_WriteChar (gd_t *Gd, char ch, const gd_font_t *Font, gd_color_e color)
 Write a character into a Frame Buffer, with the lines with the desired color.
 
gd_error_e GD_WriteString (gd_t *Gd, char *str, const gd_font_t *Font, gd_color_e color)
 Write a string into frame buffer, with the character lines with the desired color.
 
gd_error_e GD_SetCursor (gd_t *Gd, uint32_t x, uint32_t y)
 Set the cursor to the position X,Y.
 
gd_error_e GD_Line (gd_t *Gd, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, gd_color_e color)
 Write a line into the frame buffer between (x1,y1) (x2,y2).
 
gd_error_e GD_DrawArc (gd_t *Gd, uint32_t x, uint32_t y, uint32_t radius, uint16_t start_angle, uint16_t sweep, gd_color_e color)
 Draw an arc into the frame buffer with center, radius, start angle, and sweep.
 
gd_error_e GD_DrawArcWithRadiusLine (gd_t *Gd, uint32_t x, uint32_t y, uint32_t radius, uint16_t start_angle, uint16_t sweep, gd_color_e color)
 Draw an arc into frame buffer with lines in the radius line.
 
gd_error_e GD_DrawCircle (gd_t *Gd, uint32_t par_x, uint32_t par_y, uint32_t par_r, gd_color_e color)
 Draw a complete circle with defined radius.
 
gd_error_e GD_FillCircle (gd_t *Gd, uint32_t par_x, uint32_t par_y, uint32_t par_r, gd_color_e par_color)
 Draw a circle filled with the provided color.
 
gd_error_e GD_Polyline (gd_t *Gd, gd_vertex_t *par_vertex, uint16_t par_size, gd_color_e color)
 Draw a polyline, composed by staigth lines connecting the points given by vertex array.
 
gd_error_e GD_DrawRectangle (gd_t *Gd, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, gd_color_e color)
 Draw a Rectangle between the position (x1,y1) and (x2,y2). The rectangle is not filled, just four lines of a thickness of 1px.
 
gd_error_e GD_FillRectangle (gd_t *Gd, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, gd_error_e color)
 Draw a filled rectangle between the pointes (x1,y1) and (x2,y2).
 
gd_error_e GD_DrawBitmap (gd_t *Gd, uint32_t x, uint32_t y, const unsigned char *bitmap, uint32_t w, uint32_t h, gd_color_e color)
 Draw a bitmap into the Frame Buffer. The bitmap is an array with the pixels on/off.
 
gd_error_e GD_SetContrast (gd_t *Gd, const uint8_t value)
 Set the contrast of the display, if are supported. If display doesn't have this routine, nothing will happens.
 
gd_error_e GD_SetDisplayOn (gd_t *Gd, bool on)
 Set display On or Off, if the display implements this routine.
 
bool GD_GetDisplayOn (gd_t *Gd)
 Gets the display On/Off state.
 

Detailed Description

Graphic Display functions, used during Graphic Display Operation.

Function Documentation

◆ GD_DrawArc()

gd_error_e GD_DrawArc ( gd_t * Gd,
uint32_t x,
uint32_t y,
uint32_t radius,
uint16_t start_angle,
uint16_t sweep,
gd_color_e color )

Draw an arc into the frame buffer with center, radius, start angle, and sweep.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
xX axis of the center of Arc.
yY axis of the center of Arc.
radiusRadius of the Arc.
start_angleInitial angle in degrees.
sweepSweep of the arc.
colorColor of the arc.
Returns
GD_OK if success.

◆ GD_DrawArcWithRadiusLine()

gd_error_e GD_DrawArcWithRadiusLine ( gd_t * Gd,
uint32_t x,
uint32_t y,
uint32_t radius,
uint16_t start_angle,
uint16_t sweep,
gd_color_e color )

Draw an arc into frame buffer with lines in the radius line.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
xX axis of the center of Arc.
yY axis of the center of Arc.
radiusRadius of the Arc.
start_angleInitial angle in degrees.
sweepSweep of the arc.
colorColor of the arc.
Returns
GD_OK if success.

◆ GD_DrawBitmap()

gd_error_e GD_DrawBitmap ( gd_t * Gd,
uint32_t x,
uint32_t y,
const unsigned char * bitmap,
uint32_t w,
uint32_t h,
gd_color_e color )

Draw a bitmap into the Frame Buffer. The bitmap is an array with the pixels on/off.

Note
You can use the Open LCD Assistant tool, I have choose this tool because are compatible with any OS.
Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
xStart X axis of bitmap.
yStart Y axis of bitmap.
bitmapBitmap array containing the image.
wThe Width of the bitmap. This parameter must be the real size of bitmap, we do not support image resize, yet.
hThe Height of the bitmap. This parameter must be the real size of bitmap, we do not support image resize, yet.
colorThe 'color' of the image. In practice, if parameter was GD_BLACK, this will invert the bitmap color, if was GD_WHITE, the original color is keeped.
Returns
GD_OK is success.

◆ GD_DrawCircle()

gd_error_e GD_DrawCircle ( gd_t * Gd,
uint32_t par_x,
uint32_t par_y,
uint32_t par_r,
gd_color_e color )

Draw a complete circle with defined radius.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
par_xX axis of the center of circle.
par_yY axis of the center of circle.
par_rRadius of the circle.
colorColor of the circle.
Returns
GD_OK if success.

◆ GD_DrawPixel()

gd_error_e GD_DrawPixel ( gd_t * Gd,
uint32_t x,
uint32_t y,
gd_color_e color )

Write a color into the desired pixel in the frame buffer.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
xX axis of pixel to write.
yY axis of pixel to write.
colorColor to write on the pixel.
Returns
GD_OK if success.

◆ GD_DrawRectangle()

gd_error_e GD_DrawRectangle ( gd_t * Gd,
uint32_t x1,
uint32_t y1,
uint32_t x2,
uint32_t y2,
gd_color_e color )

Draw a Rectangle between the position (x1,y1) and (x2,y2). The rectangle is not filled, just four lines of a thickness of 1px.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
x1X axis of first point of rectangle.
y1Y axis of first point of rectangle.
x2X axis of second point of rectangle.
y2Y axis of first second of rectangle.
colorColor of the rectangle borders.
Returns
GD_OK if success.

◆ GD_Fill()

gd_error_e GD_Fill ( gd_t * Gd,
gd_color_e color )

Fill the Frame Buffer with the provided color.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
colorThe color to fill the buffer, GD_BLACK to erase, GD_WHITE to turnon all pixels.
Returns
GD_OK if success.

◆ GD_FillCircle()

gd_error_e GD_FillCircle ( gd_t * Gd,
uint32_t par_x,
uint32_t par_y,
uint32_t par_r,
gd_color_e par_color )

Draw a circle filled with the provided color.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
par_xX axis of the center of circle.
par_yY axis of the center of circle.
par_rRadius of the circle.
par_colorColor of the circle.
Returns
GD_OK if success.

◆ GD_FillRectangle()

gd_error_e GD_FillRectangle ( gd_t * Gd,
uint32_t x1,
uint32_t y1,
uint32_t x2,
uint32_t y2,
gd_error_e color )

Draw a filled rectangle between the pointes (x1,y1) and (x2,y2).

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
x1X axis of first point of rectangle.
y1Y axis of first point of rectangle.
x2X axis of second point of rectangle.
y2Y axis of first second of rectangle.
colorColor of the entire rectangle.
Returns
GD_OK if success.

◆ GD_GetDisplayOn()

bool GD_GetDisplayOn ( gd_t * Gd)

Gets the display On/Off state.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
Returns
true if the display was online, false if not.

◆ GD_Init()

gd_error_e GD_Init ( gd_t * Gd,
gd_params_t * params )

Initializes the Graphic Display module, configured with the parameters provided.

Precondition
Initialize the display device driver, and provide the required parameters.
Parameters
GdPointer to the Graphic Display handle.
paramsPointer with the parameters of the Graphic Display.
Returns
GD_OK if operation is success.

◆ GD_Line()

gd_error_e GD_Line ( gd_t * Gd,
uint32_t x1,
uint32_t y1,
uint32_t x2,
uint32_t y2,
gd_color_e color )

Write a line into the frame buffer between (x1,y1) (x2,y2).

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
x1X axis for the first point.
y1Y axis for the first point.
x2X axis for the second point.
y2Y axis for the second point.
colorColor of the line.
Returns
GD_OK if success.

◆ GD_Polyline()

gd_error_e GD_Polyline ( gd_t * Gd,
gd_vertex_t * par_vertex,
uint16_t par_size,
gd_color_e color )

Draw a polyline, composed by staigth lines connecting the points given by vertex array.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
par_vertexVertex array, with (x, y) points, where the lines will be connected
par_sizeThe number of points in par_vertex.
colorColor of the polyline.
Returns
GD_OK if success.

◆ GD_SetContrast()

gd_error_e GD_SetContrast ( gd_t * Gd,
const uint8_t value )

Set the contrast of the display, if are supported. If display doesn't have this routine, nothing will happens.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
valueValue of contrast, from 0 to 100.
Returns
GD_OK if success.

◆ GD_SetCursor()

gd_error_e GD_SetCursor ( gd_t * Gd,
uint32_t x,
uint32_t y )

Set the cursor to the position X,Y.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
xX axis position.
yY axis position.
Returns
GD_OK if success.

◆ GD_SetDisplayOn()

gd_error_e GD_SetDisplayOn ( gd_t * Gd,
bool on )

Set display On or Off, if the display implements this routine.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
onSet to true to turn on, of to false.
Returns
GD_OK if success.

◆ GD_UpdateScreen()

gd_error_e GD_UpdateScreen ( gd_t * Gd)

Update and refresh the update screen with the data into Frame Buffer.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
Returns
GD_OK if success.

◆ GD_WriteChar()

gd_error_e GD_WriteChar ( gd_t * Gd,
char ch,
const gd_font_t * Font,
gd_color_e color )

Write a character into a Frame Buffer, with the lines with the desired color.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
chCharacter coded in ASCII.
FontPointer to the Fontset to write.
colorColor of the character.
Returns
GD_OK if success.

◆ GD_WriteString()

gd_error_e GD_WriteString ( gd_t * Gd,
char * str,
const gd_font_t * Font,
gd_color_e color )

Write a string into frame buffer, with the character lines with the desired color.

Precondition
Graphic Display is initialized.
Parameters
GdPointer to the Graphic Display handle.
strChar array, ended with '\0' character.
FontPointer to the Fontset to write.
colorColor of the string.
Returns
GD_OK if success.