MityDSP Documentation Index
Classes | Public Types | Public Member Functions | Static Public Attributes
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]apDriverPointer to instance of tcDspDisplayDriver
[in]anNumScreensNumber of screens to create.
[in]aaBaseAddrArray of base addresses for memory-mapped screens.
[in]apDefaultFontDefault font for text display.
[in]abRotateTrue 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]anWidthWidth of screens in pixels.
[in]anHeightHeight of screens in pixels.
[in]anBppColor depth of screens.
[in]apCmdAddrAddress used to send drawing commands.
[in]anNumScreensNumber of screens to create.
[in]aaBaseAddrArray of base addresses for memory-mapped screens.
[in]apDefaultFontDefault font for text display.
[in]anViewableScreensNumber 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]abRotateIf 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]apFontFont 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]anColorDefault 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]anRedRelative red color level
[in]anGreenRelative green color level
[in]anBlueRelative 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]apStringThe string to display.
[in]asPositionPosition of the start of the string.
[in]aeScreenScreen ID to write to.
[in]apFontFont to use for writing.
[in]abTransBgTransparent 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]apStringThe string to display.
[in]anXX-coordinate of the string's origin.
[in]anYY-coordinate of the string's origin.
[in]aeScreenScreen ID to write to.
[in]apFontFont to use for writing.
[in]abTransBgTransparent 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]apStringThe string to display.
[in]asPositionPosition of the start of the string.
[in]aeScreenScreen ID to write to.
[in]apFontFont to use for writing.
[in]abTransBgTransparent 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]apStringThe string to display.
[in]XX-coordinate of the string's origin.
[in]YY-coordinate of the string's origin.
[in]aeScreenScreen ID to write to.
[in]apFontFont to use for writing.
[in]abTransBgTransparent 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]apStringThe string to use for calculation.
[in]apFontFont 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]apStringThe string to use for calculation.
[in]apFontFont 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]aeScreenThe 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]aeScreenThe 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]aeScreenThe screen to clear.
[in]apStartUpper-left corner of rectangle to clear.
[in]apOffsetDistance 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]asPositionStarting position of the line.
[in]asOffsetEndpoint offset from the starting position.
[in]anColorThe desired line color.
[in]aeScreenThe 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]anXStarting X-coordinate of the line.
[in]anYStarting Y-Coordinate of the line.
[in]anDxEndpoint X-coordinate offset of the line.
[in]anDyEndpoint Y-coordinate offset of the line.
[in]anColorThe desired line color.
[in]aeScreenThe 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]asPositionUpper-leftmost vertex of the rectangle.
[in]asOffsetOffset from the starting position of the opposite vertex.
[in]anColorThe desired line color.
[in]aeScreenThe 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]anXStarting X-coordinate of the rectangle.
[in]anYStarting Y-Coordinate of the rectangle.
[in]anDxX-coordinate offset of the opposite vertex.
[in]anDyY-coordinate offset of the opposite vertex.
[in]anColorThe desired line color.
[in]aeScreenThe 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]asPositionPosition to start drawing the bitmap.
[in]anWidthWidth of the bitmap.
[in]anHeightHeight of the bitmap.
[in]apBitmapPointer to the bitmap to draw.
[in]anDepthBit depth of the bitmap.
[in]aeScreenScreen to draw on.
[in]abTransBgBackground (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]anXX-Coordate to start the bitmap.
[in]anYY-Coordinate to start the bitmap.
[in]anWidthWidth of the bitmap.
[in]anHeightHeight of the bitmap.
[in]apBitmapPointer to the bitmap to draw.
[in]anDepthBit depth of the bitmap.
[in]aeScreenScreen to draw on.
[in]abTransBgBackground (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]asPositionPosition to draw the pixel.
[in]anColorColor of the pixel.
[in]aeScreenScreen 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]anXX-Coordinate of the pixel.
[in]anYY-Coordinate of the pixel.
[in]anColorColor of the pixel.
[in]aeScreenScreen 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]aeDestDestination screen ID.
[in]aeSrcSource 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]aeDestDestination screen ID.
[in]aeSrc1First source screen ID.
[in]aeSrc2Second 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]aeDestDestination screen ID.
[in]aeSrc1First source screen ID.
[in]aeSrc2Second 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]aeDestDestination screen ID.
[in]aeSrc1First source screen ID.
[in]aeSrc2Second 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 Mon Apr 22 2013 11:33:03 for MityDSP Core by  Doxygen Version 1.8.1.1
Copyright © 2009, Critical Link LLC, All rights reserved.