displaylib_1bit_PICO 2.0.0
1-bit colour graphic display library, Rpi PICO RP2040 library
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
displaylib_graphics Class Referenceabstract

Graphics class to hold graphic related functions. More...

#include <display_graphics.hpp>

Inheritance diagram for displaylib_graphics:
Inheritance graph
[legend]
Collaboration diagram for displaylib_graphics:
Collaboration graph
[legend]

Public Types

enum  PixelColor : uint8_t { BG_COLOR = 0 , FG_COLOR = 1 , INVERSE = 2 }
 Display Pixel colours definition. More...
 
enum  display_rotate_e : uint8_t { rDegrees_0 = 0 , rDegrees_90 = 1 , rDegrees_180 = 2 , rDegrees_270 = 3 }
 
- Public Types inherited from Print
enum  BaseNum : uint8_t { DEC = 10 , HEX = 16 , OCT = 8 , BIN = 2 }
 

Public Member Functions

 displaylib_graphics (int16_t w, int16_t h)
 init the OLED Graphics class object constructor
 
virtual void drawPixel (int16_t x, int16_t y, uint8_t color)=0
 
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint8_t color)
 draws a line from (x0,y0) to (x1,y1).
 
void drawFastVLine (int16_t x, int16_t y, int16_t h, uint8_t color)
 Draws a vertical line starting at (x,y) with height h.
 
void drawFastHLine (int16_t x, int16_t y, int16_t w, uint8_t color)
 Draws a horizontal line starting at (x,y) with width w.
 
void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t color)
 draws rectangle at (x,y) where h is height and w is width of the rectangle.
 
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t color)
 fills a rectangle starting from coordinates (x,y) with width of w and height of h.
 
void fillScreen (uint8_t color)
 Fills the whole screen with a given color.
 
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint8_t color)
 Draws a circle with center coordinates (centerX, centerY) and a given radius.
 
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint8_t color)
 fills a circle where (x0,y0) are center coordinates an r is circle radius.
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
 draws a triangle of coordinates (x0,y0), (x1,y1) and (x2,y2).
 
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
 Fills a triangle defined by the coordinates (x0, y0), (x1, y1), and (x2, y2).
 
void drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint8_t color)
 draws a rectangle with rounded edges
 
void fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint8_t color)
 Fills a rectangle with rounded edges.
 
void setCursor (int16_t x, int16_t y)
 set the cursor position
 
virtual size_t write (uint8_t)
 write method used in the print class when user calls print
 
DisplayRet::Ret_Codes_e writeChar (int16_t x, int16_t y, char value)
 Write 1 character on OLED.
 
DisplayRet::Ret_Codes_e writeCharString (int16_t x, int16_t y, char *text)
 Write Text character array on OLED.
 
void setTextWrap (bool w)
 turn on or off screen _textwrap of the text (fonts 1-6)
 
void setDrawBitmapAddr (bool mode)
 sets the data addressing mode in drawBitmap function.
 
DisplayRet::Ret_Codes_e drawBitmap (int16_t x, int16_t y, std::span< const uint8_t > bitmap, int16_t w, int16_t h, uint8_t color, uint8_t bg)
 Draw a 1-bit color bitmap.
 
int16_t height (void) const
 Gets the height of the display (per current _rotation)
 
int16_t width (void) const
 Gets the width of the display (per current _rotation)
 
display_rotate_e getRotation (void)
 Gets the _rotation of the display.
 
void setRotation (display_rotate_e r)
 Sets the _rotation of the display.
 
void drawLineAngle (int16_t x, int16_t y, int angle, uint8_t start, uint8_t length, int offset, uint8_t color)
 Draws a line using an angle and length as parameters. This function draws a line starting from (x, y), extending in the direction specified by angle, with a given length. The function also allows applying an offset to the angle before computing the line’s end coordinates.
 
void drawQuadrilateral (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3, uint8_t color)
 Draws a quadrilateral (four-sided polygon) by connecting four points with lines. This function draws a quadrilateral by drawing four lines between the given vertices. The lines are drawn in the order: (x0, y0) to (x1, y1), (x1, y1) to (x2, y2), (x2, y2) to (x3, y3), and finally (x3, y3) back to (x0, y0).
 
