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

INxWindowm_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
posThe window-relative x/y coordinate of the string.
boundThe window-relative bounds of the string.
fontThe font to draw with.
stringThe string to output.
startIndexThe start index within the string from which drawing will commence.
lengthThe number of characters to draw.
backgroundColor to use for background if transparent is false.
transparentWhether 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
sourceXSource x coordinate.
sourceYSource y coordinate.
destXDestination x coordinate.
destYDestination y coordinate.
widthWidth of the rectangle to copy.
heightHeight of the rectangle to copy.

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

Parameters
sourceXSource x coordinate.
sourceYSource y coordinate.
destXDestination x coordinate.
destYDestination y coordinate.
widthWidth of the rectangle to copy.
heightHeight 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
xThe x coordinate of the rectangle.
yThe y coordinate of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
shineColorThe color of the top/left sides.
shadowColorThe 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
xThe window-relative x coordinate to draw the bitmap to.
yThe window-relative y coordinate to draw the bitmap to.
widthThe width of the bitmap to draw.
heightThe height of the bitmap to draw.
bitmapPointer to the bitmap to draw.
bitmapXThe window-relative x coordinate within the supplied bitmap to use as the origin.
bitmapYThe 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
xThe window-relative x coordinate to draw the bitmap to.
yThe window-relative y coordinate to draw the bitmap to.
widthThe width of the bitmap to draw.
heightThe height of the bitmap to draw.
bitmapPointer to the bitmap to draw.
bitmapXThe window-relative x coordinate within the supplied bitmap to use as the origin.
bitmapYThe window-relative y coordinate within the supplied bitmap to use as the origin.
transparentColorThe 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
xThe window-relative x coordinate to draw the bitmap to.
yThe window-relative y coordinate to draw the bitmap to.
widthThe width of the bitmap to draw.
heightThe height of the bitmap to draw.
bitmapPointer to the bitmap to draw.
bitmapXThe window-relative x coordinate within the supplied bitmap to use as the origin.
bitmapYThe 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
centerThe window-relative coordinates of the circle center.
radiusThe radius of the rectangle in pixels.
colorThe 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
xThe window-relative x coordinate of the rectangle.
yThe window-relative y coordinate of the rectangle.
widthThe width of the rectangle in pixels.
heightThe height of the rectangle in rows.
colorThe color of the rectangle.

Draw a filled rectangle to the bitmap.

Parameters
xThe window-relative x coordinate of the rectangle.
yThe window-relative y coordinate of the rectangle.
widthThe width of the rectangle in pixels.
heightThe height of the rectangle in rows.
colorThe 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
xThe x coordinate of the line.
yThe y coordinate of the top-most end of the line.
widthThe width of the line in pixels.
colorThe 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
x1The x coordinate of the start point of the line.
y1The y coordinate of the start point of the line.
x2The x coordinate of the end point of the line.
y2The y coordinate of the end point of the line.
colorThe color of the line.
capsDraw 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
xThe window-relative x coordinate of the pixel.
yThe window-relative y coordinate of the pixel.
colorThe 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
xThe window-relative x coordinate of the rectangle.
yThe window-relative y coordinate of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
colorThe color of the rectangle .

Draw an unfilled rectangle to the window

Parameters
xThe window-relative x coordinate of the rectangle.
yThe window-relative y coordinate of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
colorThe 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
posThe window-relative x/y coordinate of the string.
boundThe window-relative bounds of the string.
fontThe font to draw with.
stringThe 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
posThe window-relative x/y coordinate of the string.
boundThe window-relative bounds of the string.
fontThe font to draw with.
stringThe string to output.
startIndexThe start index within the string from which drawing will commence.
lengthThe number of characters to draw.
colorThe 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
posThe window-relative x/y coordinate of the string.
boundThe window-relative bounds of the string.
fontThe font to draw with.
stringThe string to output.
startIndexThe start index within the string from which drawing will commence.
lengthThe 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
posThe window-relative x/y coordinate of the string.
boundThe window-relative bounds of the string.
fontThe font to draw with.
stringThe string to output.
startIndexThe start index within the string from which drawing will commence.
lengthThe number of characters to draw.
colorForeground color
backgroundBackground 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
xThe x coordinate of the left-most end of the line.
yThe y coordinate of the line.
heightThe height of the line in rows.
colorThe 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
xX coordinate of the region to change.
yY coordinate of the region to change.
widthWidth of the region to change.
heightHeight 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
xX coordinate of the region to change.
yY coordinate of the region to change.
widthWidth of the region to change.
heightHeight 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
xX coordinate of the source area to move.
yY coordinate of the source area to move.
deltaXHorizontal distance to move.
deltaYVertical distance to move.
widthWidth of the area to move.
heightHeight 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: