Solo Controller Documentation 1.0
Documentation for the Solo Controller
 
Loading...
Searching...
No Matches
Canvas Class Reference

#include <Canvas.h>

Inheritance diagram for Canvas:
DRAM_Canvas ROM_Canvas

Public Member Functions

Constructors and Destructors
 Canvas (void)
 Default constructor sets canvass to the full size of the display.
 
 Canvas (bool temporary)
 Constructor sets canvass to the full size of the display.
 
 Canvas (uint16_t width, uint16_t height, bool temporary=false)
 Constructor.
 
 ~Canvas (void)=default
 Default destructor.
 
General Methods
virtual void loadImage (void) const
 Loads imagery onto the canvas.
 
void setActive (void) const
 Sets this canvas as both the active canvas and active window.
 
void setMainWindow (void) const
 Sets this canvas as the Main Window, displaying it in the TFT.
 
Accessor Methods
uint16_t width (void) const
 Accessor method providing the canvas width.
 
uint16_t height (void) const
 Accessor method providing the canvas height.
 
uint32_t address (void) const
 Accessor method providing the canvas' starting address in DRAM.
 
Bit Transfer Engine (BTE) Operations
void BTE_CopyFrom (const Canvas &source) const
 Uses BTE engine to copy entire image from source canvas to this one.
 
void BTE_CopyFrom (const Canvas &source, uint16_t DT_x0, uint16_t DT_y0) const
 Uses BTE engine to copy imagery from source canvas to this one.
 
void BTE_ROP (const Canvas &S0, uint16_t S0_x0, uint16_t S0_y0, const Canvas &S1, uint16_t S1_x0, uint16_t S1_y0, uint16_t DT_x0, uint16_t DT_y0, uint16_t DT_width, uint16_t DT_height, uint8_t ROP, bool S1_OpacityOn=false) const
 Gneralized ROP operation. This assumes that object calling this method is the destimation DT canvas.
 
void BTE_CopyFrom (const Canvas &source, uint16_t Src_x0, uint16_t Src_y0, uint16_t DT_x0, uint16_t DT_y0, uint16_t width, uint16_t height) const
 Uses BTE engine to copy imagery from source canvas to this one.
 
void BTE_AddImageFrom (const Canvas &source, uint16_t Src_x0, uint16_t Src_y0, uint16_t DT_x0, uint16_t DT_y0, uint16_t width, uint16_t height) const
 Adds an opacity encoded image from source to the image on this canvas.
 
void BTE_AddTransparantImageFrom (const Canvas &source, uint16_t Src_x0, uint16_t Src_y0, uint16_t DT_x0, uint16_t DT_y0, uint16_t width, uint16_t height) const
 Adds an opacity encoded image from source to the image on this canvas.
 

Static Public Member Functions

static void BL_ON (void)
 Turns the TFT backlight on.
 
static void BL_OFF (void)
 Turns the TFT backlight off.
 
static uint32_t nextAddress (void)
 Location in DRAM whether the next image Canvas will be placed.
 

Protected Member Functions

void _validate (void) const
 Protected method used to validate that the images used to create this canvas are appropriately size.
 
void BTE_SetAsS0 (uint16_t x0, uint16_t y0) const
 Sets the location of the S0 source image for the BTE engine.
 
void BTE_SetAsS1 (uint16_t x0, uint16_t y0) const
 Sets the location of the S1 source image for the BTE engine.
 
void BTE_SetAsDT (uint16_t x0, uint16_t y0) const
 Sets the location of the destination (DT) image for the BTE engine.
 

Graphics primatives

void clear (void)
 Erases the canvas, setting all pixels to Black.
 
void clear (uint16_t color)
 Erases the canvas, setting all pixels to the specified color.
 
void solidFill (uint16_t x0, uint16_t y0, uint16_t width, uint16_t height, uint16_t color) const
 Draws a filled square onto the canvas.
 
void text (uint16_t x0, uint16_t y0, uint16_t fColor, uint16_t bColor, const char *text, bool small=false) const
 Draws text onto the canvas.
 
void drawSquare (unsigned short x0, unsigned short y0, unsigned short x1, unsigned short y1, unsigned short color) const
 Draws an unfilled square.
 
static void drawLine (uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color)
 Draws a line onto the display.
 

Constructor & Destructor Documentation

◆ Canvas() [1/3]

Canvas::Canvas ( void )
inline

Default constructor sets canvass to the full size of the display.

◆ Canvas() [2/3]

Canvas::Canvas ( bool temporary)

Constructor sets canvass to the full size of the display.

Parameters
[in]temporary(Optional) If true, the canvas is temporary. Future canvasses will overwrite the DRAM used by this canvas.

◆ Canvas() [3/3]

Canvas::Canvas ( uint16_t width,
uint16_t height,
bool temporary = false )

Constructor.

