#include <core/guiDspDisplay.h>
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). |
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.
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.
[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). |
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.
[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. |
tcGuiDspDisplay::~tcGuiDspDisplay | ( | ) |
This destructor destroys an instance of a display. It clears the screen, then calls setVisibleScreen to blank the display.
tcGuiDspDisplay::getWidth | ( | ) | [inline] |
Retrieves display width in pixels.
tcGuiDspDisplay::getHeight | ( | ) | [inline] |
Retrieves display height in pixels.
void tcGuiDspDisplay::rotate | ( | bool | abRotate | ) |
Enables or disables 90 degree display rotation.
[in] | abRotate | If true, rotates display 90-degrees. |
tcGuiDspDisplay::isRotated | ( | ) | [inline] |
Indicates whether display is currently rotated 90 degrees.
tcGuiDspDisplay::set_font | ( | tcDspFont * | apFont | ) | [inline] |
This routine updates the default font, which is used when no other font is explicitly specified.
apFont | Font to use for text drawing. |
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.
str | The string to use for calculation. |
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.
[in] | rgb | Default color to use . |
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.
[in] | r | Relative red color level |
[in] | g | Relative green color level |
[in] | b | Relative blue color level |
int tcGuiDspDisplay::convertRGBtoColor | ( | tsRgb | rgb | ) |
Converts specified RGB color to internal bit depth aligned color.
rgb | Color to Convert |
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.
rgb | Color to Convert |
int tcGuiDspDisplay::convertRGBtoColor16 | ( | tsRgb | rgb | ) | [static] |
Converts specified RGB color to 16 bit depth aligned color.
rgb | Color to Convert |
int tcGuiDspDisplay::convertRGBtoColor15 | ( | uint8 | r, | |
uint8 | g, | |||
uint8 | b | |||
) | [static] |
Converts specified RGB color to 15 bit depth aligned color.
r | red portion of RGB | |
g | green portion of RGB | |
b | blue portion of RGB |
int tcGuiDspDisplay::convertRGBtoColor16 | ( | uint8 | r, | |
uint8 | g, | |||
uint8 | b | |||
) | [static] |
Converts specified RGB color to 16 bit depth aligned color.
r | red portion of RGB | |
g | green portion of RGB | |
b | blue portion of RGB |
tcGuiDspDisplay::teScreenId tcGuiDspDisplay::setActiveScreen | ( | teScreenId | aeScreen | ) |
This routine updates the active screen (the one that gets written to by default).
[in] | aeScreen | The desired new active (default) screen ID. |
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.
[in] | aeScreen | The desired new visible screen. |
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.
apStart | Upper-left corner of rectangle to clear. | |
apOffset | Distance from the upper-left corner to clear. |
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.
x | X-coordinate of the pixel. | |
y | Y-Coordinate of the pixel. |
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.
p1 | Start point of the line. | |
p2 | End point of the line. |
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.
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. |
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.
x | X-coordinate of the line. | |
y1 | Starting Y-Coordinate of the line. | |
y2 | Endpoint Y-coordinate of the line. |
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.
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. |
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.
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 |
This routine draws a rectangle of the specified size. The rectangle is drawn in the current fore ground color on the active screen.
p | Top left vertex of the rectangle. | |
s | Size of the rectangle. |
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.
x | Starting X-coordinate of the rectangle. | |
y | Starting Y-Coordinate of the rectangle. | |
w | Width of the rectangle. | |
h | Height of the rectangle. |
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.
r | Rectangle coordinates |
This routine draws a filled rectangle. The rectangle is drawn in the current fore ground color on the active screen.
p | Upper left corner of the rectangle | |
s | Width and height of the rectangle |
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.
x | X coordinate of upper left corner. | |
y | Y coordinate of upper left corner. | |
w | Width of the rectangle. | |
h | Height of the rectangle. |
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.
r | Rectangle coordinates |
This routine draws a 3D rectangle. The rectangle is drawn in the current fore ground color on the active screen.
p | Upper left corner of the rectangle | |
s | Width and height of the rectangle | |
light | Left & top color | |
dark | Right & bottom color |
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.
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 |
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.
r | Rectangle coordinates | |
light | Left & top color | |
dark | Right & bottom color |
tcGuiDspDisplay::drawBitmap | ( | const tcPoint & | p, | |
const tcBitmap & | bmp | |||
) | [inline] |
This routine places a bitmap of the specified width and height.
p | Position to start drawing the bitmap. | |
bmp | Bitmap to draw. |
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.
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. |
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.
x | X-Coordate to start the character. | |
y | Y-Coordinate to start the character. | |
bmp | Character bitmap to draw. |
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.
[in] | p | Position of the start of the string. |
[in] | str | The string to display. |
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
[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) |
void tcGuiDspDisplay::screenCopy | ( | teScreenId | aeDest, | |
teScreenId | aeSrc | |||
) |
This routine copies a source screen to a destination screen.
[in] | aeDest | Destination screen ID. |
[in] | aeSrc | Source screen ID. |
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.
[in] | aeDest | Destination screen ID. |
[in] | aeSrc1 | First source screen ID. |
[in] | aeSrc2 | Second source screen ID. |
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.
[in] | aeDest | Destination screen ID. |
[in] | aeSrc1 | First source screen ID. |
[in] | aeSrc2 | Second source screen ID. |
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.
[in] | aeDest | Destination screen ID. |
[in] | aeSrc1 | First source screen ID. |
[in] | aeSrc2 | Second source screen ID. |
int MityDSP::tcGuiDspDisplay::numScreens | ( | void | ) | [inline] |
bool tcGuiDspDisplay::screenEnabled | ( | ) |
void tcGuiDspDisplay::set_screen_enabled | ( | bool | abEnable | ) |
const int MityDSP::tcGuiDspDisplay::gnMAX_SCREENS = 8 [static] |
Maximum screen buffers allowed.
const int MityDSP::tcGuiDspDisplay::gnMAX_DEPTH = 16 [static] |
Maximum pixel depth (bpp).