Skip to content

Class daisy::ColorGraphicsDisplay

ClassList > daisy > ColorGraphicsDisplay

More...

  • #include <color_display.h>

Inherited by the following classes: daisy::ColorGraphicsDisplayImpl, daisy::ColorGraphicsDisplayImpl

Public Functions

Type Name
ColorGraphicsDisplay ()
size_t CurrentX ()
size_t CurrentY ()
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 void DrawLine (uint_fast8_t x1, uint_fast8_t y1, uint_fast8_t x2, uint_fast8_t y2, bool on) = 0
virtual void DrawPixel (uint_fast8_t x, uint_fast8_t y, 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 Fill (bool on) = 0
Rectangle GetBounds () const
virtual uint16_t Height () const = 0
virtual void SetColorBG (uint8_t red, uint8_t green, uint8_t blue) = 0
virtual void SetColorFG (uint8_t red, uint8_t green, uint8_t blue) = 0
void SetCursor (uint16_t x, uint16_t y)
virtual void Update () = 0
virtual uint16_t Width () const = 0
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
virtual ~ColorGraphicsDisplay ()

Protected Attributes

Type Name
uint16_t currentX_
uint16_t currentY_

Detailed Description

This interface is used as a base class for color graphics displays.

Public Functions Documentation

function ColorGraphicsDisplay

inline daisy::ColorGraphicsDisplay::ColorGraphicsDisplay () 

function CurrentX

inline size_t daisy::ColorGraphicsDisplay::CurrentX () 

function CurrentY

inline size_t daisy::ColorGraphicsDisplay::CurrentY () 

function DrawArc

virtual void daisy::ColorGraphicsDisplay::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

Draws an arc around the specified coordinate

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

function DrawCircle

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

Draws a circle around the specified coordinate

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

function DrawLine

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

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

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

function DrawPixel

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

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

Parameters:

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

function DrawRect [½]

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

Draws a rectangle based on two coordinates.

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

function DrawRect [2/2]

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

Draws a rectangle.

Parameters:

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

function Fill

virtual void daisy::ColorGraphicsDisplay::Fill (
    bool on
) = 0

Fills the entire display with either on/off.

Parameters:

  • on Sets on or off.

function GetBounds

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

function Height

virtual uint16_t daisy::ColorGraphicsDisplay::Height () const = 0

function SetColorBG

virtual void daisy::ColorGraphicsDisplay::SetColorBG (
    uint8_t red,
    uint8_t green,
    uint8_t blue
) = 0

Set background color

Parameters:

  • red Red color
  • green Green color
  • blue Blue color

function SetColorFG

virtual void daisy::ColorGraphicsDisplay::SetColorFG (
    uint8_t red,
    uint8_t green,
    uint8_t blue
) = 0

Set foreground color

Parameters:

  • red Red color
  • green Green color
  • blue Blue color

function SetCursor

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

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

Parameters:

  • x x pos
  • y y pos

function Update

virtual void daisy::ColorGraphicsDisplay::Update () = 0

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


function Width

virtual uint16_t daisy::ColorGraphicsDisplay::Width () const = 0

function WriteChar

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

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

Parameters:

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

Returns:

&


function WriteString

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

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:

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

Returns:

&


function WriteStringAligned

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

Similar to WriteString but justified within a bounding box.

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

Returns:

The rectangle that was drawn to


function ~ColorGraphicsDisplay

inline virtual daisy::ColorGraphicsDisplay::~ColorGraphicsDisplay () 

Protected Attributes Documentation

variable currentX_

uint16_t daisy::ColorGraphicsDisplay::currentX_;

variable currentY_

uint16_t daisy::ColorGraphicsDisplay::currentY_;


The documentation for this class was generated from the following file external-docs/libDaisy/src/hid/disp/color_display.h