NXWidgets: NXWidgets::CGraphicsPort Class Reference

NXWidgets 1.19

Public Member Functions | Private Member Functions | Private Attributes | List of all members
NXWidgets::CGraphicsPort Class Reference

`#include <cgraphicsport.hxx>`

## Public Member Functions
| CGraphicsPort (INxWindow *pNxWnd, nxgl_mxpixel_t backColor=CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR)
| CGraphicsPort (INxWindow *pNxWnd)
virtual | ~CGraphicsPort ()
const nxgl_coord_t | getX (void) const
const nxgl_coord_t | getY (void) const
nxgl_mxpixel_t | getBackColor (void) const
void | setBackColor (nxgl_mxpixel_t backColor)
void | drawPixel (nxgl_coord_t x, nxgl_coord_t y, nxgl_mxpixel_t color)
void | drawHorizLine (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_mxpixel_t color)
void | drawVertLine (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t height, nxgl_mxpixel_t color)
void | drawLine (nxgl_coord_t x1, nxgl_coord_t y1, nxgl_coord_t x2, nxgl_coord_t y2, nxgl_mxpixel_t color, enum INxWindow::ELineCaps caps)
void | drawFilledRect (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, nxgl_mxpixel_t color)
void | drawRect (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, nxgl_mxpixel_t color)
void | drawBevelledRect (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, nxgl_mxpixel_t shineColor, nxgl_mxpixel_t shadowColor)
void | drawFilledCircle (struct nxgl_point_s *center, nxgl_coord_t radius, nxgl_mxpixel_t color)
void | drawText (struct nxgl_point_s *pos, CRect *bound, CNxFont *font, const CNxString &string)
void | drawText (struct nxgl_point_s *pos, CRect *bound, CNxFont *font, const CNxString &string, int startIndex, int length, nxgl_mxpixel_t color)
void | drawText (struct nxgl_point_s *pos, CRect *bound, CNxFont *font, const CNxString &string, int startIndex, int length)
void | drawText (struct nxgl_point_s *pos, CRect *bound, CNxFont *font, const CNxString &string, int startIndex, int length, nxgl_mxpixel_t color, nxgl_mxpixel_t background)
void | drawBitmap (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, const struct SBitmap *bitmap, int bitmapX, int bitmapY)
void | drawBitmap (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, const struct SBitmap *bitmap, int bitmapX, int bitmapY, nxgl_mxpixel_t transparentColor)
void | drawBitmapGreyScale (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, const struct SBitmap *bitmap, int bitmapX, int bitmapY)
void | copy (nxgl_coord_t sourceX, nxgl_coord_t sourceY, nxgl_coord_t destX, nxgl_coord_t destY, nxgl_coord_t width, nxgl_coord_t height)
void | move (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t deltaX, nxgl_coord_t deltaY, nxgl_coord_t width, nxgl_coord_t height)
void | greyScale (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height)
void | invert (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height)

## Private Member Functions
void | _drawText (struct nxgl_point_s *pos, CRect *bound, CNxFont *font, const CNxString &string, int startIndex, int length, nxgl_mxpixel_t background, bool transparent)

## Private Attributes
INxWindow * | m_pNxWnd
nxgl_mxpixel_t | m_backColor

## Detailed Description

CGraphicsPort is the interface between a NXwidget and NX layer.

Definition at line 106 of file cgraphicsport.hxx.

## Constructor & Destructor Documentation

## ◆ CGraphicsPort() [1/2]

CGraphicsPort::CGraphicsPort | ( | INxWindow * | pNxWnd,
|  | nxgl_mxpixel_t | backColor = `CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR`
| ) |  |

Constructor.

Parameters

  pNxWnd. | An instance of the underlying window type.
  backColor. | The background color is only needed if we cannot read from the graphics device.

Definition at line 114 of file cgraphicsport.cxx.

## ◆ CGraphicsPort() [2/2]

CGraphicsPort::CGraphicsPort | ( | INxWindow * | pNxWnd | ) |

