GLCD Dev Board  

GLCD Development Board for ATmega32

Our GLCD Development Board is designed to jump start graphical LCD programming for people who do not have any previous experience in the field. The hardware is tightly integrated with all our tutorials and the ProGFX driver.

Purchase

  • Delivery in India and Abroad.
  • Online payment by Indian Cards and Netbanking.
  • Paypal payment for International Customers.
   

Login Form  

   

Graphic Primitive Functions

Details

Drawing A line in GLCD

A line is a geometrical figure defined by two points. A line can be drawn on GLCD by specifying a start point and an end point. The function in ProGFX which draws a line is explained below.

void GFXLine(UINT8 x1,UINT8 y1,UINT8 x2,UINT8 y2,UINT8 color);

Arguments

  • x1 = start x co-ordinate.
  • y1 = start y co-ordinate.
  • x2 = end x co-ordinate.
  • y2 = end y co-ordinate.
  • colour = either GFX_COLOR_BLACK or GFX_COLOR_WHITE

Return Value

  • NONE

Example

Draw a line between (16,16) to (100,41) in Black colour


#include <gfx.h>

void main()
{
   //Initialize ProGFX Engine
   GFXInit();

   //Draw a line between (16,16) to (100,41) in Black colour
   GFXLine(16,16,100,41,GFX_COLOR_BLACK);

   //Update the display
   GFXUpdate();

}

line in glcd

Line in GLCD

If the line you want to draw is perfectly horizontal or vertical then you may use the following two functions.

  • void GFXHLine(UINT8 x1,UINT8 y1,UINT8 len,UINT8 color);
  • void GFXVLine(UINT8 x1,UINT8 y1,UINT8 len,UINT8 color);

These function takes starting point and the length of line. They are much faster than generic GFXLine() function.

Drawing a Rectangle In GLCD

Rectangle can be drawn on the screen by specifying two points and colour.

  • Top-left point
  • Bottom-right point

The function which draws a rectangle is documented below.

void GFXRect(UINT8 x1,UINT8 y1,UINT8 x2, UINT8 y2,UINT8 color);

Argument:

  • x1 = top-left x co-ordinate.
  • y1 = top-left y co-ordinate.
  • x2 = bottom-right x co-ordinate.
  • y2 = bottom-right y co-ordinate.

colour = either GFX_COLOR_BLACK or GFX_COLOR_WHITE

Return Value

  • NONE

Example

Draw a rectangle between (16,16) and (100,41) in Black colour


#include <gfx.h>

void main()
{
   //Initialize ProGFX Engine
   GFXInit();

   //Draw a rectangle between (16,16) to (100,41) in Black colour
   GFXRect(16,16,100,41,GFX_COLOR_BLACK);

   //Update the display
   GFXUpdate();
}
glcd rectangle

Rectangle in GLCD

Drawing a Filled Rectangle in GLCD

In place of above function use the following function. It will draw a filled rectangle.

void GFXFillRect(UINT8 x1,UINT8 y1,UINT8 x2, UINT8 y2,UINT8 color);

Example

Draw a filled rectangle between (16,16) and (100,41) in Black colour


#include <gfx.h>

void main()
{
   //Initialize ProGFX Engine
   GFXInit();

   //Draw a filled rectangle between 
   //(16,16) to (100,41) in Black colour
   GFXFillRect(16,16,100,41,GFX_COLOR_BLACK);

   //Update the display

   GFXUpdate();
}
glcd filled rectangle

Filled Rectangle in GLCD

Drawing a Circle in GLCD

Circle can be drawn on GLCD by specifying the center and the radius. The following function draws a circle in ProGFX.

void GFXCircle(UINT8 cx,UINT8 cy,UINT8 rad,UINT8 color);

Argument:

  • cx = x co-ordinate of center.
  • cy = y co-ordinate of center.
  • rad = radius.
  • colour = either GFX_COLOR_BLACK or GFX_COLOR_WHITE

Return Value

  • NONE

Example

Draw a circle with center at 64,32 and having a radius of 20 pixels in Black colour.


#include <gfx.h>

void main()
{
   //Initialize ProGFX Engine
   GFXInit();

   //Draw a circle with center at 64,32
   //and radius of 20 pixels.
   GFXCircle(64,32,20,GFX_COLOR_BLACK);

   //Update the display

   GFXUpdate();
}

glcd circle drawing

Circle in GLCD

System Functions of ProGFX

void GFXInit();

This function Initialize the ProGFX Graphics Engine. Must be called before using any other graphic functions.

Argument:
NONE

Return Value
NONE


void GFXUpdate();

This function transfers the internal graphic buffer to the LCD Module. After your drawing is complete you must call this to make it visible on screen.

Argument:
NONE

Return Value
NONE


void GFXClear();

This function Clears the screen.

Argument:
NONE

Return Value
NONE


 

   
© ProGFX.org by Avinash