MityDSP Documentation Index

MityDSP::tcGuiDspDisplay Class Reference

#include <core/guiDspDisplay.h>

List of all members.

Classes

struct  tsScreenOffset

Public Types

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

Public Member Functions

 tcGuiDspDisplay (tcDspDisplayDriver *apDriver, int anNumScreens, void *aaBaseAddr[], tcDspFont *apDefaultFont, bool abRotate=false)
 tcGuiDspDisplay (int anWidth, int anHeight, int anBpp, void *apCmdAddr, int anNumScreens, void *aaBaseAddr[], tcDspFont *apDefaultFont, int anViewableScreens=-1)
 ~tcGuiDspDisplay ()
int getWidth ()
int getHeight ()
void rotate (bool abRotate)
bool isRotated ()
void set_font (tcDspFont *apFont)
tcSize getTextExtent (const char *str)
tcSize getTextExtent (const char *str, tcDspFont *apFont)
void set_fg_color (tsRgb rgb)
void set_bg_color (tsRgb rgb)
void set_text_color (tsRgb rgb)
void set_text_opacity (int opacity)
bool set_trans_bitmap (bool transparent)
void set_trans_bitmap_color (tsRgb rgb)
void set_text_angle (int angle)
int get_text_angle ()
int convertRGBtoColor (uint8 r, uint8 g, uint8 b)
int convertRGBtoColor (tsRgb rgb)
int alphaBlend (int Color0, int Color1, uint32 alpha)
teScreenId setActiveScreen (teScreenId aeScreen)
teScreenId getActiveScreen ()
teScreenId setVisibleScreen (teScreenId aeScreen)
teScreenId getVisibleScreen ()
void clearScreen (const tcPoint *apStart=NULL, const tcSize *apOffset=NULL)
void set_clip_rect (const tcRect &r)
void clear_clip_rect ()
tcRect get_clip_rect ()
void drawPixel (tcPoint p)
void drawPixel (int x, int y)
void drawLine (tcPoint p1, tcPoint p2)
void drawLine (int x1, int y1, int x2, int y2)
void drawVertLine (int x, int y1, int y2)
void drawAALine (float x1, float y1, float x2, float y2)
void drawAALine (float x1, float y1, float x2, float y2, float width)
void drawRect (const tcPoint &p, const tcSize &s)
void drawRect (int x, int y, int w, int h)
void drawRect (const tcRect &r)
void drawFillRect (const tcPoint &p, const tcSize &s)
void drawFillRect (int x, int y, int w, int h)
void drawFillRect (const tcRect &r)
void draw3dRect (const tcPoint &p, const tcSize &s, int light, int dark)
void draw3dRect (int x, int y, int w, int h, int light, int dark)
void draw3dRect (const tcRect &r, int light, int dark)
void drawBitmap (const tcPoint &p, const tcBitmap &bmp)
void drawBitmap (int x, int y, const tcBitmap &bmp)
void drawBitmap (int x, int y, int w, int h, const tcBitmap &bmp, int sx, int sy)
void drawCharacter (int x, int y, const tcBitmap &bmp)
void drawText (tcPoint p, const char *str)
void drawText (int x, int y, const char *str, teHorizontalAlignment aeHAlign=eeHLeft, teVerticalAlignment aeVAlign=eeVTop)
void screenCopy (teScreenId aeDest, teScreenId aeSrc)
void screenXOR (teScreenId aeDest, teScreenId aeSrc1, teScreenId aeSrc2)
void screenAND (teScreenId aeDest, teScreenId aeSrc1, teScreenId aeSrc2)
void screenOR (teScreenId aeDest, teScreenId aeSrc1, teScreenId aeSrc2)
int numScreens (void)
bool screenEnabled ()
void set_screen_enabled (bool abEnable)

Static Public Member Functions

static int convertRGBtoColor15 (tsRgb rgb)
static int convertRGBtoColor16 (tsRgb rgb)
static int convertRGBtoColor15 (uint8 r, uint8 g, uint8 b)
static int convertRGBtoColor16 (uint8 r, uint8 g, uint8 b)

Static Public Attributes

static const int gnMAX_SCREENS = 8
 Maximum screen buffers allowed.
static const int gnMAX_DEPTH = 16
 Maximum pixel depth (bpp).

Detailed Description

The tcGuiDspDisplay 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:
tcGuiDspDisplay 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

