MityDSP Documentation Index

MityDSP::tcDspDisplay Class Reference

The tcDspDisplay class allows the user to draw, erase, write text and bitmaps on a simple memory mapped display interface. More...

#include <core/DspDisplay.h>

List of all members.

Classes

struct  tsScreenCoords
 Structure used to store screen coordinates (in pixels). More...
struct  tsScreenOffset
 Structure used to store screen offsets (in pixels). More...

Public Types

enum  teScreenId {
  eeScreenDefault = -1, eeScreen1 = 0, eeScreen2 = 1, eeScreen3 = 2,
  eeScreen4 = 3, eeScreen5 = 4, eeScreen6 = 5, eeScreen7 = 6,
  eeScreen8 = 7
}
 

Screen offset enumeration.

More...

Public Member Functions

 tcDspDisplay (tcDspDisplayDriver *apDriver, int anNumScreens, void *aaBaseAddr[], tcDspFont *apDefaultFont, bool abRotate=false)
 This constructor is used to create an instance of a display.
 tcDspDisplay (int anWidth, int anHeight, int anBpp, void *apCmdAddr, int anNumScreens, void *aaBaseAddr[], tcDspFont *apDefaultFont, int anViewableScreens=-1)
 This constructor is used to create an instance of a display.
 ~tcDspDisplay ()
 This destructor destroys an instance of a display.
int getWidth (void)
 Retrieves display width in pixels.
int getHeight (void)
 Retrieves display height in pixels.
void rotate (bool abRotate)
 Enables or disables 90 degree display rotation.
bool isRotated (void)
 Indicates whether display is currently rotated 90 degrees.
void setDefaultFont (tcDspFont *apFont)
 This routine updates the default font, which is used when no other font is explicitly specified.
void setDefaultColor (int anColor)
 This routine updates the default color, which is used when a 1 bpp bitmap is displayed on a multiple-bpp display, or when any operation is made with gnDefaultColor specified.
int convertRGBtoColor (unsigned char anRed, unsigned char anGreen, unsigned char anBlue)
 This is a convenience routine to convert red, green, and blue color values to an integer appropriate for the display bit depth.
tsScreenCoords putString (const unsigned char *apString, tsScreenCoords asPosition, teScreenId aeScreen=eeScreenDefault, tcDspFont *apFont=NULL, bool abTransBg=false)
 This routine puts a NULL-terminated string of characters on the specified screen using the specified font.
tsScreenCoords putString (const unsigned char *apString, int anX, int anY, teScreenId aeScreen=eeScreenDefault, tcDspFont *apFont=NULL, bool abTransBg=false)
 This routine is an alternate interface to the putString method.
tsScreenCoords putString (const char *apString, tsScreenCoords asPosition, teScreenId aeScreen=eeScreenDefault, tcDspFont *apFont=NULL, bool abTransBg=false)
 This routine provides an alternate interface to the putString method.
tsScreenCoords putString (const char *apString, int anX, int anY, teScreenId aeScreen=eeScreenDefault, tcDspFont *apFont=NULL, bool abTransBg=false)
 This routine is an alternate interface to the putString method.
tsScreenOffset getStringExtent (const unsigned char *apString, tcDspFont *apFont=NULL)
 This routine computes the XY extent of the given string using the specified font.
tsScreenOffset getStringExtent (const char *apString, tcDspFont *apFont=NULL)
 This routine provides an alternate interface to the getStringExtent method.
teScreenId setActiveScreen (teScreenId aeScreen)
 This routine updates the active screen (the one that gets written to by default).
teScreenId setVisibleScreen (teScreenId aeScreen=eeScreenDefault)
 This routine sets the screen that the hardware is currently displaying.
bool clearScreen (teScreenId aeScreen=eeScreenDefault, tsScreenCoords *apStart=NULL, tsScreenOffset *apOffset=NULL)
 This routine clears an area of the specified screen.
