Graphics Namespace Reference

Namespaces

 Display
 
 Drawing
 
 Mipi
 
 Resource
 

Classes

class  VirtualTouch
 
class  AbstractDisplay
 
struct  AddressWindow
 Manages a rectangular area of display memory with position information. More...
 
class  Asset
 An asset is used to render an Object, but is not itself drawable. More...
 
class  AssetTemplate
 
class  SolidBrush
 
class  TextureBrush
 
class  GradientBrush
 
class  ImageBrush
 Brush using pixels from image. More...
 
class  Brush
 The source of colour for drawing. More...
 
class  Pen
 
class  PenAsset
 
class  TextOptions
 
class  TypeFace
 Base class for a loaded typeface, e.g. Sans 16pt bold. More...
 
class  Font
 Base class for a loaded font. More...
 
class  ResourceTypeface
 
class  ResourceFont
 
class  TextAsset
 
class  ObjectAsset
 
class  AssetList
 
class  Blend
 Blend operations. More...
 
class  BlendTemplate
 
class  BlendWrite
 
class  BlendXor
 
class  BlendXNor
 
class  BlendMask
 
class  BlendTransparent
 
class  BlendAlpha
 
class  SharedBuffer
 Shared heap-allocated data buffer. More...
 
struct  ReadBuffer
 Buffer used for reading pixel data from device. More...
 
struct  ReadStatus
 Stores result of read operation. More...
 
struct  ReadStatusBuffer
 Composite ReadBuffer with status. More...
 
union  PixelFormatStruct
 
struct  PackedColor
 Colour in device pixel format. More...
 
union  PixelBuffer
 Structure used to perform pixel format conversions. More...
 
class  Console
 
class  Button
 Basic interactive button on screen. More...
 
class  Control
 Basic interactive button on screen. More...
 
class  Label
 Non-interactive text label. More...
 
class  Screen
 
class  TimeClock
 
class  Device
 A physical display device. More...
 
struct  FillInfo
 Supports DisplayList blend operations. More...
 
class  DisplayList
 Stores list of low-level display commands. More...
 
class  ImageSurface
 Virtual class to access an image as a Surface. More...
 
class  MemoryImageSurface
 Image surface using RAM as backing store. More...
 
class  FileImageSurface
 Image surface using filing system as backing store. More...
 
class  LcdGlyph
 
class  LcdTypeFace
 
class  LcdFont
 
class  Meta
 Empty base class to support object enumeration Non-virtual to avoid bloat. More...
 
class  MetaWriter
 Writes object content in readable format for debugging. More...
 
class  MipiDisplay
 
class  MipiSurface
 
class  Renderer
 Virtual base class to manage rendering of various types of information to a surface. More...
 
class  Object
 A drawable object inherits from this virtual base class. More...
 
class  ObjectTemplate
 
class  ReferenceObject
 Reference to another object. More...
 
class  PointObject
 A single pixel == 1x1 rectangle. More...
 
class  RectObject
 A rectangular outline. More...
 
class  FilledRectObject
 A filled rectangle. More...
 
class  LineObject
 A drawn line. More...
 
class  PolylineObject
 A sequence of lines. More...
 
class  CircleObject
 A circle outline. More...
 
class  FilledCircleObject
 A filled circle. More...
 
class  EllipseObject
 An ellipse outline. More...
 
class  FilledEllipseObject
 A filled ellipse. More...
 
class  ArcObject
 An arc outline. More...
 
class  FilledArcObject
 A filled arc. More...
 
class  ImageObject
 Virtual base class for an image. More...
 
class  StreamImageObject
 Image whose contents are stored in a stream, typically in a file or flash memory. More...
 
class  BitmapObject
 A BMP format image. More...
 
class  RawImageObject
 Image stored as raw pixels in a specific format. More...
 
class  RenderTarget
 Interface for objects which support writing via surfaces. More...
 
class  MemoryImageObject
 
class  FileImageObject
 
class  GlyphObject
 A character glyph image. More...
 
class  TextObject
 A block of text consisting of zero or more segments. More...
 
class  SurfaceObject
 Describes a target surface and corresponding source location. More...
 
class  CopyObject
 Describes a copy operation within the same surface. More...
 
class  ScrollObject
 Describes a scrolling operation. More...
 
