Graphic Display Manager


struct  gdm_display
struct  gdm_line


#define GDM_HEIGHT   (64)
#define GDM_WIDTH   (128)


typedef gdm_line gdm_line
typedef int(* gdm_clip_point_handler )(struct gdm_display *dp, short x, short y)
typedef gdm_display gdm_display


enum  gdm_gc_mode { GDM_PLOT_OR , GDM_PLOT_AND , GDM_PLOT_XOR }


gdm_linegdm_get_raw_line (gdm_display *dp, short y)

Detailed Description

The Graphic Display Manager is a library used to provide graphics operations and control a 128x64 liquid crystal display module. It provides a graphical API to draw on the display and access to its bitmap. All the public API is prefixed by gdm_ and all the internal API is prefixed by _gdm_. The graphic display manager API is decomposed in several sets:

Management and Control API
This API must be used to control the display and the behavior of the graphic display module.

Hardware Low Level Operation for Graphic Display Manager
This API is provided by the board support package and gives raw access to the LCD hardware controller. The display manager uses this API to refresh the screen and implement the high level drawing operations. Read this section if you intend to port the library to your board.

Drawing API
This API is the most interesting as it allows to draw on the screen. It provides operations to:
  • draw points, lines, segments, rectangles, polygons, circles,
  • fill rectangles,
  • paint characters from a font,
  • save and restore regions of the screen.

Low level operation of graphic display manager
This API is internal to the graphic display manager. It provides efficient low level drawing operations. Its use is unsafe.

The drawing operations are made in the display manager bitmap. This bitmap is in memory. Once the drawing is finished, the bitmap must be synchronized with the LCD screen. The display manager will do this by sending the data to the LCD controller. Only the regions that have changed are really synchronized thus reducing the interactions with the LCD controller. The synchronization process is made by the gdm_refresh which should be called after the drawing operations are finished. The gdm_touch operation can be used to force a synchronization with the LCD controller.

To use this library, you should:

  • Include gdm/display.h in your source files, like:
        include <gdm/display.h>

  • Link your program with libgdm, for example by using:
    during the link.
Several examples are provided to help use and understand this library:

Define Documentation

#define GDM_HEIGHT   (64)

Height of display in pixels.

Definition at line 115 of file display.h.

Referenced by gdm_get_raw_line().

#define GDM_WIDTH   (128)

Width of display in pixels.

Definition at line 118 of file display.h.

Typedef Documentation

typedef int(* gdm_clip_point_handler)(struct gdm_display* dp, short x, short y)

Clipping handler for a point.

dp  Display Manager
x  X Coordinate
y  Y Coordinate
0 if the point must not be drawn, != 0 if it can.

Definition at line 171 of file display.h.

typedef struct gdm_display gdm_display

Display Manager Representation

The display manager is represented by the gdm_display data structure. It defines the current graphical context for the drawing operation and contains the graphic bitmap.

The display manager is intended to be allocated statically. It must be initialized once using gdm_initialize before any other operation. For example:

      static gdm_display display;  / * Static or global!!! * /
       gdm_initialize (&display);

After a sequence of drawing operation, the LCD display must be refreshed explicitly by calling gdm_refresh. For example:

      ... / * Do some complex drawing * /
      gdm_refresh (&display);

See also:
gdm_line, gdm_initialize, gdm_refresh

typedef struct gdm_line gdm_line

Display Line Representation

The display line represents a complete row of the LCD display. The LCD display is decomposed in 8 rows of 128 bytes each. Each row is indexed by a register (named X in KS0108 driver). The row spans on two KS0108 drivers: the left and right drivers. Graphically the row forms a rectangle of width 128 and height 8.

The gdm_line contains the row bitmap, the row number and a small bitmask used by the refresh method.

See also:
gdm_display, gdm_get_raw_line

Enumeration Type Documentation

enum gdm_gc_mode

Graphic Context Mode

The gc mode defines the operation to use when drawing on the bitmap.

Enumeration values:
GDM_PLOT_OR  Use a logical OR.
GDM_PLOT_AND  Use a logical AND.
GDM_PLOT_XOR  Use a logical XOR.

Definition at line 130 of file display.h.

Function Documentation

gdm_line * gdm_get_raw_line gdm_display   dp,
short    y

Get pointer to a row line representation.

Given an Y coordinate in the range 0 .. GDM_HEIGHT, return the gdm_line that represent the rows containing the line.

dp  Display Manager
y  Y coordinate
the gdm_line pointer or null if Y is not in the range
See also:

Definition at line 228 of file display.h.

References GDM_HEIGHT, and gdm_display::lines.