m5stack-avatar
Loading...
Searching...
No Matches
DrawingUtils.hpp
Go to the documentation of this file.
1
12#ifndef M5AVATAR_DRAWING_UTILS_HPP_
13#define M5AVATAR_DRAWING_UTILS_HPP_
14
15#include <BoundingRect.h>
16#include <DrawContext.h>
17#include <Drawable.h>
18
19namespace m5avatar {
20void rotatePoint(float &x, float &y, float angle);
21
22void rotatePointAround(float &x, float &y, float angle, float cx, float cy);
23
24void fillRotatedRect(M5Canvas *canvas, uint16_t cx, uint16_t cy, uint16_t w,
25 uint16_t h, float angle, uint16_t color);
26
27void fillRectRotatedAround(M5Canvas *canvas, float top_left_x, float top_left_y,
28 float bottom_right_x, float bottom_right_y,
29 float angle, uint16_t cx, uint16_t cy,
30 uint16_t color);
45void computeParamsOfCirclePassingThroughThreePoints(float &r, float &cx,
46 float &cy, float x1,
47 float y1, float x2,
48 float y2, float x3,
49 float y3);
50
51void computeAnglesOfArcPassingThroughThreePoints(
52 float &min_angle, float &max_angle, float &via_angle, float x1, float y1,
53 float x2, float y2, float via_x, float via_y, float cx, float cy);
54
55void drawCircle(M5Canvas *canvas, float x1, float y1, float x2, float y2,
56 float x3, float y3, uint16_t color);
57
72void drawArc(M5Canvas *canvas, float x1, float y1, float x2, float y2,
73 float via_x, float via_y, uint8_t thickness = 4,
74 uint16_t color = 0xffff, uint8_t offset = 0);
75
76void fillArc(M5Canvas *canvas, float x1, float y1, float x2, float y2,
77 float via_x, float via_y, uint8_t thickness = 4,
78 uint16_t color = 0xffff, uint8_t offset = 0);
79
80} // namespace m5avatar
81
82#endif