libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::OneBitGraphicsDisplay Class Referenceabstract

Detailed Description

This interface is used as a base class for all types of 1bit-per-pixel graphics displays.

#include <display.h>

Inheritance diagram for daisy::OneBitGraphicsDisplay:
daisy::OneBitGraphicsDisplayImpl< OledDisplay< DisplayDriver > > daisy::OneBitGraphicsDisplayImpl< OledDisplay< daisy::SSD130xDriver > > daisy::OneBitGraphicsDisplayImpl< ChildType > daisy::OledDisplay< DisplayDriver > daisy::OledDisplay< daisy::SSD130xDriver >

Public Member Functions

 OneBitGraphicsDisplay ()
 
virtual ~OneBitGraphicsDisplay ()
 
virtual uint16_t Height () const =0
 
virtual uint16_t Width () const =0
 
Rectangle GetBounds () const
 
size_t CurrentX ()
 
size_t CurrentY ()
 
virtual void Fill (bool on)=0
 
virtual void DrawPixel (uint_fast8_t x, uint_fast8_t y, bool on)=0
 
virtual void DrawLine (uint_fast8_t x1, uint_fast8_t y1, uint_fast8_t x2, uint_fast8_t y2, bool on)=0
 
virtual void DrawRect (uint_fast8_t x1, uint_fast8_t y1, uint_fast8_t x2, uint_fast8_t y2, bool on, bool fill=false)=0
 
void DrawRect (const Rectangle &rect, bool on, bool fill=false)
 
virtual void DrawArc (uint_fast8_t x, uint_fast8_t y, uint_fast8_t radius, int_fast16_t start_angle, int_fast16_t sweep, bool on)=0
 
void DrawCircle (uint_fast8_t x, uint_fast8_t y, uint_fast8_t radius, bool on)
 
virtual char WriteChar (char ch, FontDef font, bool on)=0
 
virtual char WriteString (const char *str, FontDef font, bool on)=0
 
virtual Rectangle WriteStringAligned (const char *str, const FontDef &font, Rectangle boundingBox, Alignment alignment, bool on)=0
 
void SetCursor (uint16_t x, uint16_t y)
 
virtual void Update ()=0
 

Protected Attributes

uint16_t currentX_
 
uint16_t currentY_
 

Constructor & Destructor Documentation

◆ OneBitGraphicsDisplay()

daisy::OneBitGraphicsDisplay::OneBitGraphicsDisplay ( )
inline

◆ ~OneBitGraphicsDisplay()

virtual daisy::OneBitGraphicsDisplay::~OneBitGraphicsDisplay ( )
inlinevirtual

Member Function Documentation

◆ CurrentX()

size_t daisy::OneBitGraphicsDisplay::CurrentX ( )
inline

◆ CurrentY()

size_t daisy::OneBitGraphicsDisplay::CurrentY ( )
inline

◆ DrawArc()

virtual void daisy::OneBitGraphicsDisplay::DrawArc ( uint_fast8_t  x,
uint_fast8_t  y,
uint_fast8_t  radius,
int_fast16_t  start_angle,
int_fast16_t  sweep,
bool  on 
)
pure virtual

Draws an arc around the specified coordinate

Parameters
xx Coordinate of the center of the arc
yy Coordinate of the center of the arc
radiusradius of the arc
start_angleangle where to start the arc
sweeptotal angle of the arc
onon or off

Implemented in daisy::OneBitGraphicsDisplayImpl< ChildType >, daisy::OneBitGraphicsDisplayImpl< OledDisplay< daisy::SSD130xDriver > >, and daisy::OneBitGraphicsDisplayImpl< OledDisplay< DisplayDriver > >.

◆ DrawCircle()

void daisy::OneBitGraphicsDisplay::DrawCircle ( uint_fast8_t  x,
uint_fast8_t  y,
uint_fast8_t  radius,
bool  on 
)
inline

Draws a circle around the specified coordinate

Parameters
xx Coordinate of the center of the circle
yy Coordinate of the center of the circle
radiusradius of the circle
onon or off

◆ DrawLine()

virtual void daisy::OneBitGraphicsDisplay::DrawLine ( uint_fast8_t  x1,
uint_fast8_t  y1,
uint_fast8_t  x2,
uint_fast8_t  y2,
bool  on 
)
pure virtual

Draws a line from (x1, y1) to (y1, y2)

Parameters
x1x Coordinate of the starting point
y1y Coordinate of the starting point
x2x Coordinate of the ending point
y2y Coordinate of the ending point
onon or off

Implemented in daisy::OneBitGraphicsDisplayImpl< ChildType >, daisy::OneBitGraphicsDisplayImpl< OledDisplay< daisy::SSD130xDriver > >, and daisy::OneBitGraphicsDisplayImpl< OledDisplay< DisplayDriver > >.

◆ DrawPixel()

virtual void daisy::OneBitGraphicsDisplay::DrawPixel ( uint_fast8_t  x,
uint_fast8_t  y,
bool  on 
)
pure virtual