void fillQuadrilateral (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3, uint8_t color)
 Fills a quadrilateral with the specified color using triangles. This function fills a quadrilateral by dividing it into triangles and filling them individually. The quadrilateral is filled by calling the fillTriangle function three times with appropriate vertex coordinates. The useTriangleSplit parameter determines whether the quadrilateral is divided into two triangles or if only one triangle is used.
 
DisplayRet::Ret_Codes_e drawPolygon (int16_t x, int16_t y, uint8_t sides, int16_t diameter, float rotation, bool fill, uint8_t color)
 Draws a polygon with a specified number of sides, diameter, rotation, and color. This function draws a regular polygon by connecting points equally spaced around a circle, with each point having a distance defined by the diameter. The polygon is rotated by the given angle (in degrees) before being drawn. The number of sides is enforced to be at least 3.
 
void drawArc (uint16_t cx, uint16_t cy, uint16_t radius, uint16_t thickness, float startAngle, float endAngle, uint8_t color)
 Draw an arc on the TFT display. This function draws an arc between two angles (start and end) on a circle with a given radius.
 
void drawSimpleArc (int16_t cx, int16_t cy, int16_t radius, float startAngle, float endAngle, uint8_t color)
 Draw a simple arc of one pixel on the display( no offsets , thickness or maximum arc calculations) This function draws an arc between two angles (start and end) on a circle with a given radius.
 
void drawEllipse (int16_t cx, int16_t cy, int16_t semiMajorAxis, int16_t semiMinorAxis, bool fill, uint8_t color)
 Draw an ellipse on the display. This function uses the midpoint ellipse algorithm to efficiently draw an ellipse centered at (cx, cy) with the given semi-major (horizontal) and semi-minor (vertical) axes.
 
DisplayRet::Ret_Codes_e drawDotGrid (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t DotGridGap, uint8_t color)
 Draws a grid of dots on the screen starting from the given coordinates. This function draws a grid of pixels with a specified gap between them. It checks that the provided coordinates and dimensions are within the screen bounds and adjusts them if necessary. It also validates The grid of dots gap value and defaults it to 2 if invalid.
 
float getArcAngleMax () const
 Get the current maximum angle of the arc.
 
void setArcAngleMax (float arcAngleMax)
 Set a new maximum angle for the arc.
 
int getArcAngleOffset () const
 Get the current angle offset.
 
void setArcAngleOffset (int arcAngleOffset)
 Set a new angle offset.
 
- Public Member Functions inherited from displaylib_fonts
 displaylib_fonts ()
 init the OLED font class object constructor
 
DisplayRet::Ret_Codes_e setFont (std::span< const uint8_t > font)
 SSD1306_SetFont.
 
void setInvertFont (bool invertStatus)
 setInvertFont
 
bool getInvertFont (void)
 getInvertFont
 
- Public Member Functions inherited from Print
int getWriteError ()
 gets the error flag status, zero no error
 
void clearWriteError ()
 clears the errof flag by setting it to zero
 
size_t write (const char *str)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
size_t write (const char *buffer, size_t size)
 
virtual int availableForWrite ()
 
size_t print (const char[])
 
size_t print (char)
 
size_t print (int, int=DEC)
 
size_t print (unsigned int, int=DEC)
 
size_t print (long, int=DEC)
 
size_t print (unsigned long, int=DEC)
 
size_t print (double, int=2)
 
size_t print (const std::string &)
 
size_t println (const char[])
 
size_t println (char)
 
size_t println (int, int=DEC)
 
size_t println (unsigned int, int=DEC)
 
size_t println (long, int=DEC)
 
size_t println (unsigned long, int=DEC)
 
size_t println (double, int=2)
 
size_t println (void)
 
size_t println (const std::string &s)
 

Protected Member Functions

float sineFromDegrees (float angle)
 Computes the sine of an angle given in degrees. This function converts the input angle from degrees to radians and then calculates the sine of that angle using the standard C++ sin function.
 
