Skip to content

daisy::OneBitGraphicsDisplay

More...

#include <display.h>

Inherited by daisy::OneBitGraphicsDisplayImpl< OledDisplay< DisplayDriver > >, daisy::OneBitGraphicsDisplayImpl< OledDisplay< daisy::SSD130xDriver > >, daisy::OneBitGraphicsDisplayImpl< ChildType >

Public Functions

Name
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

Name
uint16_t currentX_
uint16_t currentY_

Detailed Description

class daisy::OneBitGraphicsDisplay;

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

Public Functions Documentation

function OneBitGraphicsDisplay

inline OneBitGraphicsDisplay()

function ~OneBitGraphicsDisplay

inline virtual ~OneBitGraphicsDisplay()

function Height

virtual uint16_t Height() const =0

Reimplemented by: daisy::OledDisplay::Height, daisy::OledDisplay::Height


function Width

virtual uint16_t Width() const =0

Reimplemented by: daisy::OledDisplay::Width, daisy::OledDisplay::Width


function GetBounds

inline Rectangle GetBounds() const

function CurrentX

inline size_t CurrentX()

function CurrentY

inline size_t CurrentY()

function Fill

virtual void Fill(
    bool on
) =0

Parameters:

  • on Sets on or off.

Reimplemented by: daisy::OledDisplay::Fill, daisy::OledDisplay::Fill

Fills the entire display with either on/off.


function DrawPixel

virtual void DrawPixel(
    uint_fast8_t x,
    uint_fast8_t y,
    bool on
) =0

Parameters:

  • x x Coordinate
  • y y coordinate
  • on on or off

Reimplemented by: daisy::OledDisplay::DrawPixel, daisy::OledDisplay::DrawPixel

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


function DrawLine

virtual void DrawLine(
    uint_fast8_t x1,
    uint_fast8_t y1,
    uint_fast8_t x2,
    uint_fast8_t y2,
    bool on
) =0

Parameters:

  • x1 x Coordinate of the starting point
  • y1 y Coordinate of the starting point
  • x2 x Coordinate of the ending point
  • y2 y Coordinate of the ending point
  • on on or off

Reimplemented by: daisy::OneBitGraphicsDisplayImpl::DrawLine, daisy::OneBitGraphicsDisplayImpl::DrawLine, daisy::OneBitGraphicsDisplayImpl::DrawLine

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


function DrawRect

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

Parameters:

  • x1 x Coordinate of the first point
  • y1 y Coordinate of the first point
  • x2 x Coordinate of the second point
  • y2 y Coordinate of the second point
  • on on or off
  • fill fill the rectangle or draw only the outline

Reimplemented by: daisy::OneBitGraphicsDisplayImpl::DrawRect, daisy::OneBitGraphicsDisplayImpl::DrawRect, daisy::OneBitGraphicsDisplayImpl::DrawRect

Draws a rectangle based on two coordinates.


function DrawRect

inline void DrawRect(
    const Rectangle & rect,
    bool on,
    bool fill =false
)

Parameters:

  • rect the rectangle
  • on on or off
  • fill fill the rectangle or draw only the outline

Draws a rectangle.


function DrawArc

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

Parameters:

  • x x Coordinate of the center of the arc
  • y y Coordinate of the center of the arc
  • radius radius of the arc
  • start_angle angle where to start the arc
  • sweep total angle of the arc
  • on on or off

Reimplemented by: daisy::OneBitGraphicsDisplayImpl::DrawArc, daisy::OneBitGraphicsDisplayImpl::DrawArc, daisy::OneBitGraphicsDisplayImpl::DrawArc

Draws an arc around the specified coordinate


function DrawCircle

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

Parameters:

  • x x Coordinate of the center of the circle
  • y y Coordinate of the center of the circle
  • radius radius of the circle
  • on on or off

Draws a circle around the specified coordinate


function WriteChar

virtual char WriteChar(
    char ch,
    FontDef font,
    bool on
) =0

Parameters:

  • ch character to be written
  • font font to be written in
  • on on or off

Return: &

Reimplemented by: daisy::OneBitGraphicsDisplayImpl::WriteChar, daisy::OneBitGraphicsDisplayImpl::WriteChar, daisy::OneBitGraphicsDisplayImpl::WriteChar

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


function WriteString

virtual char WriteString(
    const char * str,
    FontDef font,
    bool on
) =0

Parameters:

  • str string to be written
  • font font to use
  • on on or off

Return: &

Reimplemented by: daisy::OneBitGraphicsDisplayImpl::WriteString, daisy::OneBitGraphicsDisplayImpl::WriteString, daisy::OneBitGraphicsDisplayImpl::WriteString

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.


function WriteStringAligned

virtual Rectangle WriteStringAligned(
    const char * str,
    const FontDef & font,
    Rectangle boundingBox,
    Alignment alignment,
    bool on
) =0

Parameters:

  • str string to be written
  • font font to use
  • boundingBox the bounding box to draw the text in
  • alignment the alignment to use
  • on on or off

Return: The rectangle that was drawn to

Reimplemented by: daisy::OneBitGraphicsDisplayImpl::WriteStringAligned, daisy::OneBitGraphicsDisplayImpl::WriteStringAligned, daisy::OneBitGraphicsDisplayImpl::WriteStringAligned

Similar to WriteString but justified within a bounding box.


function SetCursor

inline void SetCursor(
    uint16_t x,
    uint16_t y
)

Parameters:

  • x x pos
  • y y pos

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


function Update

virtual void Update() =0

Reimplemented by: daisy::OledDisplay::Update, daisy::OledDisplay::Update

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


Protected Attributes Documentation

variable currentX_

uint16_t currentX_;

variable currentY_

uint16_t currentY_;

Updated on 2024-01-03 at 19:41:00 +0000