Library release of Simon Ford's GraphicsDisplay Display Library Base Class.

Dependents:   ese_project_copy ese_project_share Test_ColorMemLCD rIoTwear_LCD ... more

Embed: (wiki syntax)

« Back to documentation index

GraphicsDisplay Class Reference

GraphicsDisplay Class Reference

A common base class for Graphics displays. More...

#include <GraphicsDisplay.h>

Inherits TextDisplay.

Public Member Functions

 GraphicsDisplay (const char *name)
 Create a GraphicsDisplay interface.
virtual void pixel (int x, int y, int colour)=0
 Draw a pixel in the specified color.
virtual int width ()=0
 get the screen width in pixels
virtual int height ()=0
 get the screen height in pixels
virtual void window (int x, int y, int w, int h)
 Set the window, which controls where items are written to the screen.
virtual void putp (int colour)
 Put a single pixel at the current pixel location and update the pixel location based on window settings.
virtual void cls ()
 clear the entire screen
virtual void fill (int x, int y, int w, int h, int colour)
 Fill a region using a single colour.
virtual void blit (int x, int y, int w, int h, const int *colour)
 Fill a region using an array.
virtual void blitbit (int x, int y, int w, int h, const char *colour)
 Fill a region using a font array.
virtual void character (int column, int row, int value)
 Print one character at the specified row, column.
virtual int columns ()
 Get the number of columns based on the currently active font.
virtual int rows ()
 Get the number of rows based on the currently active font.
virtual bool claim (FILE *stream)
 redirect output from a stream (stoud, sterr) to display
virtual void locate (int column, int row)
 locate the cursor at a character position.
virtual void foreground (uint16_t colour)
 set the foreground color
virtual void background (uint16_t colour)
 set the background color

Detailed Description

A common base class for Graphics displays.

Definition at line 21 of file GraphicsDisplay.h.


Constructor & Destructor Documentation

GraphicsDisplay ( const char *  name )

Create a GraphicsDisplay interface.

Parameters:
nameThe name used by the parent class to access the interface

Definition at line 107 of file GraphicsDisplay.cpp.


Member Function Documentation

void background ( uint16_t  colour ) [virtual, inherited]

set the background color

Note:
this method may be overridden in a derived class.
Parameters:
coloris color to use for background drawing.

Definition at line 61 of file TextDisplay.cpp.

void blit ( int  x,
int  y,
int  w,
int  h,
const int *  colour 
) [virtual]

Fill a region using an array.

Parameters:
xis the left-edge of the region.
yis the top-edge of the region.
wspecifies the width of the region.
hspecifies the height of the region.
colouris a pointer to the array with size = w * h.
Note:
this method may be overridden in a derived class.

Definition at line 150 of file GraphicsDisplay.cpp.

void blitbit ( int  x,
int  y,
int  w,
int  h,
const char *  colour 
) [virtual]

Fill a region using a font array.

Parameters:
xis the left-edge of the region.
yis the top-edge of the region.
wspecifies the width of the region.
hspecifies the height of the region.
colouris a pointer to the font array.
Note:
this method may be overridden in a derived class.

Definition at line 157 of file GraphicsDisplay.cpp.

void character ( int  column,
int  row,
int  value 
) [virtual]

Print one character at the specified row, column.

Parameters:
columnis the horizontal character position.
rowis the vertical character position.
valueis the character to print.
Note:
this method may be overridden in a derived class.

Implements TextDisplay.

Definition at line 112 of file GraphicsDisplay.cpp.

bool claim ( FILE *  stream ) [virtual, inherited]

redirect output from a stream (stoud, sterr) to display

Parameters:
streamstream that shall be redirected to the TextDisplay
Note:
this method may be overridden in a derived class.
Returns:
true if the claim succeeded.

Definition at line 65 of file TextDisplay.cpp.

void cls (  ) [virtual]

clear the entire screen

Reimplemented from TextDisplay.

Definition at line 146 of file GraphicsDisplay.cpp.

int columns (  ) [virtual]

Get the number of columns based on the currently active font.

Returns:
number of columns.
Note:
this method may be overridden in a derived class.

Implements TextDisplay.

Definition at line 167 of file GraphicsDisplay.cpp.

void fill ( int  x,
int  y,
int  w,
int  h,
int  colour 
) [virtual]

Fill a region using a single colour.

Parameters:
xis the left-edge of the region.
yis the top-edge of the region.
wspecifies the width of the region.
hspecifies the height of the region.
colouris the fill colour.
Note:
this method may be overridden in a derived class.

Definition at line 139 of file GraphicsDisplay.cpp.

void foreground ( uint16_t  colour ) [virtual, inherited]

set the foreground color

Note:
this method may be overridden in a derived class.
Parameters:
coloris color to use for foreground drawing.

Definition at line 57 of file TextDisplay.cpp.

virtual int height (  ) [pure virtual]

get the screen height in pixels

Note:
this method must be supported in the derived class.
Returns:
screen height in pixels.
void locate ( int  column,
int  row 
) [virtual, inherited]

locate the cursor at a character position.

Based on the currently active font, locate the cursor on screen.

Note:
this method may be overridden in a derived class.
Parameters:
columnis the horizontal offset from the left side.
rowis the vertical offset from the top.

Definition at line 48 of file TextDisplay.cpp.

virtual void pixel ( int  x,
int  y,
int  colour 
) [pure virtual]

Draw a pixel in the specified color.

Note:
this method must be supported in the derived class.
Parameters:
xis the horizontal offset to this pixel.
yis the vertical offset to this pixel.
colourdefines the color for the pixel.
void putp ( int  colour ) [virtual]

Put a single pixel at the current pixel location and update the pixel location based on window settings.

Parameters:
colouris the pixel colour.
Note:
this method may be overridden in a derived class.

Definition at line 127 of file GraphicsDisplay.cpp.

int rows (  ) [virtual]

Get the number of rows based on the currently active font.

Returns:
number of rows.
Note:
this method may be overridden in a derived class.

Implements TextDisplay.

Definition at line 171 of file GraphicsDisplay.cpp.

virtual int width (  ) [pure virtual]

get the screen width in pixels

Note:
this method must be supported in the derived class.
Returns:
screen width in pixels.
void window ( int  x,
int  y,
int  w,
int  h 
) [virtual]

Set the window, which controls where items are written to the screen.

When something hits the window width, it wraps back to the left side and down a row. If the initial write is outside the window, it will be captured into the window when it crosses a boundary.

Parameters:
xis the left edge in pixels.
yis the top edge in pixels.
wis the window width in pixels.
his the window height in pixels.
Note:
this method may be overridden in a derived class.

Definition at line 116 of file GraphicsDisplay.cpp.