float cosineFromDegrees (float angle)
 Computes the cosine of an angle given in degrees. This function converts the input angle from degrees to radians and then calculates the cosine of that angle using the standard C++ cos function.
 
void ellipseHelper (uint16_t cx, uint16_t cy, uint16_t x, uint16_t y, uint8_t color)
 
void drawArcHelper (uint16_t cx, uint16_t cy, uint16_t radius, uint16_t thickness, float start, float end, uint8_t color)
 
void drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint8_t color)
 
void fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint8_t color)
 
- Protected Member Functions inherited from Print
void setWriteError (int err=1)
 

Protected Attributes

const int16_t WIDTH
 
const int16_t HEIGHT
 
display_rotate_e _display_rotate = rDegrees_0
 
int16_t _width
 
int16_t _height
 
int16_t _cursor_x = 0
 
int16_t _cursor_y = 0
 
bool _drawBitmapAddr
 
bool _textwrap = true
 
float _arcAngleMax = 360.0f
 
int _arcAngleOffset = 0
 
- Protected Attributes inherited from displaylib_fonts
std::span< const uint8_t > _FontSelect = pFontDefault
 
uint8_t _Font_X_Size = 0x06
 
uint8_t _Font_Y_Size = 0x08
 
uint8_t _FontOffset = 0x00
 
uint8_t _FontNumChars = 0xFE
 

Private Member Functions

void swapInt16display (int16_t &a, int16_t &b)
 Swaps the values of two int16_t variables.
 

Detailed Description

Graphics class to hold graphic related functions.

Member Enumeration Documentation

◆ display_rotate_e

Enum to hold current screen rotation in degrees bi color display

Enumerator
rDegrees_0 

display screen rotated 0 degrees

rDegrees_90 

display screen rotated 90 degrees

rDegrees_180 

display screen rotated 180 degrees

rDegrees_270 

display screen rotated 270 degrees

◆ PixelColor

Display Pixel colours definition.

Enumerator
BG_COLOR 

Background color

FG_COLOR 

foreground color

INVERSE 

inverted color

Constructor & Destructor Documentation

◆ displaylib_graphics()

displaylib_graphics::displaylib_graphics ( int16_t  w,
int16_t  h 
)

init the OLED Graphics class object constructor

Parameters
wwidth defined in sub-class
hheight defined in sub-class

Member Function Documentation

◆ cosineFromDegrees()

float displaylib_graphics::cosineFromDegrees ( float  angle)
protected

Computes the cosine of an angle given in degrees. This function converts the input angle from degrees to radians and then calculates the cosine of that angle using the standard C++ cos function.

Parameters
angleThe angle in degrees.
Returns
The cosine value of the given angle.

◆ drawArc()

void displaylib_graphics::drawArc ( uint16_t  cx,
uint16_t  cy,
uint16_t  radius,
uint16_t  thickness,
float  startAngle,
float  endAngle,
uint8_t  color 
)

Draw an arc on the TFT display. This function draws an arc between two angles (start and end) on a circle with a given radius.

Parameters
cxX-coordinate of the center of the circle.
cyY-coordinate of the center of the circle.
radiusThe radius of the circle.
thicknessthe thickness of the arc
startAngleThe starting angle of the arc (in degrees).
endAngleThe ending angle of the arc (in degrees).
colorThe color of the arc.
Note
variables _arcAngleMax and _arcAngleOffset which can be set by user with setters define behaviour of arc. _arcAngleOffset is zero default means 0 is positive X axis , Arc is drawn counterclockwise XXX 270 XXX 180 XXX 000 XXX 090 XXX

◆ drawBitmap()

DisplayRet::Ret_Codes_e displaylib_graphics::drawBitmap ( int16_t  x,
int16_t  y,
std::span< const uint8_t >  bitmap,
int16_t  w,
int16_t  h,
uint8_t  color,
uint8_t  bg 
)

Draw a 1-bit color bitmap.