class  DrawingObject
 A collection of line and curve drawing operations. More...
 
class  ItemList
 Fixed list of types. More...
 
class  PointList
 Small list of points for drawing. More...
 
class  RectList
 Small list of rectangles, similar to PointList. More...
 
class  MultiRenderer
 Base class to render multiple objects. More...
 
class  SceneRenderer
 A scene is a list of other objects, so we just iterate through the list and draw each in turn. More...
 
class  GfxLineRenderer
 Draws 1-pixel lines. More...
 
class  LineRenderer
 Draws lines. More...
 
class  PolylineRenderer
 Draws series of lines defined by a PolylineObject More...
 
class  RectRenderer
 Draws a rectangle as a polyline. More...
 
class  FilledRectRenderer
 Draws a filled rectangle. More...
 
class  RoundedRectRenderer
 Draws a rectangle outline with rounded corners. More...
 
class  FilledRoundedRectRenderer
 Draws a filled rectangle with rounded corners. More...
 
class  CircleRenderer
 Draws a circle outline. More...
 
class  FilledCircleRenderer
 Draws a filled circle. More...
 
struct  Ellipse
 State information for tracing an ellipse outline. More...
 
class  ArcRectList
 
class  EllipseRenderer
 Draws an ellipse outline. More...
 
class  FilledEllipseRenderer
 Draws a filled ellipse. More...
 
class  ArcRenderer
 Render arc outline with adjustable line width. More...
 
class  FilledArcRenderer
 Render arc outline with adjustable line width. More...
 
class  ImageRenderer
 Render an image object. More...
 
class  SurfaceRenderer
 Copy an area to another surface. More...
 
class  CopyRenderer
 Copy an area within the same surface. More...
 
class  ImageCopyRenderer
 
class  ScrollRenderer
 Scroll an area. More...
 
class  BlendRenderer
 Perform blending with draw. More...
 
class  TextRenderer
 Draw a line of text. More...
 
class  RenderQueue
 Top-level manager to queue objects for rendering to a specific target. More...
 
class  SceneObject
 A Scene containing multiple objects. More...
 
class  SpiDisplay
 
class  SpiDisplayList
 Display list for hardware SPI devices. More...
 
class  WriteStream
 
class  ReadStream
 
class  SubStream
 
class  Surface
 Interface for a drawing surface. More...
 
class  TextParser
 Simplifies construction of TextObject instances. More...
 
class  TextBuilder
 Simplifies construction of TextObject instances. More...
 
class  XPT2046
 
class  Touch
 
struct  Size
 Size of rectangular area (width x height) More...
 
struct  TPoint
 An (x, y) display coordinate. More...
 
struct  Rect
 Location and size of rectangular area (x, y, w, h) More...
 
class  Region
 Represents the intersection of two rectangles. More...
 
struct  Location
 Identifies position within bounding rectangle. More...
 
class  ColorRange
 
class  Scale
 
struct  GlyphMetrics
 Glyph metrics. More...
 

Typedefs

using AssetType = Asset::Type
 
using GlyphOptions = TextOptions
 
using BlendMode = Blend::Mode
 
using DrawingTarget = Drawing::Target
 
using CustomObject = ObjectTemplate< Object::Kind::Custom >
 Base class for a custom object. More...
 
using AssetID = uint16_t
 Numeric identifiers for re-useable objects. More...
 
using Point = TPoint< int16_t >
 
using IntPoint = TPoint< int >
 
using PointF = TPoint< float >
 
using Range = TRange< uint16_t >
 
using FontStyles = BitSet< uint16_t, FontStyle, 10 >
 

Enumerations

enum class  BrushStyle { FullScreen , SourceLocal }
 
enum class  Color : uint32_t { None = 0 , XX , XX }
 Standard colour definitions. More...
 
enum  ColorOrder { orderRGB , orderBGR }
 Order refers to colour order within bitstream. More...
 
enum class  PixelFormat : uint8_t { None , XX }
 
enum class  InputEvent { move , down , up }
 
enum class  ControlEvent { activate , deactivate }
 
enum class  Orientation {
  normal , deg0 = normal , deg90 , deg180 ,
  deg270
}
 Defines orientation of display. More...
 
enum class  Align {
  Near , Centre , Far , Left = Near ,
  Top = Near , Center = Centre , Right = Far , Bottom = Far
}
 