tsScreenCoords drawLine (tsScreenCoords asPosition, tsScreenOffset asOffset, int anColor, teScreenId aeScreen=eeScreenDefault)
 This routine draws a line from the given position to the given offset (which may be negative).
tsScreenCoords drawLine (int anX, int anY, int anDx, int anDy, int anColor, teScreenId aeScreen=eeScreenDefault)
 This routine provides an alternate interface to the DrawLine method.
tsScreenCoords drawRectangle (tsScreenCoords asPosition, tsScreenOffset asOffset, int anColor, teScreenId aeScreen=eeScreenDefault)
 This routine draws a rectangle of the specified size and specified color on the specified screen.
tsScreenCoords drawRectangle (int anX, int anY, int anDx, int anDy, int anColor, teScreenId aeScreen=eeScreenDefault)
 This routine provides an alternate interface to the DrawRectangle method.
tsScreenCoords drawBitmap (tsScreenCoords asPosition, int anWidth, int anHeight, const unsigned char *apBitmap, int anDepth, teScreenId aeScreen=eeScreenDefault, bool abTransBg=false)
 This routine places a bitmap of the specified width and height on the indicated screen.
tsScreenCoords drawBitmap (int anX, int anY, int anWidth, int anHeight, const unsigned char *apBitmap, int anDepth, teScreenId aeScreen=eeScreenDefault, bool abTransBg=false)
 This routine provides an alternate interface to the drawBitmap method.
bool setPixel (tsScreenCoords asPosition, int anColor, teScreenId aeScreen=eeScreenDefault)
 This routine sets the value of the specified pixel on the specified screen to the specified color (taking into account the configured display depth).
bool setPixel (int anX, int anY, int anColor, teScreenId aeScreen=eeScreenDefault)
 This routine provides an alternate interface to the setPixel method.
void screenCopy (teScreenId aeDest, teScreenId aeSrc)
 This routine copies a source screen to a destination screen.
void screenXOR (teScreenId aeDest, teScreenId aeSrc1, teScreenId aeSrc2)
 This routine XORs two source screens together and stores the results in a destination screen.
void screenAND (teScreenId aeDest, teScreenId aeSrc1, teScreenId aeSrc2)
 This routine ANDs two source screens together and stores the results in a destination screen.
void screenOR (teScreenId aeDest, teScreenId aeSrc1, teScreenId aeSrc2)
 This routine ORs two source screens together and stores the results in a destination screen.

Static Public Attributes

static const int gnMAX_SCREENS = 8
 Maximum screen buffers allowed.
static const int gnMAX_DEPTH = 16
 Maximum pixel depth (bpp).
static const int gnDefaultColor = -1
 Indicates that the default color is to be used.

Detailed Description

The tcDspDisplay class allows the user to draw, erase, write text and bitmaps on a simple memory mapped display interface.

Support is provided for multiple display screens, including virtual screens that are not mapped directly to the hardware. Any of the hardware-mapped pages may be made visible. ScreenXOR, ScreenOR, and ScreenAND functions are provided to combine screens.

See also:
tcDspDisplay Page

Member Enumeration Documentation

Screen offset enumeration.

Enumerator:
eeScreenDefault 

Use the last active screen.

eeScreen1 
eeScreen2 
eeScreen3 
eeScreen4 
eeScreen5 
eeScreen6 
eeScreen7 
eeScreen8 

Constructor & Destructor Documentation

tcDspDisplay::tcDspDisplay ( tcDspDisplayDriver apDriver,
int  anNumScreens,
void *  aaBaseAddr[],
tcDspFont apDefaultFont,
bool  abRotate = false 
)

This constructor is used to create an instance of a display.

The width, height, and pixel depth of the display are passed in. Also, a number of memory mapped "screens" of the specified size are created, at provided memory addresses. A default font is also provided.

This constructor is used for a display whose frame buffer(s) are in local memory and are accessed by an instance of tcDspDisplayDriver.