Parameters
xx co-ord position
yy co-ord posiiton a
bitmapspan to bitmap data
wwidth of the bitmap
hheight of the bitmap
colorforeground colour
bgbackground colour.
Returns
Will return 0x00 for success, non-zero for failure Failure could be out of bounds , wrong size , invalid empty span object.
Note
Variable drawBitmapAddr controls data addressing
  1. drawBitmapAddr = true Vertical data addressing
  2. drawBitmapAddr = false Horizontal data addressing
  3. A vertical Bitmap's h must be divisible by 8.for a bitmap with wh=128 & h=64.
  4. Bitmap excepted size = 128 * (64/8) = 1024 bytes.
  5. A horizontal Bitmap's w must be divisible by 8. For a bitmap with w=88 & h=48.
  6. Bitmap excepted size = (88/8) * 48 = 528 bytes.

◆ drawCircle()

void displaylib_graphics::drawCircle ( int16_t  centerX,
int16_t  centerY,
int16_t  radius,
uint8_t  color 
)

Draws a circle with center coordinates (centerX, centerY) and a given radius.

Parameters
centerXThe x-coordinate of the circle's center.
centerYThe y-coordinate of the circle's center.
radiusThe radius of the circle.
colorThe color of the circle.

◆ drawDotGrid()

DisplayRet::Ret_Codes_e displaylib_graphics::drawDotGrid ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint8_t  DotGridGap,
uint8_t  color 
)

Draws a grid of dots on the screen starting from the given coordinates. This function draws a grid of pixels with a specified gap between them. It checks that the provided coordinates and dimensions are within the screen bounds and adjusts them if necessary. It also validates The grid of dots gap value and defaults it to 2 if invalid.

Parameters
xThe x-coordinate of the top-left corner where The grid of dots will start.
yThe y-coordinate of the top-left corner where The grid of dots will start.
wThe width of the area to draw The grid of dots, from the starting x-coordinate.
hThe height of the area to draw The grid of dots, from the starting y-coordinate.
DotGridGapThe gap between each dot gap line, controlling the spacing between drawn pixels.
colorThe color of the pixels to draw in The grid of dots.
Returns
DisplayRet::Ret_Codes_eReturns a status code indicating success or failure. Possible return values:

◆ drawEllipse()

void displaylib_graphics::drawEllipse ( int16_t  cx,
int16_t  cy,
int16_t  semiMajorAxis,
int16_t  semiMinorAxis,
bool  fill,
uint8_t  color 
)

Draw an ellipse on the display. This function uses the midpoint ellipse algorithm to efficiently draw an ellipse centered at (cx, cy) with the given semi-major (horizontal) and semi-minor (vertical) axes.

Parameters
cxX-coordinate of the ellipse center.
cyY-coordinate of the ellipse center.
semiMajorAxisLength of the semi-major axis (horizontal radius).
semiMinorAxisLength of the semi-minor axis (vertical radius).
fillif false draw Ellipse , if true fill it!
colorcolor value for the ellipse.

◆ drawFastHLine()

void displaylib_graphics::drawFastHLine ( int16_t  x,
int16_t  y,
int16_t  w,
uint8_t  color 
)

Draws a horizontal line starting at (x,y) with width w.

Parameters
xThe starting x coordinate
yThe starting y coordinate
wThe width of the line
colorThe color of the line

◆ drawFastVLine()

void displaylib_graphics::drawFastVLine ( int16_t  x,
int16_t  y,
int16_t  h,
uint8_t  color 
)

Draws a vertical line starting at (x,y) with height h.

Parameters
xThe starting x coordinate
yThe starting y coordinate
hThe height of the line
colorThe color of the line

◆ drawLine()

void displaylib_graphics::drawLine ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
uint8_t  color 
)

draws a line from (x0,y0) to (x1,y1).

Parameters
x0x start coordinate
y0y start coordinate
x1x end coordinate
y1y end coordinate
colorcolor to draw line

◆ drawLineAngle()

void displaylib_graphics::drawLineAngle ( int16_t  x,
int16_t  y,
int  angle,
uint8_t  start,
uint8_t  length,
int  offset,
uint8_t  color 
)

Draws a line using an angle and length as parameters. This function draws a line starting from (x, y), extending in the direction specified by angle, with a given length. The function also allows applying an offset to the angle before computing the line’s end coordinates.

