gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
display.hpp File Reference

Go to the source code of this file.

Functions

void ui::begin (bool require_touch=false)
 Initialize the screen.
 
void ui::setRotation (rotation_t rotation)
 Set the screen rotation.
 
rotation_t ui::getRotation ()
 Get the current screen rotation.
 
bool ui::rotationChanged ()
 Check if the screen rotation has changed since the last render cycle.
 
void ui::finalizeRotation ()
 After a render cycle has completed, set the screen rotation to not changed.
 
void ui::drawPixel (coord_t x, coord_t y, color_t color)
 Render a pixel to the screen, accounting for rotation.
 
void ui::fillScreen (color_t color)
 Fill the screen with a color.
 
void ui::drawFastVLine (coord_t x, coord_t y, coord_t h, color_t color)
 Draw a hardware-accelerated vertical line.
 
void ui::drawFastHLine (coord_t x, coord_t y, coord_t w, color_t color)
 Draw a hardware-accelerated horizontal line.
 
void ui::endWrite ()
 Flush data to the screen.
 
void ui::setCursor (coord_t x, coord_t y)
 Set the current position for rendering text.
 
void ui::setTextSize (uint8_t size)
 Set the scaling factor for rendering text.
 
void ui::setTextColor (color_t color)
 Set the color of rendered text.
 
void ui::setTextWrap (bool wrap)
 Set whether text wraps.
 
void ui::print (const String &str)
 Write text to the screen.
 
uisize_t ui::width ()
 Get the screen width, adjusted for rotation.
 
uisize_t ui::height ()
 Get the screen height, adjusted for rotation.
 
Event ui::getTouchEvent ()
 Check for a touchscreen event.
 
void ui::fillRoundRect (coord_t x, coord_t y, coord_t width, coord_t height, radius_t radius, color_t color)
 Draw a filled rectangle with rounded corners.
 
void ui::drawRect (coord_t x, coord_t y, coord_t width, coord_t height, color_t color)
 Draw a rectangle.
 
void ui::drawBitmap (coord_t x, coord_t y, uint8_t *bitmap, coord_t w, coord_t h, color_t color)
 Draw a single-color bitmap.
 
void ui::drawRGBBitmap (coord_t x, coord_t y, color_t *bitmap, coord_t w, coord_t h)
 Draw an RGB bitmap without transparency.
 
void ui::drawRGBBitmap (coord_t x, coord_t y, color_t *bitmap, uint8_t *mask, coord_t w, coord_t h)
 Draw an RGB bitmap with a transparency mask.
 
void ui::drawLine (coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color)
 Draw an arbitrary single-pixel line.
 
void ui::drawCircle (coord_t x, coord_t y, radius_t radius, color_t color, bool fill)
 Draw a circle.
 
void ui::drawEllipse (coord_t x, coord_t y, radius_t radius1, radius_t radius2, color_t color, bool fill)
 Draw an ellipse.
 

Detailed Description

This file contains low-level functions for rendering directly to the screen.

Function Documentation

◆ begin()

void ui::begin ( bool  require_touch = false)

Initialize the screen.

Parameters
require_touchIf true and the touchscreen failed to initialize, spit out a fatal error and halt execution.

◆ drawBitmap()

void ui::drawBitmap ( coord_t  x,
coord_t  y,
uint8_t *  bitmap,
coord_t  w,
coord_t  h,
color_t  color 
)

Draw a single-color bitmap.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.
bitmapThe bitmap data to render.
wThe horizontal size of the bitmap.
hThe vertical size of the bitmap.
colorThe color to render non-zero pixels as.

◆ drawCircle()

void ui::drawCircle ( coord_t  x,
coord_t  y,
radius_t  radius,
color_t  color,
bool  fill 
)

Draw a circle.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.
radiusThe circle radius.
colorThe color of the circle.
fillWhether to fill the circle or just draw an outline.

◆ drawEllipse()

void ui::drawEllipse ( coord_t  x,
coord_t  y,
radius_t  radius1,
radius_t  radius2,
color_t  color,
bool  fill 
)

Draw an ellipse.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.
radius1The horizontal radius.
radius2The vertical radius.
colorThe color of the ellipse.
fillWhether to fill the ellipse or just draw an outline.

◆ drawFastHLine()

