TouchGFX + 0/3 examples
CodeScope will show references to touchgfx::CWRUtil::Q5 from the following samples and libraries:
Examples
STM32469I-Discovery
Demonstrations
STM32469I_EVAL
Demonstrations
STM324x9I_EVAL
Demonstrations
 
Symbols
loading...
Files
loading...

touchgfx::CWRUtil::Q5 class

@class Q5 CWRUtil.hpp touchgfx/widgets/canvas/CWRUtil.hpp Defines a number with 5 bits reserved for fraction. Defines a number with 5 bits reserved for the fractional part of the decimal number. Q5 implements some simple arithmetic operations, most yielding a Q5 number and some yielding a Q10 number as a result. Other operations also work with Q15 numbers. @see Q10 @see Q15 @see http://en.wikipedia.org/wiki/Q_%28number_format%29 @see http://en.wikipedia.org/wiki/Fixed-point_arithmetic

Syntax

class Q5 { public:     Q5() : v(0) { }     explicit Q5(int i) : v(i) { }     Q5(const Q10 q10) : v(int(q10) / Rasterizer::POLY_BASE_SIZE) { }     operator int() const     {         return v;     }     Q5 operator-() const     {         return Q5(-v);     }     Q5 operator+(const Q5& q5) const     {         return Q5(v + q5.v);     }     Q5 operator-(const Q5& q5) const     {         return Q5(v - q5.v);     }     Q10 operator*(const Q5& q5) const     {         return Q10(v * q5.v);     }     Q5 operator*(const Q15& q15) const     {         int32_t remainder;         return Q5(muldiv(v, int(q15), Rasterizer::POLY_BASE_SIZE * Rasterizer::POLY_BASE_SIZE * Rasterizer::POLY_BASE_SIZE, remainder));     }     Q5 operator*(const int i) const     {         return Q5(v * i);     }     Q5 operator/(const int i) const     {         return Q5(v / i);     }     Q5 operator/(const Q5 q5) const     {         return Q5(int(v) * Rasterizer::POLY_BASE_SIZE / q5.v);     }     template <typename T>     T to() const     {         return v / (T)Rasterizer::POLY_BASE_SIZE;     } private:     int32_t v; };

Fields

v

No summary provided. Read more...

Methods

operator-() const

@fn Q5 Q5::operator-() const Negation operator. Negation operator. Read more...

operator+() const

@fn Q5 Q5::operator+(const Q5& q5) const Addition operator. Addition operator. Read more...

operator-() const

@fn Q5 Q5::operator-() const Negation operator. Negation operator. Read more...

operator*() const

@fn Q10 Q5::operator*(const Q5& q5) const Multiplication operator. Multiplication operator. The result is a Q10, not a Q5, for increased precision. @see Q10. Read more...

operator*() const

@fn Q10 Q5::operator*(const Q5& q5) const Multiplication operator. Multiplication operator. The result is a Q10, not a Q5, for increased precision. @see Q10. Read more...

operator*() const

@fn Q10 Q5::operator*(const Q5& q5) const Multiplication operator. Multiplication operator. The result is a Q10, not a Q5, for increased precision. @see Q10. Read more...

operator/() const

@fn Q5 Q5::operator/(const int i) const Division operator. Division operator. Read more...

operator/() const

@fn Q5 Q5::operator/(const int i) const Division operator. Division operator. Read more...

to() const

No summary provided. Read more...

Examples

touchgfx::CWRUtil::Q5 is referenced by 3 libraries and example projects.

References