Parameters
xThe starting x-coordinate (horizontal position).
yThe starting y-coordinate (vertical position).
angleThe angle (in degrees) at which the line is drawn.
startcalculates a new starting position by moving start units along the given angle.
lengthThe length of the line.
offsetAn additional offset applied to the angle before calculating the endpoint.
colorThe color of the line

◆ drawPixel()

virtual void displaylib_graphics::drawPixel ( int16_t  x,
int16_t  y,
uint8_t  color 
)
pure virtual

Implemented in NOKIA_5110, SH110X, SSD1306, ERMCH1115, and ERM19264.

◆ drawPolygon()

DisplayRet::Ret_Codes_e displaylib_graphics::drawPolygon ( int16_t  x,
int16_t  y,
uint8_t  sides,
int16_t  diameter,
float  rotation,
bool  fill,
uint8_t  color 
)

Draws a polygon with a specified number of sides, diameter, rotation, and color. This function draws a regular polygon by connecting points equally spaced around a circle, with each point having a distance defined by the diameter. The polygon is rotated by the given angle (in degrees) before being drawn. The number of sides is enforced to be at least 3.

Parameters
xThe x-coordinate of the center of the polygon.
yThe y-coordinate of the center of the polygon.
sidesThe number of sides the polygon will have. Must be at least 3.
diameterThe diameter of the circle inscribed by the polygon.
rotationThe angle (in degrees) by which to rotate the polygon.
fillif false draw ,if true fill
colorThe color of the polygon edges.
Returns
error code GenericError , if user inputs incorrect sides value

◆ drawQuadrilateral()

void displaylib_graphics::drawQuadrilateral ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
int16_t  x3,
int16_t  y3,
uint8_t  color 
)

Draws a quadrilateral (four-sided polygon) by connecting four points with lines. This function draws a quadrilateral by drawing four lines between the given vertices. The lines are drawn in the order: (x0, y0) to (x1, y1), (x1, y1) to (x2, y2), (x2, y2) to (x3, y3), and finally (x3, y3) back to (x0, y0).

Parameters
x0The x-coordinate of the first vertex.
y0The y-coordinate of the first vertex.
x1The x-coordinate of the second vertex.
y1The y-coordinate of the second vertex.
x2The x-coordinate of the third vertex.
y2The y-coordinate of the third vertex.
x3The x-coordinate of the fourth vertex.
y3The y-coordinate of the fourth vertex.
colorThe 565 color used to draw the lines of the quadrilateral.

◆ drawRect()

void displaylib_graphics::drawRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint8_t  color 
)

draws rectangle at (x,y) where h is height and w is width of the rectangle.

Parameters
xx start coordinate
yy start coordinate
wwidth of the rectangle
hheight of the rectangle
colorcolor to draw rect

◆ drawRoundRect()

void displaylib_graphics::drawRoundRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
int16_t  r,
uint8_t  color 
)

draws a rectangle with rounded edges

Parameters
xx start coordinate
yy start coordinate
wwidth of the rectangle
hheight of the rectangle
rradius of the rounded edges
colorcolor to draw rounded rectangle

◆ drawSimpleArc()

void displaylib_graphics::drawSimpleArc ( int16_t  cx,
int16_t  cy,
int16_t  radius,
float  startAngle,
float  endAngle,
uint8_t  color 
)

Draw a simple arc of one pixel on the display( no offsets , thickness or maximum arc calculations) This function draws an arc between two angles (start and end) on a circle with a given radius.

Parameters
cxX-coordinate of the center of the circle.
cyY-coordinate of the center of the circle.
radiusThe radius of the circle.
startAngleThe starting angle of the arc (in degrees).
endAngleThe ending angle of the arc (in degrees).
colorThe color of the arc.

0 degree is positive X axis , arc is drawn counterclockwise

◆ drawTriangle()

void displaylib_graphics::drawTriangle ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
uint8_t  color 
)

draws a triangle of coordinates (x0,y0), (x1,y1) and (x2,y2).

Parameters
x0x start coordinate point 1
y0y start coordinate point 1
x1x start coordinate point 2
y1y start coordinate point 2
x2x start coordinate point 3
y2y start coordinate point 3
colorcolor to draw triangle