Definition at line 120 of file cgraphicsport.cxx.

## ◆ ~CGraphicsPort()

CGraphicsPort::~CGraphicsPort | ( | void |  | ) |
| virtual

Destructor.

Definition at line 130 of file cgraphicsport.cxx.

## Member Function Documentation

## ◆ _drawText()

void CGraphicsPort::_drawText | ( | struct nxgl_point_s * | pos,
|  | CRect * | bound,
|  | CNxFont * | font,
|  | const CNxString & | string,
|  | int | startIndex,
|  | int | length,
|  | nxgl_mxpixel_t | background,
|  | bool | transparent
| ) |  |
| private

The underlying implementation for drawText functions

Parameters

  pos | The window-relative x/y coordinate of the string.
  bound | The window-relative bounds of the string.
  font | The font to draw with.
  string | The string to output.
  startIndex | The start index within the string from which drawing will commence.
  length | The number of characters to draw.
  background | Color to use for background if transparent is false.
  transparent | Whether to fill the background.

Definition at line 706 of file cgraphicsport.cxx.

## ◆ copy()

void CGraphicsPort::copy | ( | nxgl_coord_t | sourceX,
|  | nxgl_coord_t | sourceY,
|  | nxgl_coord_t | destX,
|  | nxgl_coord_t | destY,
|  | nxgl_coord_t | width,
|  | nxgl_coord_t | height
| ) |  |

Copy a rectangular region from the source coordinateinates to the destination coordinateinates.

Parameters

  sourceX | Source x coordinate.
  sourceY | Source y coordinate.
  destX | Destination x coordinate.
  destY | Destination y coordinate.
  width | Width of the rectangle to copy.
  height | Height of the rectangle to copy.

Copy a rectangular region from the source coordinates to the destination coordinates.

Parameters

  sourceX | Source x coordinate.
  sourceY | Source y coordinate.
  destX | Destination x coordinate.
  destY | Destination y coordinate.
  width | Width of the rectangle to copy.
  height | Height of the rectangle to copy.

Definition at line 857 of file cgraphicsport.cxx.

## ◆ drawBevelledRect()

void CGraphicsPort::drawBevelledRect | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | width,
|  | nxgl_coord_t | height,
|  | nxgl_mxpixel_t | shineColor,
|  | nxgl_mxpixel_t | shadowColor
| ) |  |

Draw a bevelled rectangle to the window.

Parameters

  x | The x coordinate of the rectangle.
  y | The y coordinate of the rectangle.
  width | The width of the rectangle.
  height | The height of the rectangle.
  shineColor | The color of the top/left sides.
  shadowColor | The color of the bottom/right sides.

Definition at line 323 of file cgraphicsport.cxx.

## ◆ drawBitmap() [1/2]

void CGraphicsPort::drawBitmap | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | width,
|  | nxgl_coord_t | height,
|  | const struct SBitmap * | bitmap,
|  | int | bitmapX,
|  | int | bitmapY
| ) |  |

Draw an opaque bitmap to the window.

Parameters

  x | The window-relative x coordinate to draw the bitmap to.
  y | The window-relative y coordinate to draw the bitmap to.
  width | The width of the bitmap to draw.
  height | The height of the bitmap to draw.
  bitmap | Pointer to the bitmap to draw.
  bitmapX | The window-relative x coordinate within the supplied bitmap to use as the origin.
  bitmapY | The window-relative y coordinate within the supplied bitmap to use as the origin.

Definition at line 348 of file cgraphicsport.cxx.

## ◆ drawBitmap() [2/2]

void CGraphicsPort::drawBitmap | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | width,
|  | nxgl_coord_t | height,
|  | const struct SBitmap * | bitmap,
|  | int | bitmapX,
|  | int | bitmapY,
|  | nxgl_mxpixel_t | transparentColor
| ) |  |

Draw a bitmap to the window, using the supplied transparent color as an invisible color.