LocationReferrerScopeText
CWRUtil.hpp:61
class Q5
AbstractShape.hpp:105touchgfx::AbstractShape::setCorner()::xtouchgfx::AbstractShape::setCorner()
virtual void setCorner(int i, CWRUtil::Q5 x, CWRUtil::Q5 y) = 0;
AbstractShape.hpp:118touchgfx::AbstractShape::getCornerX() consttouchgfx::AbstractShape
virtual CWRUtil::Q5 getCornerX(int i) const = 0;
AbstractShape.hpp:131touchgfx::AbstractShape::getCornerY() consttouchgfx::AbstractShape
virtual CWRUtil::Q5 getCornerY(int i) const = 0;
AbstractShape.hpp:424touchgfx::AbstractShape::setCache()::xtouchgfx::AbstractShape::setCache()
virtual void setCache(int i, CWRUtil::Q5 x, CWRUtil::Q5 y) = 0;
AbstractShape.hpp:437touchgfx::AbstractShape::getCacheX() consttouchgfx::AbstractShape
virtual CWRUtil::Q5 getCacheX(int i) const = 0;
AbstractShape.hpp:450touchgfx::AbstractShape::getCacheY() consttouchgfx::AbstractShape
virtual CWRUtil::Q5 getCacheY(int i) const = 0;
AbstractShape.hpp:465touchgfx::AbstractShape::dxtouchgfx::AbstractShape
CWRUtil::Q5 dx, dy;
AbstractShape.hpp:466touchgfx::AbstractShape::shapeAngletouchgfx::AbstractShape
AbstractShape.hpp:467touchgfx::AbstractShape::xScaletouchgfx::AbstractShape
CWRUtil.hpp:120touchgfx::CWRUtil::Q5::operator-() consttouchgfx::CWRUtil::Q5
Q5 operator-() const
CWRUtil.hpp:122touchgfx::CWRUtil::Q5::operator-() const
return Q5(-v);
CWRUtil.hpp:136touchgfx::CWRUtil::Q5::operator+() consttouchgfx::CWRUtil::Q5
Q5 operator+(const Q5& q5) const
CWRUtil.hpp:138touchgfx::CWRUtil::Q5::operator+() const
return Q5(v + q5.v);
CWRUtil.hpp:152touchgfx::CWRUtil::Q5::operator-() consttouchgfx::CWRUtil::Q5
Q5 operator-(const Q5& q5) const
CWRUtil.hpp:154touchgfx::CWRUtil::Q5::operator-() const
return Q5(v - q5.v);
CWRUtil.hpp:171touchgfx::CWRUtil::Q5::operator*() const
Q10 operator*(const Q5& q5) const
CWRUtil.hpp:191touchgfx::CWRUtil::Q5::operator*() consttouchgfx::CWRUtil::Q5
Q5 operator*(const Q15& q15) const
CWRUtil.hpp:194touchgfx::CWRUtil::Q5::operator*() const
CWRUtil.hpp:208touchgfx::CWRUtil::Q5::operator*() consttouchgfx::CWRUtil::Q5
Q5 operator*(const int i) const
CWRUtil.hpp:210touchgfx::CWRUtil::Q5::operator*() const
return Q5(v * i);
CWRUtil.hpp:224touchgfx::CWRUtil::Q5::operator/() consttouchgfx::CWRUtil::Q5
Q5 operator/(const int i) const
CWRUtil.hpp:226touchgfx::CWRUtil::Q5::operator/() const
return Q5(v / i);
CWRUtil.hpp:243touchgfx::CWRUtil::Q5::operator/() consttouchgfx::CWRUtil::Q5
Q5 operator/(const Q5 q5) const
CWRUtil.hpp:245touchgfx::CWRUtil::Q5::operator/() const
return Q5(int(v) * Rasterizer::POLY_BASE_SIZE / q5.v);
CWRUtil.hpp:368touchgfx::CWRUtil::Q10::operator*() const
Q15 operator*(const Q5& q5) const
CWRUtil.hpp:384touchgfx::CWRUtil::Q10::operator/() consttouchgfx::CWRUtil::Q10
Q5 operator/(const Q5& q5) const
CWRUtil.hpp:386touchgfx::CWRUtil::Q10::operator/() const
return Q5(v / int(q5));
CWRUtil.hpp:481touchgfx::CWRUtil::Q15::operator/() const
Q10 operator/(const Q5& q5) const
CWRUtil.hpp:511
static Q5 toQ5(T value)
CWRUtil.hpp:607touchgfx::CWRUtil::sine()
static Q15 sine(Q5 i)
CWRUtil.hpp:609touchgfx::CWRUtil::sine()
Q5 _360 = toQ5<int>(360);
CWRUtil.hpp:610touchgfx::CWRUtil::sine()
i = Q5(((i % _360) + _360) % _360);
CWRUtil.hpp:656touchgfx::CWRUtil::cosine()
static Q15 cosine(Q5 i)
CWRUtil.hpp:751touchgfx::CWRUtil::angle()
static int angle(Q5 x, Q5 y)
CWRUtil.hpp:753touchgfx::CWRUtil::angle()
Q5 dist;
CWRUtil.hpp:768touchgfx::CWRUtil::angle()
static int angle(Q5 x, Q5 y, Q5& d)
CWRUtil.hpp:800touchgfx::CWRUtil::sqrtQ10()touchgfx::CWRUtil
static Q5 sqrtQ10(Q10 value)
CWRUtil.hpp:802touchgfx::CWRUtil::sqrtQ10()
return Q5(isqrt(uint32_t(int(value))));
CWRUtil.hpp:819touchgfx::CWRUtil::muldivQ5()touchgfx::CWRUtil
static Q5 muldivQ5(Q5 factor1, Q5 factor2, Q5 divisor)
CWRUtil.hpp:822touchgfx::CWRUtil::muldivQ5()
return Q5(muldiv(int(factor1), int(factor2), int(divisor), remainder));
CWRUtil.hpp:837touchgfx::CWRUtil::mulQ5()touchgfx::CWRUtil
static Q5 mulQ5(Q5 factor1, Q5 factor2)
CWRUtil.hpp:843touchgfx::CWRUtil::_angle()
static int _angle(Q5 x, Q5 y, Q5& d)
CWRUtil.hpp:852touchgfx::CWRUtil::_angle()
Q5 _1 = toQ5<int>(1); // Used to convert Q5->Q10->Q15
Canvas.hpp:89touchgfx::Canvas::moveTo()::xtouchgfx::Canvas::moveTo()
void moveTo(CWRUtil::Q5 x, CWRUtil::Q5 y);
Canvas.hpp:106touchgfx::Canvas::lineTo()::xtouchgfx::Canvas::lineTo()
void lineTo(CWRUtil::Q5 x, CWRUtil::Q5 y);
Canvas.hpp:167touchgfx::Canvas::invalidatedAreaXtouchgfx::Canvas
Canvas.hpp:168touchgfx::Canvas::invalidatedAreaYtouchgfx::Canvas
Canvas.hpp:169touchgfx::Canvas::invalidatedAreaWidthtouchgfx::Canvas
Canvas.hpp:170touchgfx::Canvas::invalidatedAreaHeighttouchgfx::Canvas
Canvas.hpp:181touchgfx::Canvas::previousXtouchgfx::Canvas
Canvas.hpp:184touchgfx::Canvas::initialXtouchgfx::Canvas
Canvas.hpp:194touchgfx::Canvas::isOutside() const::xtouchgfx::Canvas::isOutside() const
uint8_t isOutside(const CWRUtil::Q5& x, const CWRUtil::Q5& y, const CWRUtil::Q5& width, const CWRUtil::Q5& height) const;
Canvas.hpp:208touchgfx::Canvas::transformFrameBufferToDisplay() const::xtouchgfx::Canvas::transformFrameBufferToDisplay() const
Circle.hpp:535touchgfx::Circle::getMinimalRect() const::arcStarttouchgfx::Circle::getMinimalRect() const
Rect getMinimalRect(CWRUtil::Q5 arcStart, CWRUtil::Q5 arcEnd) const;
Circle.hpp:538touchgfx::Circle::circleCenterXtouchgfx::Circle
CWRUtil::Q5 circleCenterX; ///< The circle center x coordinate
Circle.hpp:539touchgfx::Circle::circleCenterYtouchgfx::Circle
CWRUtil::Q5 circleCenterY; ///< The circle center y coordinate
Circle.hpp:540touchgfx::Circle::circleRadiustouchgfx::Circle
CWRUtil::Q5 circleRadius; ///< The circle radius
Circle.hpp:541touchgfx::Circle::circleArcAngleStarttouchgfx::Circle
CWRUtil::Q5 circleArcAngleStart; ///< The circle arc angle start
Circle.hpp:542touchgfx::Circle::circleArcAngleEndtouchgfx::Circle
CWRUtil::Q5 circleArcAngleEnd; ///< The circle arc angle end
Circle.hpp:543touchgfx::Circle::circleLineWidthtouchgfx::Circle
CWRUtil::Q5 circleLineWidth; ///< Width of the circle line
Circle.hpp:547touchgfx::Circle::moveToAR2() const::angletouchgfx::Circle::moveToAR2() const
void moveToAR2(Canvas& canvas, const CWRUtil::Q5& angle, const CWRUtil::Q5& r2) const;
Circle.hpp:548touchgfx::Circle::lineToAR2() const::angletouchgfx::Circle::lineToAR2() const
void lineToAR2(Canvas& canvas, const CWRUtil::Q5& angle, const CWRUtil::Q5& r2) const;
Circle.hpp:549touchgfx::Circle::lineToXYAR2() const::xtouchgfx::Circle::lineToXYAR2() const
void lineToXYAR2(Canvas& canvas, const CWRUtil::Q5& x, const CWRUtil::Q5& y, const CWRUtil::Q5& angle, const CWRUtil::Q5& r2) const;
Circle.hpp:550touchgfx::Circle::updateMinMaxAR() const::atouchgfx::Circle::updateMinMaxAR() const
void updateMinMaxAR(const CWRUtil::Q5& a, const CWRUtil::Q5& r2, CWRUtil::Q5& xMin, CWRUtil::Q5& xMax, CWRUtil::Q5& yMin, CWRUtil::Q5& yMax) const;
Circle.hpp:551touchgfx::Circle::updateMinMaxXY() const::xNewtouchgfx::Circle::updateMinMaxXY() const
void updateMinMaxXY(const CWRUtil::Q5& xNew, const CWRUtil::Q5& yNew, CWRUtil::Q5& xMin, CWRUtil::Q5& xMax, CWRUtil::Q5& yMin, CWRUtil::Q5& yMax) const;
Circle.hpp:552touchgfx::Circle::calculateMinimalRect() const::arcStarttouchgfx::Circle::calculateMinimalRect() const
Circle.hpp:553touchgfx::Circle::getMinimalRectForUpdatedStartAngle()::startAngleQ5touchgfx::Circle::getMinimalRectForUpdatedStartAngle()
Circle.hpp:554touchgfx::Circle::getMinimalRectForUpdatedEndAngle()::endAngleQ5touchgfx::Circle::getMinimalRectForUpdatedEndAngle()
Shape.hpp:87touchgfx::Shape::setCorner()::xtouchgfx::Shape::setCorner()
virtual void setCorner(int i, CWRUtil::Q5 x, CWRUtil::Q5 y)
Shape.hpp:106touchgfx::Shape::getCornerX() consttouchgfx::Shape
virtual CWRUtil::Q5 getCornerX(int i) const
Shape.hpp:126touchgfx::Shape::getCornerY() consttouchgfx::Shape
virtual CWRUtil::Q5 getCornerY(int i) const
Shape.hpp:148touchgfx::Shape::setCache()::xtouchgfx::Shape::setCache()
virtual void setCache(int i, CWRUtil::Q5 x, CWRUtil::Q5 y)
Shape.hpp:167touchgfx::Shape::getCacheX() consttouchgfx::Shape
virtual CWRUtil::Q5 getCacheX(int i) const
Shape.hpp:187touchgfx::Shape::getCacheY() consttouchgfx::Shape
virtual CWRUtil::Q5 getCacheY(int i) const
Shape.hpp:197
CWRUtil::Q5 xCorner[POINTS];
Shape.hpp:198
CWRUtil::Q5 yCorner[POINTS];
Shape.hpp:199
CWRUtil::Q5 xCache[POINTS];
Shape.hpp:200
CWRUtil::Q5 yCache[POINTS];