Sets the pixel at the specified coordinate to be on/off.

Parameters
xx Coordinate
yy coordinate
onon or off

Implemented in daisy::OledDisplay< DisplayDriver >, and daisy::OledDisplay< daisy::SSD130xDriver >.

◆ DrawRect() [1/2]

void daisy::OneBitGraphicsDisplay::DrawRect ( const Rectangle rect,
bool  on,
bool  fill = false 
)
inline

Draws a rectangle.

Parameters
rectthe rectangle
onon or off
fillfill the rectangle or draw only the outline

◆ DrawRect() [2/2]

virtual void daisy::OneBitGraphicsDisplay::DrawRect ( uint_fast8_t  x1,
uint_fast8_t  y1,
uint_fast8_t  x2,
uint_fast8_t  y2,
bool  on,
bool  fill = false 
)
pure virtual

Draws a rectangle based on two coordinates.

Parameters
x1x Coordinate of the first point
y1y Coordinate of the first point
x2x Coordinate of the second point
y2y Coordinate of the second point
onon or off
fillfill the rectangle or draw only the outline

Implemented in daisy::OneBitGraphicsDisplayImpl< ChildType >, daisy::OneBitGraphicsDisplayImpl< OledDisplay< daisy::SSD130xDriver > >, and daisy::OneBitGraphicsDisplayImpl< OledDisplay< DisplayDriver > >.

◆ Fill()

virtual void daisy::OneBitGraphicsDisplay::Fill ( bool  on)
pure virtual

Fills the entire display with either on/off.

Parameters
onSets on or off.

Implemented in daisy::OledDisplay< DisplayDriver >, and daisy::OledDisplay< daisy::SSD130xDriver >.

◆ GetBounds()

Rectangle daisy::OneBitGraphicsDisplay::GetBounds ( ) const
inline

◆ Height()

virtual uint16_t daisy::OneBitGraphicsDisplay::Height ( ) const
pure virtual

◆ SetCursor()

void daisy::OneBitGraphicsDisplay::SetCursor ( uint16_t  x,
uint16_t  y 
)
inline

Moves the 'Cursor' position used for WriteChar, and WriteStr to the specified coordinate.

Parameters
xx pos
yy pos

◆ Update()

virtual void daisy::OneBitGraphicsDisplay::Update ( )
pure virtual

Writes the current display buffer to the OLED device using SPI or I2C depending on how the object was initialized.

Implemented in daisy::OledDisplay< DisplayDriver >, and daisy::OledDisplay< daisy::SSD130xDriver >.

◆ Width()

virtual uint16_t daisy::OneBitGraphicsDisplay::Width ( ) const
pure virtual

◆ WriteChar()

virtual char daisy::OneBitGraphicsDisplay::WriteChar ( char  ch,
FontDef  font,
bool  on 
)
pure virtual

Writes the character with the specific FontDef to the display buffer at the current Cursor position.

Parameters
chcharacter to be written
fontfont to be written in
onon or off
Returns
&

Implemented in daisy::OneBitGraphicsDisplayImpl< ChildType >, daisy::OneBitGraphicsDisplayImpl< OledDisplay< daisy::SSD130xDriver > >, and daisy::OneBitGraphicsDisplayImpl< OledDisplay< DisplayDriver > >.

◆ WriteString()

virtual char daisy::OneBitGraphicsDisplay::WriteString ( const char str,
FontDef  font,
bool  on 
)
pure virtual

Similar to WriteChar, except it will handle an entire String. Wrapping does not happen automatically, so the width of the string must be kept within the dimensions of the screen.

Parameters
strstring to be written
fontfont to use
onon or off
Returns
&

Implemented in daisy::OneBitGraphicsDisplayImpl< ChildType >, daisy::OneBitGraphicsDisplayImpl< OledDisplay< daisy::SSD130xDriver > >, and daisy::OneBitGraphicsDisplayImpl< OledDisplay< DisplayDriver > >.

◆ WriteStringAligned()

virtual Rectangle daisy::OneBitGraphicsDisplay::WriteStringAligned ( const char str,
const FontDef font,
Rectangle  boundingBox,
Alignment  alignment,
bool  on 
)
pure virtual

Similar to WriteString but justified within a bounding box.

Parameters
strstring to be written
fontfont to use
boundingBoxthe bounding box to draw the text in
alignmentthe alignment to use
onon or off
Returns
The rectangle that was drawn to

Implemented in daisy::OneBitGraphicsDisplayImpl< ChildType >, daisy::OneBitGraphicsDisplayImpl< OledDisplay< daisy::SSD130xDriver > >, and daisy::OneBitGraphicsDisplayImpl< OledDisplay< DisplayDriver > >.

Member Data Documentation

◆ currentX_

uint16_t daisy::OneBitGraphicsDisplay::currentX_
protected

◆ currentY_

uint16_t daisy::OneBitGraphicsDisplay::currentY_
protected

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