Parameters

  x | The window-relative x coordinate to draw the bitmap to.
  y | The window-relative y coordinate to draw the bitmap to.
  width | The width of the bitmap to draw.
  height | The height of the bitmap to draw.
  bitmap | Pointer to the bitmap to draw.
  bitmapX | The window-relative x coordinate within the supplied bitmap to use as the origin.
  bitmapY | The window-relative y coordinate within the supplied bitmap to use as the origin.
  transparentColor | The transparent color used in the bitmap.

Definition at line 391 of file cgraphicsport.cxx.

## ◆ drawBitmapGreyScale()

void CGraphicsPort::drawBitmapGreyScale | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | width,
|  | nxgl_coord_t | height,
|  | const struct SBitmap * | bitmap,
|  | int | bitmapX,
|  | int | bitmapY
| ) |  |

Draw a bitmap to the port in greyscale.

Parameters

  x | The window-relative x coordinate to draw the bitmap to.
  y | The window-relative y coordinate to draw the bitmap to.
  width | The width of the bitmap to draw.
  height | The height of the bitmap to draw.
  bitmap | Pointer to the bitmap to draw.
  bitmapX | The window-relative x coordinate within the supplied bitmap to use as the origin.
  bitmapY | The window-relative y coordinate within the supplied bitmap to use as the origin.

Definition at line 528 of file cgraphicsport.cxx.

## ◆ drawFilledCircle()

void NXWidgets::CGraphicsPort::drawFilledCircle | ( | struct nxgl_point_s * | center,
|  | nxgl_coord_t | radius,
|  | nxgl_mxpixel_t | color
| ) |  |
| inline

Draw a filled circle at the specified position, size, and color.

Parameters

  center | The window-relative coordinates of the circle center.
  radius | The radius of the rectangle in pixels.
  color | The color of the rectangle.

Definition at line 304 of file cgraphicsport.hxx.

## ◆ drawFilledRect()

void CGraphicsPort::drawFilledRect | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | width,
|  | nxgl_coord_t | height,
|  | nxgl_mxpixel_t | color
| ) |  |

Draw a filled rectangle of the specified start position, end position, width, and color.

Parameters

  x | The window-relative x coordinate of the rectangle.
  y | The window-relative y coordinate of the rectangle.
  width | The width of the rectangle in pixels.
  height | The height of the rectangle in rows.
  color | The color of the rectangle.

Draw a filled rectangle to the bitmap.

Parameters

  x | The window-relative x coordinate of the rectangle.
  y | The window-relative y coordinate of the rectangle.
  width | The width of the rectangle in pixels.
  height | The height of the rectangle in rows.
  color | The color of the rectangle.

Definition at line 280 of file cgraphicsport.cxx.

## ◆ drawHorizLine()

void CGraphicsPort::drawHorizLine | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | width,
|  | nxgl_mxpixel_t | color
| ) |  |

Draw a horizontal line of the specified start position, width, and color.

Parameters

  x | The x coordinate of the line.
  y | The y coordinate of the top-most end of the line.
  width | The width of the line in pixels.
  color | The color of the line.

Definition at line 191 of file cgraphicsport.cxx.

## ◆ drawLine()

void CGraphicsPort::drawLine | ( | nxgl_coord_t | x1,
|  | nxgl_coord_t | y1,
|  | nxgl_coord_t | x2,
|  | nxgl_coord_t | y2,
|  | nxgl_mxpixel_t | color,
|  | enum INxWindow::ELineCaps | caps
| ) |  |

Draw a line of a fixed color in the window.

Parameters

  x1 | The x coordinate of the start point of the line.
  y1 | The y coordinate of the start point of the line.
  x2 | The x coordinate of the end point of the line.
  y2 | The y coordinate of the end point of the line.
  color | The color of the line.
  caps | Draw a circular cap on the ends of the line to support better line joins

Draw a line of a fixed color in the window.