Parameters:
[in] apDriver Pointer to instance of tcDspDisplayDriver
[in] anNumScreens Number of screens to create.
[in] aaBaseAddr Array of base addresses for memory-mapped screens.
[in] apDefaultFont Default font for text display.
[in] abRotate True to rotate display 90-degrees (make a vertically scanned display horizontal).
See also:
DspDisplay.h
tcDspDisplay::tcDspDisplay ( int  anWidth,
int  anHeight,
int  anBpp,
void *  apCmdAddr,
int  anNumScreens,
void *  aaBaseAddr[],
tcDspFont apDefaultFont,
int  anViewableScreens = -1 
)

This constructor is used to create an instance of a display.

The width, height, and pixel depth of the display are passed in. Also, a number of memory mapped "screens" of the specified size are created, at provided memory addresses. A default font is also provided.

Optionally, some of the provided screens may be "virtual." That is, they exist only in RAM and must be copied into one of the first "anViewableScreens" screens in order to become visible.

This constructor is used for a display whose frame buffer(s) are in FPGA memory.

Parameters:
[in] anWidth Width of screens in pixels.
[in] anHeight Height of screens in pixels.
[in] anBpp Color depth of screens.
[in] apCmdAddr Address used to send drawing commands.
[in] anNumScreens Number of screens to create.
[in] aaBaseAddr Array of base addresses for memory-mapped screens.
[in] apDefaultFont Default font for text display.
[in] anViewableScreens Number of created screens that are visible.
See also:
DspDisplay.h
tcDspDisplay::~tcDspDisplay (  ) 

This destructor destroys an instance of a display.

It clears the screen, then calls setVisibleScreen to blank the display.

See also:
DspDisplay.h

Member Function Documentation

int tcDspDisplay::getWidth ( void   ) 

Retrieves display width in pixels.

Returns:
Width in pixels.
See also:
DspDisplay.h
int tcDspDisplay::getHeight ( void   ) 

Retrieves display height in pixels.

Returns:
Height in pixels.
See also:
DspDisplay.h
void tcDspDisplay::rotate ( bool  abRotate  ) 

Enables or disables 90 degree display rotation.

Parameters:
[in] abRotate If true, rotates display 90-degrees.
Returns:
None.
See also:
DspDisplay.h
bool tcDspDisplay::isRotated ( void   ) 

Indicates whether display is currently rotated 90 degrees.

Returns:
True if rotated.
See also:
DspDisplay.h
void tcDspDisplay::setDefaultFont ( tcDspFont apFont  ) 

This routine updates the default font, which is used when no other font is explicitly specified.

Parameters:
[in] apFont Font to use for text drawing.
Returns:
None.
See also:
DspDisplay.h
void tcDspDisplay::setDefaultColor ( int  anColor  ) 

This routine updates the default color, which is used when a 1 bpp bitmap is displayed on a multiple-bpp display, or when any operation is made with gnDefaultColor specified.

Parameters:
[in] anColor Default color to use (only the least significant mnDepth bits are valid).
Returns:
None.
See also:
DspDisplay.h
int tcDspDisplay::convertRGBtoColor ( unsigned char  anRed,
unsigned char  anGreen,
unsigned char  anBlue 
)

This is a convenience routine to convert red, green, and blue color values to an integer appropriate for the display bit depth.

If the display has a depth that does not support RGB colors, the current default color is returned.

Parameters:
[in] anRed Relative red color level
[in] anGreen Relative green color level
[in] anBlue Relative blue color level
Returns:
Resulting color as an integer.
See also:
DspDisplay.h
tcDspDisplay::tsScreenCoords tcDspDisplay::putString ( const unsigned char *  apString,
tsScreenCoords  asPosition,
teScreenId  aeScreen = eeScreenDefault,
tcDspFont apFont = NULL,
bool  abTransBg = false 
)

This routine puts a NULL-terminated string of characters on the specified screen using the specified font.

The position of the end of the string is returned.