tcGuiDspDisplay::tcGuiDspDisplay ( 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 tcGuiDspDisplayDriver.

Parameters:
[in] apDriver Pointer to instance of tcGuiDspDisplayDriver
[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
tcGuiDspDisplay::tcGuiDspDisplay ( 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
tcGuiDspDisplay::~tcGuiDspDisplay (  ) 

This destructor destroys an instance of a display. It clears the screen, then calls setVisibleScreen to blank the display.

See also:
guiDspDisplay.h

Member Function Documentation

tcGuiDspDisplay::getWidth (  )  [inline]

Retrieves display width in pixels.

Returns:
Width in pixels.
See also:
tcGuiDspDisplay::getHeight
guiDspDisplay.h
tcGuiDspDisplay::getHeight (  )  [inline]

Retrieves display height in pixels.

Returns:
Height in pixels.
See also:
tcGuiDspDisplay::getWidth
guiDspDisplay.h
void tcGuiDspDisplay::rotate ( bool  abRotate  ) 

Enables or disables 90 degree display rotation.

Parameters:
[in] abRotate If true, rotates display 90-degrees.
See also:
tcGuiDspDisplay::isRotated
guiDspDisplay.h
tcGuiDspDisplay::isRotated (  )  [inline]

Indicates whether display is currently rotated 90 degrees.

Returns:
True if rotated.
See also:
tcGuiDspDisplay::rotate
guiDspDisplay.h
tcGuiDspDisplay::set_font ( tcDspFont *  apFont  )  [inline]

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

Parameters:
apFont Font to use for text drawing.
See also:
guiDspDisplay.h
tcSize MityDSP::tcGuiDspDisplay::getTextExtent ( const char *  str  )  [inline]
tcSize tcGuiDspDisplay::getTextExtent ( const char *  str,
tcDspFont *  apFont 
)

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

Parameters:
str The string to use for calculation.
Returns:
The XY extent of the given string.
See also:
guiDspDisplay.h
tcGuiDspDisplay::set_fg_color ( tsRgb  rgb  )  [inline]

This routine updates the default color, which is used when a 1 bpp bitmap is displayed on a multiple-bpp display.

Parameters:
[in] rgb Default color to use .
See also:
tcGuiDspDisplay::set_bg_color
guiDspDisplay.h
void MityDSP::tcGuiDspDisplay::set_bg_color ( tsRgb  rgb  )  [inline]
void MityDSP::tcGuiDspDisplay::set_text_color ( tsRgb  rgb  )  [inline]
void MityDSP::tcGuiDspDisplay::set_text_opacity ( int  opacity  )  [inline]
bool MityDSP::tcGuiDspDisplay::set_trans_bitmap ( bool  transparent  )  [inline]
void MityDSP::tcGuiDspDisplay::set_trans_bitmap_color ( tsRgb  rgb  )  [inline]
void MityDSP::tcGuiDspDisplay::set_text_angle ( int  angle  )  [inline]
int MityDSP::tcGuiDspDisplay::get_text_angle (  )  [inline]
int tcGuiDspDisplay::convertRGBtoColor ( uint8  r,
uint8  g,
uint8  b 
)

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] r Relative red color level
[in] g Relative green color level
[in] b Relative blue color level
Returns:
Resulting color as an integer in the current bit depth.
See also:
guiDspDisplay.h
int tcGuiDspDisplay::convertRGBtoColor ( tsRgb  rgb  ) 

Converts specified RGB color to internal bit depth aligned color.

Parameters:
rgb Color to Convert
Returns:
integer representation of interal bit depth aligned color.
Note:
15 and 16 bit depths supported
int MityDSP::tcGuiDspDisplay::alphaBlend ( int  Color0,
int  Color1,
uint32  alpha 
)
int tcGuiDspDisplay::convertRGBtoColor15 ( tsRgb  rgb  )  [static]

Converts specified RGB color to 15 bit depth aligned color.

Parameters:
rgb Color to Convert
Returns:
integer representation of interal bit depth aligned color.
int tcGuiDspDisplay::convertRGBtoColor16 ( tsRgb  rgb  )  [static]

Converts specified RGB color to 16 bit depth aligned color.

Parameters:
rgb Color to Convert
Returns:
integer representation of interal bit depth aligned color.
int tcGuiDspDisplay::convertRGBtoColor15 ( uint8  r,
uint8  g,
uint8  b 
) [static]

Converts specified RGB color to 15 bit depth aligned color.

Parameters:
r red portion of RGB
g green portion of RGB
b blue portion of RGB
Returns:
integer representation of interal bit depth aligned color.
int tcGuiDspDisplay::convertRGBtoColor16 ( uint8  r,
uint8  g,
uint8  b 
) [static]

Converts specified RGB color to 16 bit depth aligned color.

Parameters:
r red portion of RGB
g green portion of RGB
b blue portion of RGB
Returns:
integer representation of interal bit depth aligned color.
tcGuiDspDisplay::teScreenId tcGuiDspDisplay::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:
guiDspDisplay.h
teScreenId MityDSP::tcGuiDspDisplay::getActiveScreen (  )  [inline]
tcGuiDspDisplay::teScreenId tcGuiDspDisplay::setVisibleScreen ( teScreenId  aeScreen  ) 

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:
guiDspDisplay.h
teScreenId MityDSP::tcGuiDspDisplay::getVisibleScreen (  )  [inline]
void tcGuiDspDisplay::clearScreen ( const tcPoint apStart = NULL,
const tcSize 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 with white.

Parameters:
apStart Upper-left corner of rectangle to clear.
apOffset Distance from the upper-left corner to clear.
See also:
guiDspDisplay.h
void MityDSP::tcGuiDspDisplay::set_clip_rect ( const tcRect r  )  [inline]
void MityDSP::tcGuiDspDisplay::clear_clip_rect (  )  [inline]
tcRect MityDSP::tcGuiDspDisplay::get_clip_rect (  )  [inline]
void MityDSP::tcGuiDspDisplay::drawPixel ( tcPoint  p  )  [inline]
void tcGuiDspDisplay::drawPixel ( int  x,
int  y 
)

This routine draws a pixel at the specified point. The pixel is drawn in the current fore ground color on the active screen.

Parameters:
x X-coordinate of the pixel.
y Y-Coordinate of the pixel.
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
tcGuiDspDisplay::drawLine ( tcPoint  p1,
tcPoint  p2 
) [inline]

This routine draws a line from point p1 to point p2. The line is drawn in the current fore ground color on the active screen.

Parameters:
p1 Start point of the line.
p2 End point of the line.
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::drawLine ( int  x1,
int  y1,
int  x2,
int  y2 
)

This routine draws a line from point x1,y1 to point x2,y2. The line is drawn in the current fore ground color on the active screen. Drawn Lines are not anti-aliased. Uses Bresenham's algorithm.

Parameters:
x1 Starting X-coordinate of the line.
y1 Starting Y-Coordinate of the line.
x2 Endpoint X-coordinate of the line.
y2 Endpoint Y-coordinate of the line.
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::drawVertLine ( int  x,
int  y1,
int  y2 
)

This routine draws a vertical line from point x,y1 to point x,y2. The line is drawn in the current fore ground color on the active screen.

Parameters:
x X-coordinate of the line.
y1 Starting Y-Coordinate of the line.
y2 Endpoint Y-coordinate of the line.
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::drawAALine ( float  x1,
float  y1,
float  x2,
float  y2 
)

This routine draws an anti-aliased line from point x1,y1 to point x2,y2. The line is drawn in the current fore ground color on the active screen. This routine uses the Xiaolin Wu line algorithm.

Parameters:
x1 Starting X-coordinate of the line.
y1 Starting Y-Coordinate of the line.
x2 Endpoint X-coordinate of the line.
y2 Endpoint Y-coordinate of the line.
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::drawAALine ( float  x1,
float  y1,
float  x2,
float  y2,
float  width 
)

This routine draws a line from point x1,y1 to point x2,y2 with width width.

Parameters:
x1 Starting X-coordinate of the line.
y1 Starting Y-Coordinate of the line.
x2 Endpoint X-coordinate of the line.
y2 Endpoint Y-coordinate of the line.
width width of line to draw
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::drawRect ( const tcPoint p,
const tcSize s 
)

This routine draws a rectangle of the specified size. The rectangle is drawn in the current fore ground color on the active screen.

Parameters:
p Top left vertex of the rectangle.
s Size of the rectangle.
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::drawRect ( int  x,
int  y,
int  w,
int  h 
)

This routine provides an alternate interface to the drawRectangle method. The rectangle is drawn in the current fore ground color on the active screen.

Parameters:
x Starting X-coordinate of the rectangle.
y Starting Y-Coordinate of the rectangle.
w Width of the rectangle.
h Height of the rectangle.
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::drawRect ( const tcRect r  ) 

This routine provides an alternate interface to the drawRectangle method. The rectangle is drawn in the current fore ground color on the active screen.

Parameters:
r Rectangle coordinates
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::drawFillRect ( const tcPoint p,
const tcSize s 
)

This routine draws a filled rectangle. The rectangle is drawn in the current fore ground color on the active screen.

Parameters:
p Upper left corner of the rectangle
s Width and height of the rectangle
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::drawFillRect ( int  x,
int  y,
int  w,
int  h 
)

This routine draws a filled rectangle. The rectangle is drawn in the current fore ground color on the active screen.

Parameters:
x X coordinate of upper left corner.
y Y coordinate of upper left corner.
w Width of the rectangle.
h Height of the rectangle.
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::drawFillRect ( const tcRect r  ) 

This routine draws a filled rectangle. The rectangle is drawn in the current fore ground color on the active screen.

Parameters:
r Rectangle coordinates
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::draw3dRect ( const tcPoint p,
const tcSize s,
int  light,
int  dark 
)

This routine draws a 3D rectangle. The rectangle is drawn in the current fore ground color on the active screen.

Parameters:
p Upper left corner of the rectangle
s Width and height of the rectangle
light Left & top color
dark Right & bottom color
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::draw3dRect ( int  x,
int  y,
int  w,
int  h,
int  light,
int  dark 
)

This routine draws a 3D rectangle. The rectangle is drawn in the current fore ground color on the active screen.

Parameters:
x X coordinate of upper left corner.
y Y coordinate of upper left corner.
w Width of the rectangle.
h Height of the rectangle.
light Left & top color
dark Right & bottom color
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
void tcGuiDspDisplay::draw3dRect ( const tcRect r,
int  light,
int  dark 
)

This routine draws a filled rectangle. The rectangle is drawn in the current fore ground color on the active screen.

Parameters:
r Rectangle coordinates
light Left & top color
dark Right & bottom color
See also:
tcGuiDspDisplay::set_fg_color
guiDspDisplay.h
tcGuiDspDisplay::drawBitmap ( const tcPoint p,
const tcBitmap &  bmp 
) [inline]

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

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:
p Position to start drawing the bitmap.
bmp Bitmap to draw.
See also:
guiDspDisplay.h
void MityDSP::tcGuiDspDisplay::drawBitmap ( int  x,
int  y,
const tcBitmap &  bmp 
) [inline]
void tcGuiDspDisplay::drawBitmap ( int  x,
int  y,
int  w,
int  h,
const tcBitmap &  bmp,
int  sx,
int  sy 
)

This routine provides an alternate interface to the drawBitmap method. This method allows drawing subregions of a bitmap to the screen.

Parameters:
x X-Coordate to start the bitmap.
y Y-Coordinate to start the bitmap.
w width of the region of the bitmap to draw.
h height of the region of the bitmap to draw.
sx x start location within bitmap to draw
sy y start location within bitmap to draw
bmp Bitmap to draw.
See also:
guiDspDisplay.h
void tcGuiDspDisplay::drawCharacter ( int  x,
int  y,
const tcBitmap &  bmp 
)

This routine draws a single character at the location x, y, in the color specified by m_text_color.

Parameters:
x X-Coordate to start the character.
y Y-Coordinate to start the character.
bmp Character bitmap to draw.
See also:
guiDspDisplay.h
tcGuiDspDisplay::drawText ( tcPoint  p,
const char *  str 
) [inline]

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

Parameters:
[in] p Position of the start of the string.
[in] str The string to display.
See also:
guiDspDisplay.h
void tcGuiDspDisplay::drawText ( int  x,
int  y,
const char *  str,
teHorizontalAlignment  aeHAlign = eeHLeft,
teVerticalAlignment  aeVAlign = eeVTop 
)

This routine is an alternate interface to the drawText method

Parameters:
[in] x X-coordinate of the string's origin.
[in] y Y-coordinate of the string's origin.
[in] str The string to display.
[in] aeHAlign Horizontal alignment (default left alignment)
[in] aeVAlign Vertical alignment (default top alignemnt)
Returns:
The position of the end of the string.
See also:
guiDspDisplay.h
void tcGuiDspDisplay::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.
See also:
guiDspDisplay.h
void tcGuiDspDisplay::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.
See also:
guiDspDisplay.h
void tcGuiDspDisplay::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.
See also:
guiDspDisplay.h
void tcGuiDspDisplay::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.
See also:
guiDspDisplay.h
int MityDSP::tcGuiDspDisplay::numScreens ( void   )  [inline]
bool tcGuiDspDisplay::screenEnabled (  ) 
void tcGuiDspDisplay::set_screen_enabled ( bool  abEnable  ) 

Member Data Documentation

Maximum screen buffers allowed.

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

Maximum pixel depth (bpp).


  
Generated on Wed Mar 17 18:24:43 2010 for MityDSP Skinnable Graphics User Interface (GGUI) by  Doxygen Version 1.6.1
Copyright © 2009, Critical Link LLC, All rights reserved.