enum class  Origin {
  E , NE , N , NW ,
  W , SW , S , SE ,
  Centre , TopLeft = NW , Top = N , TopRight = NE ,
  Left = W , Center = Centre , Right = E , BottomLeft = SW ,
  Bottom = S , BottomRight = SE
}
 Points on a compass. More...
 
enum class  FontStyle { XX }
 

Functions

constexpr uint32_t getColorValue (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Obtain 24-bit colour value from red, green and blue components. More...
 
constexpr Color makeColor (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Function to create a custom colour. More...
 
constexpr Color makeColor (uint32_t color, uint8_t alpha=255)
 
constexpr Color makeColor (Color color, uint8_t alpha)
 
constexpr uint8_t getAlpha (Color color)
 
constexpr uint8_t getRed (Color color)
 
constexpr uint8_t getGreen (Color color)
 
constexpr uint8_t getBlue (Color color)
 
bool fromString (const char *s, Color &color)
 
bool fromString (const String &s, Color &color)
 
uint8_t getBytesPerPixel (PixelFormat format)
 Get number of bytes required to store a pixel in the given format. More...
 
PixelBuffer pack (PixelBuffer src, PixelFormat format)
 Convert RGB colour into packed format. More...
 
PackedColor pack (Color color, PixelFormat format)
 
PixelBuffer unpack (PixelBuffer src, PixelFormat format)
 Convert packed colour into RGB. More...
 
Color unpack (PackedColor packed, PixelFormat format)
 
Color unpack (uint32_t packed, PixelFormat format)
 
size_t writeColor (void *buffer, PackedColor color, PixelFormat format)
 Store a packed colour value into memory. More...
 
size_t writeColor (void *buffer, Color color, PixelFormat format)
 
size_t writeColor (void *buffer, PackedColor color, PixelFormat format, size_t count)
 Store a block of packed colours into memory. More...
 
size_t writeColor (void *buffer, Color color, PixelFormat format, size_t count)
 
size_t convert (const void *srcData, PixelFormat srcFormat, void *dstBuffer, PixelFormat dstFormat, size_t numPixels)
 Convert block of data from one pixel format to another. More...
 
void highlightText (SceneObject &scene)
 Highlight text segments and print details. More...
 
void highlightText (TextObject &object)
 
uint16_t swapBytes (uint16_t w)
 
uint32_t makeWord (uint16_t w1, uint16_t w2)
 
Origin opposite (Origin o)
 Get the origin for the opposite side of the rectangle. More...
 
constexpr Size rotate (Size size, Orientation orientation)
 
template<typename T , typename Q >
constexpr TPoint< T > operator+ (TPoint< T > pt, const Q &other)
 
template<typename T , typename Q >
constexpr TPoint< T > operator- (TPoint< T > pt, const Q &other)
 
template<typename T , typename Q >
constexpr TPoint< T > operator* (TPoint< T > pt, const Q &other)
 
template<typename T >
constexpr TPoint< T > operator* (TPoint< T > pt, const Size &other)
 
template<typename T , typename Q >
constexpr TPoint< T > operator/ (TPoint< T > pt, const Q &other)
 
template<typename T >
constexpr TPoint< T > operator/ (TPoint< T > pt, const Size &other)
 
template<typename T , typename Q >
constexpr TPoint< T > operator% (TPoint< T > pt, const Q &other)
 
template<typename T >
Rect operator+ (const Rect &rect, const T &other)
 
Rect operator- (const Rect &rect, const Point &offset)
 
Rect intersect (Rect r1, const Rect &r2)
 
Region operator- (const Region &rgn, const Rect &r)
 
uint16_t originToDegrees (Origin origin)
 Get corresponding angle for given origin. More...
 
Origin degreesToOrigin (uint16_t angle)
 Get origin closest to given angle (expressed in degrees) More...
 
uint16_t normaliseAngle (int angle)
 Make 0 <= angle < 360. More...
 

Variables

LcdFont lcdFont
 
static constexpr uint8_t PIN_NONE {255}
 Undefined I/O pin value. More...
 

Typedef Documentation

◆ AssetID

using Graphics::AssetID = typedef uint16_t

Numeric identifiers for re-useable objects.

◆ AssetType

◆ BlendMode

◆ CustomObject

using Graphics::CustomObject = typedef ObjectTemplate<Object::Kind::Custom>

Base class for a custom object.

◆ DrawingTarget

◆ FontStyles

using Graphics::FontStyles = typedef BitSet<uint16_t, FontStyle, 10>

◆ GlyphOptions

◆ IntPoint

using Graphics::IntPoint = typedef TPoint<int>

◆ Point

using Graphics::Point = typedef TPoint<int16_t>

◆ PointF

using Graphics::PointF = typedef TPoint<float>

◆ Range

using Graphics::Range = typedef TRange<uint16_t>

Enumeration Type Documentation

◆ Align

enum Graphics::Align
strong
Enumerator
Near 
Centre 
Far 
Left 
Top 
Center 
Right 
Bottom 

◆ BrushStyle

enum Graphics::BrushStyle
strong
Enumerator
FullScreen 
SourceLocal 

◆ Color

enum Graphics::Color : uint32_t
strong

Standard colour definitions.

Enumerator
None 
XX 
XX 

◆ ColorOrder

Order refers to colour order within bitstream.

Enumerator
orderRGB 
orderBGR 

◆ ControlEvent

Enumerator
activate 
deactivate 

◆ FontStyle

enum Graphics::FontStyle
strong
Enumerator
XX 

◆ InputEvent

enum Graphics::InputEvent
strong
Enumerator
move 
down 
up 

◆ Orientation

enum Graphics::Orientation
strong

Defines orientation of display.

Enumerator
normal 
deg0 
deg90 
deg180 
deg270 

◆ Origin

enum Graphics::Origin
strong

Points on a compass.

These are ordered by angles in increments of 45 degrees.

Enumerator
NE 
NW 
SW 
SE 
Centre 
TopLeft 
Top 
TopRight 
Left 
Center 
Right 
BottomLeft 
Bottom 
BottomRight 

◆ PixelFormat

enum Graphics::PixelFormat : uint8_t
strong
Enumerator
None 
XX 

Function Documentation

◆ convert()

size_t Graphics::convert ( const void *  srcData,
PixelFormat  srcFormat,
void *  dstBuffer,
PixelFormat  dstFormat,
size_t  numPixels 
)

Convert block of data from one pixel format to another.

◆ degreesToOrigin()

Origin Graphics::degreesToOrigin ( uint16_t  angle)

Get origin closest to given angle (expressed in degrees)

◆ fromString() [1/2]

bool Graphics::fromString ( const char *  s,
Color color 
)

◆ fromString() [2/2]

bool Graphics::fromString ( const String s,
Color color 
)
inline

◆ getAlpha()

constexpr uint8_t Graphics::getAlpha ( Color  color)
inlineconstexpr

◆ getBlue()

constexpr uint8_t Graphics::getBlue ( Color  color)
inlineconstexpr

◆ getBytesPerPixel()

uint8_t Graphics::getBytesPerPixel ( PixelFormat  format)
inline

Get number of bytes required to store a pixel in the given format.

◆ getColorValue()

constexpr uint32_t Graphics::getColorValue ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
inlineconstexpr

Obtain 24-bit colour value from red, green and blue components.

◆ getGreen()

constexpr uint8_t Graphics::getGreen ( Color  color)
inlineconstexpr

◆ getRed()

constexpr uint8_t Graphics::getRed ( Color  color)
inlineconstexpr

◆ highlightText() [1/2]

void Graphics::highlightText ( SceneObject scene)

Highlight text segments and print details.

◆ highlightText() [2/2]

void Graphics::highlightText ( TextObject object)

◆ intersect()

Rect Graphics::intersect ( Rect  r1,
const Rect r2 
)
inline

◆ makeColor() [1/3]

constexpr Color Graphics::makeColor ( Color  color,
uint8_t  alpha 
)
inlineconstexpr

◆ makeColor() [2/3]

constexpr Color Graphics::makeColor ( uint32_t  color,
uint8_t  alpha = 255 
)
inlineconstexpr

◆ makeColor() [3/3]

constexpr Color Graphics::makeColor ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
inlineconstexpr

Function to create a custom colour.

◆ makeWord()

uint32_t Graphics::makeWord ( uint16_t  w1,
uint16_t  w2 
)

◆ normaliseAngle()

uint16_t Graphics::normaliseAngle ( int  angle)

Make 0 <= angle < 360.

◆ operator%()

template<typename T , typename Q >
constexpr TPoint<T> Graphics::operator% ( TPoint< T >  pt,
const Q &  other 
)
constexpr

◆ operator*() [1/2]

template<typename T , typename Q >
constexpr TPoint<T> Graphics::operator* ( TPoint< T >  pt,
const Q &  other 
)
constexpr

◆ operator*() [2/2]

template<typename T >
constexpr TPoint<T> Graphics::operator* ( TPoint< T >  pt,
const Size other 
)
constexpr

◆ operator+() [1/2]

template<typename T >
Rect Graphics::operator+ ( const Rect rect,
const T &  other 
)

◆ operator+() [2/2]

template<typename T , typename Q >
constexpr TPoint<T> Graphics::operator+ ( TPoint< T >  pt,
const Q &  other 
)
constexpr

◆ operator-() [1/3]

Rect Graphics::operator- ( const Rect rect,
const Point offset 
)
inline

◆ operator-() [2/3]

Region Graphics::operator- ( const Region rgn,
const Rect r 
)
inline

◆ operator-() [3/3]

template<typename T , typename Q >
constexpr TPoint<T> Graphics::operator- ( TPoint< T >  pt,
const Q &  other 
)
constexpr

◆ operator/() [1/2]

template<typename T , typename Q >
constexpr TPoint<T> Graphics::operator/ ( TPoint< T >  pt,
const Q &  other 
)
constexpr

◆ operator/() [2/2]

template<typename T >
constexpr TPoint<T> Graphics::operator/ ( TPoint< T >  pt,
const Size other 
)
constexpr

◆ opposite()

Origin Graphics::opposite ( Origin  o)
inline

Get the origin for the opposite side of the rectangle.

e.g. E -> W, NE -> SW

◆ originToDegrees()

uint16_t Graphics::originToDegrees ( Origin  origin)
inline

Get corresponding angle for given origin.

◆ pack() [1/2]

PackedColor Graphics::pack ( Color  color,
PixelFormat  format 
)
inline

◆ pack() [2/2]

PixelBuffer Graphics::pack ( PixelBuffer  src,
PixelFormat  format 
)

Convert RGB colour into packed format.

Parameters
colorThe RGB colour to convert
formatThe desired pixel format
Return values
PackedColor

◆ rotate()

constexpr Size Graphics::rotate ( Size  size,
Orientation  orientation 
)
inlineconstexpr

◆ swapBytes()

uint16_t Graphics::swapBytes ( uint16_t  w)

◆ unpack() [1/3]

Color Graphics::unpack ( PackedColor  packed,
PixelFormat  format 
)
inline

◆ unpack() [2/3]

PixelBuffer Graphics::unpack ( PixelBuffer  src,
PixelFormat  format 
)

Convert packed colour into RGB.

Parameters
srcPixelBuffer loaded with packed colour
formatThe exact format of the source colour
Return values
ColorThe corresponding RGB colour

◆ unpack() [3/3]

Color Graphics::unpack ( uint32_t  packed,
PixelFormat  format 
)
inline

◆ writeColor() [1/4]

size_t Graphics::writeColor ( void *  buffer,
Color  color,
PixelFormat  format 
)
inline

◆ writeColor() [2/4]

size_t Graphics::writeColor ( void *  buffer,
Color  color,
PixelFormat  format,
size_t  count 
)
inline

◆ writeColor() [3/4]

size_t Graphics::writeColor ( void *  buffer,
PackedColor  color,
PixelFormat  format 
)

Store a packed colour value into memory.

Parameters
bufferWhere to write the colour value
colorThe value to write
Return values
size_tThe number of bytes written

◆ writeColor() [4/4]

size_t Graphics::writeColor ( void *  buffer,
PackedColor  color,
PixelFormat  format,
size_t  count 
)

Store a block of packed colours into memory.

Parameters
bufferWhere to write the colour value
colorThe value to write
countThe number of times to repeat the colour
Return values
size_tThe number of bytes written

Variable Documentation

◆ lcdFont

LcdFont Graphics::lcdFont
extern

◆ PIN_NONE

constexpr uint8_t Graphics::PIN_NONE {255}
staticconstexpr

Undefined I/O pin value.