Parameters:
[in] apString The string to display.
[in] asPosition Position of the start of the string.
[in] aeScreen Screen ID to write to.
[in] apFont Font to use for writing.
[in] abTransBg Transparent background if True.
Returns:
The position of the end of the string.
See also:
DspDisplay.h
tcDspDisplay::tsScreenCoords tcDspDisplay::putString ( const unsigned char *  apString,
int  anX,
int  anY,
teScreenId  aeScreen = eeScreenDefault,
tcDspFont apFont = NULL,
bool  abTransBg = false 
)

This routine is an alternate interface to the putString method.

Parameters:
[in] apString The string to display.
[in] anX X-coordinate of the string's origin.
[in] anY Y-coordinate of the string's origin.
[in] aeScreen Screen ID to write to.
[in] apFont Font to use for writing.
[in] abTransBg Transparent background if True.
Returns:
The position of the end of the string.
See also:
DspDisplay.h
tcDspDisplay::tsScreenCoords tcDspDisplay::putString ( const char *  apString,
tsScreenCoords  asPosition,
teScreenId  aeScreen = eeScreenDefault,
tcDspFont apFont = NULL,
bool  abTransBg = false 
)

This routine provides an alternate interface to the putString method.

Parameters:
[in] apString The string to display.
[in] asPosition Position of the start of the string.
[in] aeScreen Screen ID to write to.
[in] apFont Font to use for writing.
[in] abTransBg Transparent background if True.
Returns:
The position of the end of the string.
See also:
DspDisplay.h
tcDspDisplay::tsScreenCoords tcDspDisplay::putString ( const char *  apString,
int  X,
int  Y,
teScreenId  aeScreen = eeScreenDefault,
tcDspFont apFont = NULL,
bool  abTransBg = false 
)

This routine is an alternate interface to the putString method.

Parameters:
[in] apString The string to display.
[in] X X-coordinate of the string's origin.
[in] Y Y-coordinate of the string's origin.
[in] aeScreen Screen ID to write to.
[in] apFont Font to use for writing.
[in] abTransBg Transparent background if True.
Returns:
The position of the end of the string.
See also:
DspDisplay.h
tcDspDisplay::tsScreenOffset tcDspDisplay::getStringExtent ( const unsigned char *  apString,
tcDspFont apFont = NULL 
)

This routine computes the XY extent of the given string using the specified font.

Parameters:
[in] apString The string to use for calculation.
[in] apFont Font to use for calculation.
Returns:
The XY extent of the given string.
See also:
DspDisplay.h
tcDspDisplay::tsScreenOffset tcDspDisplay::getStringExtent ( const char *  apString,
tcDspFont apFont = NULL 
)

This routine provides an alternate interface to the getStringExtent method.

Parameters:
[in] apString The string to use for calculation.
[in] apFont Font to use for calculation.
Returns:
The XY extent of the given string.
See also:
DspDisplay.h
tcDspDisplay::teScreenId tcDspDisplay::setActiveScreen ( teScreenId  aeScreen  ) 

This routine updates the active screen (the one that gets written to by default).

Parameters:
[in] aeScreen The desired new active (default) screen ID.
Returns:
The ID of the new active screen.
See also:
DspDisplay.h
tcDspDisplay::teScreenId tcDspDisplay::setVisibleScreen ( teScreenId  aeScreen = eeScreenDefault  ) 

This routine sets the screen that the hardware is currently displaying.

It returns the current setting, which will match the request if successful.

Parameters:
[in] aeScreen The desired new visible screen.
Returns:
The active visible screen.
See also:
DspDisplay.h
bool tcDspDisplay::clearScreen ( teScreenId  aeScreen = eeScreenDefault,
tsScreenCoords apStart = NULL,
tsScreenOffset apOffset = NULL 
)

This routine clears an area of the specified screen.

If no screen is specified, the active screen is used. If no area is specified, the entire screen is cleared.

