from Circle.hpp:41
class Circle : public CanvasWidget
{
public:
Circle();
template <typename T>
void setCircle(const T x, const T y, const T r)
{
setCenter<T>(x, y);
setRadius<T>(r);
}
void setCircle(const int16_t x, const int16_t y, const int16_t r)
{
setCircle<int>(x, y, r);
}
template <typename T>
void setCenter(const T x, const T y)
{
this->circleCenterX = CWRUtil::toQ5<T>(x);
this->circleCenterY = CWRUtil::toQ5<T>(y);
}
void setCenter(const int16_t x, const int16_t y)
{
setCenter<int>(x, y);
}
template <typename T>
void getCenter(T& x, T& y) const
{
x = circleCenterX.to<T>();
y = circleCenterY.to<T>();
}
template <typename T>
void setRadius(const T r)
{
this->circleRadius = CWRUtil::toQ5<T>(r);
}
template <typename T>
void getRadius(T& r) const
{
r = circleRadius.to<T>();
}
template <typename T>
void setArc(const T startAngle, const T endAngle)
{
circleArcAngleStart = CWRUtil::toQ5<T>(startAngle);
circleArcAngleEnd = CWRUtil::toQ5<T>(endAngle);
}
void setArc(const int16_t startAngle, const int16_t endAngle)
{
setArc<int>(startAngle, endAngle);
}
template <typename T>
void getArc(T& startAngle, T& endAngle) const
{
startAngle = circleArcAngleStart.to<T>();
endAngle = circleArcAngleEnd.to<T>();
}
int16_t getArcStart() const
{
return circleArcAngleStart.to<int>();
}
template <typename T>
void getArcStart(T& angle) const
{
angle = circleArcAngleStart.to<T>();
}
int16_t getArcEnd() const
{
return circleArcAngleEnd.to<int>();
}
template <typename T>
void getArcEnd(T& angle) const
{
angle = circleArcAngleEnd.to<T>();
}
template <typename T>
void updateArcStart(const T startAngle)
{
CWRUtil::Q5 startAngleQ5 = CWRUtil::toQ5<T>(startAngle);
if (circleArcAngleStart == startAngleQ5)
{
return;
}
Rect minimalRect = getMinimalRectForUpdatedStartAngle(startAngleQ5);
circleArcAngleStart = startAngleQ5;
invalidateRect(minimalRect);
}
template <typename T>
void updateArcEnd(const T endAngle)
{
CWRUtil::Q5 endAngleQ5 = CWRUtil::toQ5<T>(endAngle);
if (circleArcAngleEnd == endAngleQ5)
{
return;
}
Rect minimalRect = getMinimalRectForUpdatedEndAngle(endAngleQ5);
circleArcAngleEnd = endAngleQ5;
invalidateRect(minimalRect);
}
template <typename T>
void setLineWidth(const T width)
{
this->circleLineWidth = CWRUtil::toQ5<T>(width);
}
template <typename T>
void getLineWidth(T& width) const
{
width = circleLineWidth.to<T>();
}
void setPrecision(const int precision);
int getPrecision() const;
void setCapPrecision(const int precision);
int getCapPrecision() const;
virtual bool drawCanvasWidget(const Rect& invalidatedArea) const;
virtual Rect getMinimalRect() const;
Rect getMinimalRect(int16_t arcStart, int16_t arcEnd) const;
Rect getMinimalRect(CWRUtil::Q5 arcStart, CWRUtil::Q5 arcEnd) const;
private:
CWRUtil::Q5 circleCenterX;
CWRUtil::Q5 circleCenterY;
CWRUtil::Q5 circleRadius;
CWRUtil::Q5 circleArcAngleStart;
CWRUtil::Q5 circleArcAngleEnd;
CWRUtil::Q5 circleLineWidth;
uint8_t circleArcIncrement;
uint8_t circleCapArcIncrement;
void moveToAR2(Canvas& canvas, const CWRUtil::Q5& angle, const CWRUtil::Q5& r2) const;
void lineToAR2(Canvas& canvas, const CWRUtil::Q5& angle, const CWRUtil::Q5& r2) const;
void lineToXYAR2(Canvas& canvas, const CWRUtil::Q5& x, const CWRUtil::Q5& y, const CWRUtil::Q5& angle, const CWRUtil::Q5& r2) const;
void updateMinMaxAR(const CWRUtil::Q5& a, const CWRUtil::Q5& r2, CWRUtil::Q5& xMin, CWRUtil::Q5& xMax, CWRUtil::Q5& yMin, CWRUtil::Q5& yMax) const;
void updateMinMaxXY(const CWRUtil::Q5& xNew, const CWRUtil::Q5& yNew, CWRUtil::Q5& xMin, CWRUtil::Q5& xMax, CWRUtil::Q5& yMin, CWRUtil::Q5& yMax) const;
void calculateMinimalRect(CWRUtil::Q5 arcStart, CWRUtil::Q5 arcEnd, CWRUtil::Q5& xMin, CWRUtil::Q5& xMax, CWRUtil::Q5& yMin, CWRUtil::Q5& yMax) const;
Rect getMinimalRectForUpdatedStartAngle(CWRUtil::Q5& startAngleQ5);
Rect getMinimalRectForUpdatedEndAngle(CWRUtil::Q5& endAngleQ5);
};