Parameters
[in]widthWidth of the constructed canvas
[in]heightHeight of the constructed canvas
[in]temporary(Optional) If true, the canvas is temporary. Future canvasses will overwrite the DRAM used by this canvas.

◆ ~Canvas()

Canvas::~Canvas ( void )
default

Default destructor.

Parameters
None.

Member Function Documentation

◆ _validate()

void Canvas::_validate ( void ) const
protected

Protected method used to validate that the images used to create this canvas are appropriately size.

Parameters
None.

Verify that the width of any images used by this object has a width that is a multiple of 4. This is required by the LT7683 graphics chip.

◆ address()

uint32_t Canvas::address ( void ) const
inline

Accessor method providing the canvas' starting address in DRAM.

Parameters
None.
Returns
Starting address of the canvas in DRAM

◆ BL_OFF()

static void Canvas::BL_OFF ( void )
inlinestatic

Turns the TFT backlight off.

Parameters
None.

◆ BL_ON()

static void Canvas::BL_ON ( void )
inlinestatic

Turns the TFT backlight on.

Parameters
None.

◆ BTE_AddImageFrom()

void Canvas::BTE_AddImageFrom ( const Canvas & source,
uint16_t Src_x0,
uint16_t Src_y0,
uint16_t DT_x0,
uint16_t DT_y0,
uint16_t width,
uint16_t height ) const
inline

Adds an opacity encoded image from source to the image on this canvas.

Parameters
[in]sourcecanvas containg the source imagery
[in]Src_x0Upper left x-coordinate of image block within source
[in]Src_y0Upper left y-coodrinate of image block within source
[in]DT_x0Upper left x-coordinate in this canvas where image block is to be copied
[in]DT_y0Upper left y-coordinate in this canvas where image block is to be copied
[in]widthWidth of the image block to be transferred
[in]heightHeight of the image block to be transferred

◆ BTE_AddTransparantImageFrom()

void Canvas::BTE_AddTransparantImageFrom ( const Canvas & source,
uint16_t Src_x0,
uint16_t Src_y0,
uint16_t DT_x0,
uint16_t DT_y0,
uint16_t width,
uint16_t height ) const
inline

Adds an opacity encoded image from source to the image on this canvas.

Parameters
[in]sourcecanvas containg the source imagery
[in]Src_x0Upper left x-coordinate of image block within source
[in]Src_y0Upper left y-coodrinate of image block within source
[in]DT_x0Upper left x-coordinate in this canvas where image block is to be copied
[in]DT_y0Upper left y-coordinate in this canvas where image block is to be copied
[in]widthWidth of the image block to be transferred
[in]heightHeight of the image block to be transferred

◆ BTE_CopyFrom() [1/3]

void Canvas::BTE_CopyFrom ( const Canvas & source) const

Uses BTE engine to copy entire image from source canvas to this one.

Parameters
[in]sourcecanvas containg the source imagery

◆ BTE_CopyFrom() [2/3]

void Canvas::BTE_CopyFrom ( const Canvas & source,
uint16_t DT_x0,
uint16_t DT_y0 ) const

Uses BTE engine to copy imagery from source canvas to this one.

Parameters
[in]sourcecanvas containg the source imagery
[in]DT_x0Upper left x-coordinate in this canvas where image block is to be copied
[in]DT_y0Upper left y-coordinate in this canvas where image block is to be copied

◆ BTE_CopyFrom() [3/3]

void Canvas::BTE_CopyFrom ( const Canvas & source,
uint16_t Src_x0,
uint16_t Src_y0,
uint16_t DT_x0,
uint16_t DT_y0,
uint16_t width,
uint16_t height ) const
inline

Uses BTE engine to copy imagery from source canvas to this one.

Parameters
[in]sourcecanvas containg the source imagery
[in]Src_x0Upper left x-coordinate of image block within source
[in]Src_y0Upper left y-coodrinate of image block within source
[in]DT_x0Upper left x-coordinate in this canvas where image block is to be copied
[in]DT_y0Upper left y-coordinate in this canvas where image block is to be copied
[in]widthWidth of the image block to be transferred
[in]heightHeight of the image block to be transferred

◆ BTE_ROP()

void Canvas::BTE_ROP ( const Canvas & S0,
uint16_t S0_x0,
uint16_t S0_y0,
const Canvas & S1,
uint16_t S1_x0,
uint16_t S1_y0,
uint16_t DT_x0,
uint16_t DT_y0,
uint16_t DT_width,
uint16_t DT_height,
uint8_t ROP,
bool S1_OpacityOn = false ) const

Gneralized ROP operation. This assumes that object calling this method is the destimation DT canvas.