Parameters

  x1 | - The x coordinate of the start point of the line.
  y1 | - The y coordinate of the start point of the line.
  x2 | - The x coordinate of the end point of the line.
  y2 | - The y coordinate of the end point of the line.
  color | - The color of the line.
  caps | - Draw a circular cap one the ends of the line to support better line joins

Definition at line 253 of file cgraphicsport.cxx.

## ◆ drawPixel()

void CGraphicsPort::drawPixel | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_mxpixel_t | color
| ) |  |

Draw a pixel into the window.

Parameters

  x | The window-relative x coordinate of the pixel.
  y | The window-relative y coordinate of the pixel.
  color | The color of the pixel.

Definition at line 173 of file cgraphicsport.cxx.

## ◆ drawRect()

void CGraphicsPort::drawRect | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | width,
|  | nxgl_coord_t | height,
|  | nxgl_mxpixel_t | color
| ) |  |

Draw an unfilled rectangle to the window

Parameters

  x | The window-relative x coordinate of the rectangle.
  y | The window-relative y coordinate of the rectangle.
  width | The width of the rectangle.
  height | The height of the rectangle.
  color | The color of the rectangle .

Draw an unfilled rectangle to the window

Parameters

  x | The window-relative x coordinate of the rectangle.
  y | The window-relative y coordinate of the rectangle.
  width | The width of the rectangle.
  height | The height of the rectangle.
  color | The color of the rectangle outline.

Definition at line 302 of file cgraphicsport.cxx.

## ◆ drawText() [1/4]

void CGraphicsPort::drawText | ( | struct nxgl_point_s * | pos,
|  | CRect * | bound,
|  | CNxFont * | font,
|  | const CNxString & | string
| ) |  |

Draw a string to the window.

Parameters

  pos | The window-relative x/y coordinate of the string.
  bound | The window-relative bounds of the string.
  font | The font to draw with.
  string | The string to output.

Definition at line 609 of file cgraphicsport.cxx.

## ◆ drawText() [2/4]

void CGraphicsPort::drawText | ( | struct nxgl_point_s * | pos,
|  | CRect * | bound,
|  | CNxFont * | font,
|  | const CNxString & | string,
|  | int | startIndex,
|  | int | length,
|  | nxgl_mxpixel_t | color
| ) |  |

Draw a particular length of a string to the window in a secific color.

Parameters

  pos | The window-relative x/y coordinate of the string.
  bound | The window-relative bounds of the string.
  font | The font to draw with.
  string | The string to output.
  startIndex | The start index within the string from which drawing will commence.
  length | The number of characters to draw.
  color | The color of the string.

Definition at line 628 of file cgraphicsport.cxx.

## ◆ drawText() [3/4]

void CGraphicsPort::drawText | ( | struct nxgl_point_s * | pos,
|  | CRect * | bound,
|  | CNxFont * | font,
|  | const CNxString & | string,
|  | int | startIndex,
|  | int | length
| ) |  |

Draw a portion of a string to the window.

Parameters

  pos | The window-relative x/y coordinate of the string.
  bound | The window-relative bounds of the string.
  font | The font to draw with.
  string | The string to output.
  startIndex | The start index within the string from which drawing will commence.
  length | The number of characters to draw.

Definition at line 658 of file cgraphicsport.cxx.

## ◆ drawText() [4/4]

void CGraphicsPort::drawText | ( | struct nxgl_point_s * | pos,
|  | CRect * | bound,
|  | CNxFont * | font,
|  | const CNxString & | string,
|  | int | startIndex,
|  | int | length,
|  | nxgl_mxpixel_t | color,
|  | nxgl_mxpixel_t | background
| ) |  |

Draw a portion of a string to the window and fill the background in one go.

Parameters

  pos | The window-relative x/y coordinate of the string.
  bound | The window-relative bounds of the string.
  font | The font to draw with.
  string | The string to output.
  startIndex | The start index within the string from which drawing will commence.
  length | The number of characters to draw.
  color | Foreground color
  background | Background color

Definition at line 679 of file cgraphicsport.cxx.