Parameters:
[in] aeScreen The screen to clear.
[in] apStart Upper-left corner of rectangle to clear.
[in] apOffset Distance from the upper-left corner to clear.
Returns:
True if the entire specified area was able to be cleared.
See also:
DspDisplay.h
tcDspDisplay::tsScreenCoords tcDspDisplay::drawLine ( tsScreenCoords  asPosition,
tsScreenOffset  asOffset,
int  anColor,
teScreenId  aeScreen = eeScreenDefault 
)

This routine draws a line from the given position to the given offset (which may be negative).

The line is drawn in the color provided on the specified screen (or the active screen if none is specified).

Parameters:
[in] asPosition Starting position of the line.
[in] asOffset Endpoint offset from the starting position.
[in] anColor The desired line color.
[in] aeScreen The screen to draw on.
Returns:
The point at the end of the line
See also:
DspDisplay.h
tcDspDisplay::tsScreenCoords tcDspDisplay::drawLine ( int  anX,
int  anY,
int  anDx,
int  anDy,
int  anColor,
teScreenId  aeScreen = eeScreenDefault 
)

This routine provides an alternate interface to the DrawLine method.

Parameters:
[in] anX Starting X-coordinate of the line.
[in] anY Starting Y-Coordinate of the line.
[in] anDx Endpoint X-coordinate offset of the line.
[in] anDy Endpoint Y-coordinate offset of the line.
[in] anColor The desired line color.
[in] aeScreen The screen to draw on.
Returns:
The point at the end of the line
See also:
DspDisplay.h
tcDspDisplay::tsScreenCoords tcDspDisplay::drawRectangle ( tsScreenCoords  asPosition,
tsScreenOffset  asOffset,
int  anColor,
teScreenId  aeScreen = eeScreenDefault 
)

This routine draws a rectangle of the specified size and specified color on the specified screen.

Parameters:
[in] asPosition Upper-leftmost vertex of the rectangle.
[in] asOffset Offset from the starting position of the opposite vertex.
[in] anColor The desired line color.
[in] aeScreen The screen to draw on.
Returns:
The coordinates at the opposite vertex of the rectangle.
See also:
DspDisplay.h
tcDspDisplay::tsScreenCoords tcDspDisplay::drawRectangle ( int  anX,
int  anY,
int  anDx,
int  anDy,
int  anColor,
teScreenId  aeScreen = eeScreenDefault 
)

This routine provides an alternate interface to the DrawRectangle method.

Parameters:
[in] anX Starting X-coordinate of the rectangle.
[in] anY Starting Y-Coordinate of the rectangle.
[in] anDx X-coordinate offset of the opposite vertex.
[in] anDy Y-coordinate offset of the opposite vertex.
[in] anColor The desired line color.
[in] aeScreen The screen to draw on.
Returns:
The position of the opposite vertex of the rectangle.
See also:
DspDisplay.h
tcDspDisplay::tsScreenCoords tcDspDisplay::drawBitmap ( tsScreenCoords  asPosition,
int  anWidth,
int  anHeight,
const unsigned char *  apBitmap,
int  anDepth,
teScreenId  aeScreen = eeScreenDefault,
bool  abTransBg = false 
)

This routine places a bitmap of the specified width and height on the indicated screen.

Note:
If the bitmap is one bit deep, and the screen is multiple bits, the current default color is used to draw the bitmap.
Parameters:
[in] asPosition Position to start drawing the bitmap.
[in] anWidth Width of the bitmap.
[in] anHeight Height of the bitmap.
[in] apBitmap Pointer to the bitmap to draw.
[in] anDepth Bit depth of the bitmap.
[in] aeScreen Screen to draw on.
[in] abTransBg Background (black) is transparent if True.
Returns:
Ending position of the bitmap.
See also:
DspDisplay.h
tcDspDisplay::tsScreenCoords tcDspDisplay::drawBitmap ( int  anX,
int  anY,
int  anWidth,
int  anHeight,
const unsigned char *  apBitmap,
int  anDepth,
teScreenId  aeScreen = eeScreenDefault,
bool  abTransBg = false 
)