Parameters
[in]S0Canvas containg the S0 source imagery
[in]S0_x0Upper left x-coordinate of image block within S0 to be processed by BTE
[in]S0_y0Upper left y-coodrinate of image block within S0 to be processed by BTE
[in]S1Canvas containg the S1 source imagery
[in]S1_x0Upper left x-coordinate of image block within S1 to be processed by BTE
[in]S1_y0Upper left y-coodrinate of image block within S1 to be processed by BTE
[in]DT_x0Upper left x-coordinate where the final image is to placed within this canvas
[in]DT_y0Upper left y-coordinate where the final image is to placed within this canvas
[in]DT_widthWidth of the image block to be processed by the BTE
[in]DT_heightHeight of the image block to be processed by the BTE
[in]ROPCode define the raster operation: S0 (ROP) S1 = DT
[in]S1_OpacityOnIf true, S1 image is treated as a 16bpp image with encoded opacity. If false, S1 is a standard 16bpp image

◆ BTE_SetAsDT()

void Canvas::BTE_SetAsDT ( uint16_t x0,
uint16_t y0 ) const
protected

Sets the location of the destination (DT) image for the BTE engine.

Parameters
[in]x0Upper left x-coordinate of the DT image in this canvas
[in]y0Upper left y-coordinate of the DT image in this canvas

◆ BTE_SetAsS0()

void Canvas::BTE_SetAsS0 ( uint16_t x0,
uint16_t y0 ) const
protected

Sets the location of the S0 source image for the BTE engine.

Parameters
[in]x0Upper left x-coordinate of the S0 image in this canvas
[in]y0Upper left y-coordinate of the S0 image in this canvas

◆ BTE_SetAsS1()

void Canvas::BTE_SetAsS1 ( uint16_t x0,
uint16_t y0 ) const
protected

Sets the location of the S1 source image for the BTE engine.

Parameters
[in]x0Upper left x-coordinate of the S1 image in this canvas
[in]y0Upper left y-coordinate of the S1 image in this canvas

◆ clear() [1/2]

void Canvas::clear ( uint16_t color)
inline

Erases the canvas, setting all pixels to the specified color.

Parameters
[in]color16 bit color value

◆ clear() [2/2]

void Canvas::clear ( void )
inline

Erases the canvas, setting all pixels to Black.

Parameters
None.

◆ drawLine()

void Canvas::drawLine ( uint16_t x0,
uint16_t y0,
uint16_t x1,
uint16_t y1,
uint16_t color )
static

Draws a line onto the display.

Parameters
x0[in] Starting x-pos
y0[in] Starting y-pos
x1[in] Ending x-pos
y1[in] Ending y-pos
color[in] 16-bit color of the line

◆ drawSquare()

void Canvas::drawSquare ( unsigned short x0,
unsigned short y0,
unsigned short x1,
unsigned short y1,
unsigned short color ) const

Draws an unfilled square.

Parameters
[in]x0UL x-coordinate
[in]y0UL y-coordinate
[in]x1LR x-coordinate
[in]y1LR y-coordinate
[in]color16-bit color

◆ height()

uint16_t Canvas::height ( void ) const
inline

Accessor method providing the canvas height.

Parameters
None.
Returns
Height of the canvas.

◆ loadImage()

virtual void Canvas::loadImage ( void ) const
inlinevirtual

Loads imagery onto the canvas.

Parameters
None.

This method doesn't do anything for this class. However, it is expected that derived classes will override this method, providing functionality appropriate for that class.

Reimplemented in DRAM_Canvas, and ROM_Canvas.

◆ nextAddress()

static uint32_t Canvas::nextAddress ( void )
inlinestatic

Location in DRAM whether the next image Canvas will be placed.

Parameters
None.

◆ setActive()

void Canvas::setActive ( void ) const

Sets this canvas as both the active canvas and active window.

Parameters
None.

◆ setMainWindow()

void Canvas::setMainWindow ( void ) const

Sets this canvas as the Main Window, displaying it in the TFT.

Parameters
None.

◆ solidFill()

void Canvas::solidFill ( uint16_t x0,
uint16_t y0,
uint16_t width,
uint16_t height,
uint16_t color ) const

Draws a filled square onto the canvas.

Parameters
[in]x0Upper left x-coordinate
[in]y0Upper left y-coodrinate
[in]widthwidth of square
[in]heightheight of square
[in]color16 bit color of the square

◆ text()

void Canvas::text ( uint16_t x0,
uint16_t y0,
uint16_t fColor,
uint16_t bColor,
const char * text,
bool small = false ) const

Draws text onto the canvas.

Parameters
[in]x0Upper left x-coordinate
[in]y0Upper left y-coodrinate
[in]fColor16 bit foreground color of the text
[in]bColor16 bit background color of the text
[in]textText to be displayed
[in]small(Optional) If true, a smaller font is used

◆ width()

uint16_t Canvas::width ( void ) const
inline

Accessor method providing the canvas width.

Parameters
None.
Returns
Width of the canvas.

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