Type Use

Variables of touchgfx::CWRUtil::Q5 type
touchgfx::CWRUtil::Q5::operator-() const::q5
touchgfx::CWRUtil::Q5::operator/() const::q5
touchgfx::CWRUtil::sine()::_360
touchgfx::CWRUtil::angle()::x
touchgfx::CWRUtil::angle()::y
touchgfx::CWRUtil::angle()::dist
touchgfx::CWRUtil::angle()::d
touchgfx::CWRUtil::_angle()::_1
touchgfx::Circle::getMinimalRect() const::arcStart
touchgfx::Circle::getMinimalRect() const::arcEnd
touchgfx::Canvas::moveTo()::x
touchgfx::Canvas::moveTo()::y
touchgfx::Canvas::lineTo()::x
touchgfx::Canvas::lineTo()::y
all items filtered out
touchgfx::CWRUtil::Q5
Allocators of touchgfx::CWRUtil::Q5
Deletors of touchgfx::CWRUtil::Q5
touchgfx::CWRUtil::Q5::operator/() const::q5
touchgfx::CWRUtil::sine()::_360
touchgfx::CWRUtil::angle()::x
touchgfx::CWRUtil::angle()::y
touchgfx::CWRUtil::angle()::dist
touchgfx::CWRUtil::_angle()::_1
all items filtered out
touchgfx::CWRUtil::Q5
touchgfx::CWRUtil::Q5::operator/() const::q5
touchgfx::CWRUtil::sine()::_360
touchgfx::CWRUtil::angle()::x
touchgfx::CWRUtil::angle()::y
touchgfx::CWRUtil::angle()::dist
touchgfx::CWRUtil::_angle()::_1
all items filtered out