## ◆ drawVertLine()

void CGraphicsPort::drawVertLine | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | height,
|  | nxgl_mxpixel_t | color
| ) |  |

Draw a vertical line of the specified start position, width, and color.

Parameters

  x | The x coordinate of the left-most end of the line.
  y | The y coordinate of the line.
  height | The height of the line in rows.
  color | The color of the line.

Definition at line 221 of file cgraphicsport.cxx.

## ◆ getBackColor()

nxgl_mxpixel_t NXWidgets::CGraphicsPort::getBackColor | ( | void |  | ) | const
| inline

Get the background color that will be used to fill in the spaces when rendering fonts. This background color is ONLY used if the LCD device does not support reading GRAM contents.

Returns
  . The current background color being used.

Definition at line 180 of file cgraphicsport.hxx.

## ◆ getX()

const nxgl_coord_t CGraphicsPort::getX | ( | void |  | ) | const

Return the absolute x coordinate of the upper left hand corner of the underlying window.

Returns
  The x coordinate of the window.

Return the absolute x coordinate of the upper left hand corner of the underlying window.

Returns
  The x coordinate of the underlying window.

Definition at line 144 of file cgraphicsport.cxx.

## ◆ getY()

const nxgl_coord_t CGraphicsPort::getY | ( | void |  | ) | const

Return the absolute y coordinate of the upper left hand corner of the underlying window.

Returns
  The y coordinate of the window.

Return the absolute y coordinate of the upper left hand corner of the underlying window.

Returns
  The y coordinate of the underlying window.

Definition at line 158 of file cgraphicsport.cxx.

## ◆ greyScale()

void CGraphicsPort::greyScale | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | width,
|  | nxgl_coord_t | height
| ) |  |

Convert the region to greyscale.

Parameters

  x | X coordinate of the region to change.
  y | Y coordinate of the region to change.
  width | Width of the region to change.
  height | Height of the region to change.

Definition at line 912 of file cgraphicsport.cxx.

## ◆ invert()

void CGraphicsPort::invert | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | width,
|  | nxgl_coord_t | height
| ) |  |

Invert colors in a region. NOTE: This allocates an in-memory buffer the size of one row in graphic memory. So it may only be useful for inverting small regions and its only current use of for the inverted cursor text.

Parameters

  x | X coordinate of the region to change.
  y | Y coordinate of the region to change.
  width | Width of the region to change.
  height | Height of the region to change.

Definition at line 995 of file cgraphicsport.cxx.

## ◆ move()

void CGraphicsPort::move | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | deltaX,
|  | nxgl_coord_t | deltaY,
|  | nxgl_coord_t | width,
|  | nxgl_coord_t | height
| ) |  |

Move a region by a specified distance in two dimensions.

Parameters

  x | X coordinate of the source area to move.
  y | Y coordinate of the source area to move.
  deltaX | Horizontal distance to move.
  deltaY | Vertical distance to move.
  width | Width of the area to move.
  height | Height of the area to move.

Definition at line 886 of file cgraphicsport.cxx.

## ◆ setBackColor()

void NXWidgets::CGraphicsPort::setBackColor | ( | nxgl_mxpixel_t | backColor | ) |
| inline

Set the background color that will be used to fill in the spaces when rendering fonts. This background color is ONLY used if the LCD device does not support reading GRAM contents.

Returns
  . The current background color being used.

Definition at line 195 of file cgraphicsport.hxx.

## Member Data Documentation

## ◆ m_backColor

nxgl_mxpixel_t NXWidgets::CGraphicsPort::m_backColor
| private

The background color to use

Definition at line 111 of file cgraphicsport.hxx.

## ◆ m_pNxWnd

INxWindow* NXWidgets::CGraphicsPort::m_pNxWnd
| private

NX window interface.

Definition at line 109 of file cgraphicsport.hxx.

The documentation for this class was generated from the following files:

- cgraphicsport.hxx
- cgraphicsport.cxx