◆ fillCircle()

void displaylib_graphics::fillCircle ( int16_t  x0,
int16_t  y0,
int16_t  r,
uint8_t  color 
)

fills a circle where (x0,y0) are center coordinates an r is circle radius.

Parameters
x0circle center x position
y0circle center y position
rradius of circle
colorcolor of the filled circle

◆ fillQuadrilateral()

void displaylib_graphics::fillQuadrilateral ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
int16_t  x3,
int16_t  y3,
uint8_t  color 
)

Fills a quadrilateral with the specified color using triangles. This function fills a quadrilateral by dividing it into triangles and filling them individually. The quadrilateral is filled by calling the fillTriangle function three times with appropriate vertex coordinates. The useTriangleSplit parameter determines whether the quadrilateral is divided into two triangles or if only one triangle is used.

Parameters
x0The x-coordinate of the first vertex.
y0The y-coordinate of the first vertex.
x1The x-coordinate of the second vertex.
y1The y-coordinate of the second vertex.
x2The x-coordinate of the third vertex.
y2The y-coordinate of the third vertex.
x3The x-coordinate of the fourth vertex.
y3The y-coordinate of the fourth vertex.
colorThe color used to fill the quadrilateral.

◆ fillRect()

void displaylib_graphics::fillRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint8_t  color 
)

fills a rectangle starting from coordinates (x,y) with width of w and height of h.

Parameters
xx coordinate
yy coordinate
wwidth of the rectangle
hheight of the rectangle
colorcolor to fill rectangle

◆ fillRoundRect()

void displaylib_graphics::fillRoundRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
int16_t  r,
uint8_t  color 
)

Fills a rectangle with rounded edges.

Parameters
xx start coordinate
yy start coordinate
wwidth of the rectangle
hheight of the rectangle
rradius of the rounded edges
colorcolor to fill round rectangle

◆ fillScreen()

void displaylib_graphics::fillScreen ( uint8_t  color)

Fills the whole screen with a given color.

Parameters
colorcolor to fill screen

◆ fillTriangle()

void displaylib_graphics::fillTriangle ( int16_t  startX0,
int16_t  startY0,
int16_t  startX1,
int16_t  startY1,
int16_t  startX2,
int16_t  startY2,
uint8_t  color 
)

Fills a triangle defined by the coordinates (x0, y0), (x1, y1), and (x2, y2).

Parameters
startX0The x-coordinate of the first vertex.
startY0The y-coordinate of the first vertex.
startX1The x-coordinate of the second vertex.
startY1The y-coordinate of the second vertex.
startX2The x-coordinate of the third vertex.
startY2The y-coordinate of the third vertex.
colorThe color to fill the triangle.

◆ getArcAngleMax()

float displaylib_graphics::getArcAngleMax ( ) const

Get the current maximum angle of the arc.

Returns
The current maximum angle in degrees.

◆ getArcAngleOffset()

int displaylib_graphics::getArcAngleOffset ( ) const

Get the current angle offset.

Returns
The current angle offset in degrees.

◆ getRotation()

displaylib_graphics::display_rotate_e displaylib_graphics::getRotation ( void  )

Gets the _rotation of the display.

Returns
_rotation value 0-3

◆ height()

int16_t displaylib_graphics::height ( void  ) const

Gets the height of the display (per current _rotation)

Returns
height member of display in pixels

◆ setArcAngleMax()

void displaylib_graphics::setArcAngleMax ( float  arcAngleMax)

Set a new maximum angle for the arc.

Parameters
arcAngleMaxThe new maximum angle in degrees (should be positive).

◆ setArcAngleOffset()

void displaylib_graphics::setArcAngleOffset ( int  arcAngleOffset)

Set a new angle offset.

Parameters
arcAngleOffsetThe new angle offset in degrees.

◆ setCursor()

void displaylib_graphics::setCursor ( int16_t  x,
int16_t  y 
)

set the cursor position

Parameters
xX co-ord position
yY co-ord position

◆ setDrawBitmapAddr()