This routine provides an alternate interface to the drawBitmap method.

Parameters:
[in] anX X-Coordate to start the bitmap.
[in] anY Y-Coordinate to start the bitmap.
[in] anWidth Width of the bitmap.
[in] anHeight Height of the bitmap.
[in] apBitmap Pointer to the bitmap to draw.
[in] anDepth Bit depth of the bitmap.
[in] aeScreen Screen to draw on.
[in] abTransBg Background (black) is transparent if True.
Returns:
Ending position of the bitmap.
See also:
DspDisplay.h
bool tcDspDisplay::setPixel ( tsScreenCoords  asPosition,
int  anColor,
teScreenId  aeScreen = eeScreenDefault 
)

This routine sets the value of the specified pixel on the specified screen to the specified color (taking into account the configured display depth).

Parameters:
[in] asPosition Position to draw the pixel.
[in] anColor Color of the pixel.
[in] aeScreen Screen to draw on.
Returns:
True if successful in writing to the screen.
See also:
DspDisplay.h
bool tcDspDisplay::setPixel ( int  anX,
int  anY,
int  anColor,
teScreenId  aeScreen = eeScreenDefault 
)

This routine provides an alternate interface to the setPixel method.

Parameters:
[in] anX X-Coordinate of the pixel.
[in] anY Y-Coordinate of the pixel.
[in] anColor Color of the pixel.
[in] aeScreen Screen to draw on.
Returns:
True if successful in writing to the screen.
See also:
DspDisplay.h
void tcDspDisplay::screenCopy ( teScreenId  aeDest,
teScreenId  aeSrc 
)

This routine copies a source screen to a destination screen.

Parameters:
[in] aeDest Destination screen ID.
[in] aeSrc Source screen ID.
Returns:
None.
See also:
DspDisplay.h
void tcDspDisplay::screenXOR ( teScreenId  aeDest,
teScreenId  aeSrc1,
teScreenId  aeSrc2 
)

This routine XORs two source screens together and stores the results in a destination screen.

It is acceptable for one of the source screens to be the destination screen.

Parameters:
[in] aeDest Destination screen ID.
[in] aeSrc1 First source screen ID.
[in] aeSrc2 Second source screen ID.
Returns:
None.
See also:
DspDisplay.h
void tcDspDisplay::screenAND ( teScreenId  aeDest,
teScreenId  aeSrc1,
teScreenId  aeSrc2 
)

This routine ANDs two source screens together and stores the results in a destination screen.

It is acceptable for one of the source screens to be the destination screen.

Parameters:
[in] aeDest Destination screen ID.
[in] aeSrc1 First source screen ID.
[in] aeSrc2 Second source screen ID.
Returns:
None.
See also:
DspDisplay.h
void tcDspDisplay::screenOR ( teScreenId  aeDest,
teScreenId  aeSrc1,
teScreenId  aeSrc2 
)

This routine ORs two source screens together and stores the results in a destination screen.

It is acceptable for one of the source screens to be the destination screen.

Parameters:
[in] aeDest Destination screen ID.
[in] aeSrc1 First source screen ID.
[in] aeSrc2 Second source screen ID.
Returns:
None.
See also:
DspDisplay.h

Member Data Documentation

const int MityDSP::tcDspDisplay::gnMAX_SCREENS = 8 [static]

Maximum screen buffers allowed.

const int MityDSP::tcDspDisplay::gnMAX_DEPTH = 16 [static]

Maximum pixel depth (bpp).

const int MityDSP::tcDspDisplay::gnDefaultColor = -1 [static]

Indicates that the default color is to be used.


  
Generated on Fri Sep 23 16:33:49 2011 for MityDSP Core by  Doxygen Version 1.6.1
Copyright © 2009, Critical Link LLC, All rights reserved.