Atmel Software Framework

Quick Start Guide for the graphics service

This is the quick start guide for the Graphics (GFX) service", with step-by-step instructions on how to configure and use it for a specific use case.

Basic usage of the graphics service

This use case will demonstrate initializing the graphics service and then drawing a red line on the screen from coordinate X=10, Y=10 to X=20, Y=20.


Example code

Add to, e.g., the main function in the application C-file:

gfx_draw_line(10, 10, 20, 20, GFX_COLOR(0xFF, 0, 0));


  1. Initialize board IO:
  2. Initialize clocks:
  3. Initialize graphics service
    • Note
      This will call the init function for the low level display controller driver and initialize the screen to a white background.
  4. Draw a red line from 10,10 to 20,20:
  • gfx_draw_line(10, 10, 20, 20, GFX_COLOR(0xFF, 0, 0));
  • Attention
    This uses the GFX_COLOR macro to convert a RGB (Red,Green,Blue) value to a color value native to the display. In this case the color is a constant, so we use the macro. If you need to create the color from a non-constant value you must use the gfx_color function to generate the color.