void displaylib_graphics::setDrawBitmapAddr ( bool  mode)

sets the data addressing mode in drawBitmap function.

Parameters
modeboolean mode , true default
  1. True = bitmap data vertically addressed
  2. False = bitmap data horizontally addressed

◆ setRotation()

void displaylib_graphics::setRotation ( display_rotate_e  CurrentRotation)

Sets the _rotation of the display.

Parameters
CurrentRotation_ enum rotation value

◆ setTextWrap()

void displaylib_graphics::setTextWrap ( bool  w)

turn on or off screen _textwrap of the text (fonts 1-6)

Parameters
wTRUE on

◆ sineFromDegrees()

float displaylib_graphics::sineFromDegrees ( float  angle)
protected

Computes the sine of an angle given in degrees. This function converts the input angle from degrees to radians and then calculates the sine of that angle using the standard C++ sin function.

Parameters
angleThe angle in degrees.
Returns
The sine value of the given angle.

◆ swapInt16display()

void displaylib_graphics::swapInt16display ( int16_t &  a,
int16_t &  b 
)
inlineprivate

Swaps the values of two int16_t variables.

Parameters
aReference to the first integer.
bReference to the second integer.
Note
This function swaps the values in place without using additional memory.

◆ width()

int16_t displaylib_graphics::width ( void  ) const

Gets the width of the display (per current _rotation)

Returns
width member of display in pixels

◆ write()

size_t displaylib_graphics::write ( uint8_t  character)
virtual

write method used in the print class when user calls print

Parameters
characterthe character to print
Returns
Will return
  1. 1. success
  2. Ret_Codes_e enum error code An error in the writeChar method.

Implements Print.

◆ writeChar()

DisplayRet::Ret_Codes_e displaylib_graphics::writeChar ( int16_t  x,
int16_t  y,
char  value 
)

Write 1 character on OLED.

Parameters
xcharacter starting position on x-axis.
ycharacter starting position on x-axis.
valueCharacter to be written.
Returns
Will return
  1. Success
  2. CharScreenBounds co-ords out of bounds check x and y
  3. CharFontASCIIRange Character out of ASCII Font bounds, check Font range

◆ writeCharString()

DisplayRet::Ret_Codes_e displaylib_graphics::writeCharString ( int16_t  x,
int16_t  y,
char *  pText 
)

Write Text character array on OLED.

Parameters
xcharacter starting position on x-axis.
ycharacter starting position on y-axis.
pTextPointer to the array of the text to be written.
Returns
Will return
  1. 0 Success
  2. CharArrayNullptr String pText Array invalid pointer object
  3. Failure in writeChar method upstream, that error code will be returned

Member Data Documentation

◆ _arcAngleMax

float displaylib_graphics::_arcAngleMax = 360.0f
protected

Maximum angle of Arc , used by drawArc

◆ _arcAngleOffset

int displaylib_graphics::_arcAngleOffset = 0
protected

used by drawArc, offset for adjusting the starting angle of arc. default positive X-axis (0°)

◆ _cursor_x

int16_t displaylib_graphics::_cursor_x = 0
protected

Current X co-ord cursor position

◆ _cursor_y

int16_t displaylib_graphics::_cursor_y = 0
protected

Current Y co-ord cursor position

◆ _display_rotate

display_rotate_e displaylib_graphics::_display_rotate = rDegrees_0
protected

Enum to hold rotation

◆ _drawBitmapAddr

bool displaylib_graphics::_drawBitmapAddr
protected

data addressing mode for method drawBitmap, True-vertical , false-horizontal

◆ _height

int16_t displaylib_graphics::_height
protected

Display h as modified by current _rotation

◆ _textwrap

bool displaylib_graphics::_textwrap = true
protected

If set, text at right edge of display will wrap, print method

◆ _width

int16_t displaylib_graphics::_width
protected

Display w as modified by current _rotation

◆ HEIGHT

const int16_t displaylib_graphics::HEIGHT
protected

This is the 'raw' display h - never changes

◆ WIDTH

const int16_t displaylib_graphics::WIDTH
protected

This is the 'raw' display w - never changes


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