void ui::drawFastHLine ( coord_t  x,
coord_t  y,
coord_t  w,
color_t  color 
)

Draw a hardware-accelerated horizontal line.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.
wThe length of the line, in pixels.
colorThe color of the line.

◆ drawFastVLine()

void ui::drawFastVLine ( coord_t  x,
coord_t  y,
coord_t  h,
color_t  color 
)

Draw a hardware-accelerated vertical line.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.
hThe height of the line, in pixels.
colorThe color of the line.

◆ drawLine()

void ui::drawLine ( coord_t  x0,
coord_t  y0,
coord_t  x1,
coord_t  y1,
color_t  color 
)

Draw an arbitrary single-pixel line.

Parameters
x0The starting horizontal coordinate.
y0The starting vertical coordinate.
x1The ending horizontal coordinate.
y1The ending vertical coordinate.
colorThe color of the line.

◆ drawPixel()

void ui::drawPixel ( coord_t  x,
coord_t  y,
color_t  color 
)

Render a pixel to the screen, accounting for rotation.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.
colorThe color of the pixel.

◆ drawRect()

void ui::drawRect ( coord_t  x,
coord_t  y,
coord_t  width,
coord_t  height,
color_t  color 
)

Draw a rectangle.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.
widthThe horizontal size of the rectangle.
heightThe vertical size of the rectangle.
colorThe color of the rectangle.

◆ drawRGBBitmap() [1/2]

void ui::drawRGBBitmap ( coord_t  x,
coord_t  y,
color_t bitmap,
coord_t  w,
coord_t  h 
)

Draw an RGB bitmap without transparency.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.
bitmapThe bitmap data to render.
wThe horizontal size of the bitmap.
hThe vertical size of the bitmap.

◆ drawRGBBitmap() [2/2]

void ui::drawRGBBitmap ( coord_t  x,
coord_t  y,
color_t bitmap,
uint8_t *  mask,
coord_t  w,
coord_t  h 
)

Draw an RGB bitmap with a transparency mask.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.
bitmapThe bitmap data to render.
maskThe 1-bit transparency mask.
wThe horizontal size of the bitmap.
hThe vertical size of the bitmap.

◆ fillRoundRect()

void ui::fillRoundRect ( coord_t  x,
coord_t  y,
coord_t  width,
coord_t  height,
radius_t  radius,
color_t  color 
)

Draw a filled rectangle with rounded corners.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.
widthThe horizontal size of the rectangle.
heightThe vertical size of the rectangle.
radiusThe radius of the curved corners.
colorThe color of the rectangle.

◆ fillScreen()

void ui::fillScreen ( color_t  color)

Fill the screen with a color.

Parameters
colorThe color to fill.

◆ getRotation()

rotation_t ui::getRotation ( )

Get the current screen rotation.

Returns
A value indicating the screen rotation.

◆ getTouchEvent()

Event ui::getTouchEvent ( )

Check for a touchscreen event.

Returns
The current touchscreen event, including whether one was triggered.

◆ height()

uisize_t ui::height ( )

Get the screen height, adjusted for rotation.

Returns
The screen height.

◆ print()

void ui::print ( const String &  str)

Write text to the screen.

Parameters
strThe string to write.

◆ rotationChanged()

bool ui::rotationChanged ( )

Check if the screen rotation has changed since the last render cycle.

Returns
True if the rotation has changed, false otherwise.

◆ setCursor()

void ui::setCursor ( coord_t  x,
coord_t  y 
)

Set the current position for rendering text.

Parameters
xThe horizontal coordinate.
yThe vertical coordinate.

◆ setRotation()

void ui::setRotation ( rotation_t  rotation)

Set the screen rotation.

Parameters
rotationThe new screen rotation; one of 4 cardinal directions.

◆ setTextColor()

void ui::setTextColor ( color_t  color)

Set the color of rendered text.

Parameters
colorThe text color.

◆ setTextSize()

void ui::setTextSize ( uint8_t  size)

Set the scaling factor for rendering text.

Parameters
sizeThe scaling factor.

◆ setTextWrap()

void ui::setTextWrap ( bool  wrap)

Set whether text wraps.

Parameters
wrapIf true, wrap text. If false, do not wrap.

◆ width()

uisize_t ui::width ( )

Get the screen width, adjusted for rotation.

Returns
The screen width.