* @brief Encodes a premultiplied vertex color for QSGVertexColorMaterial. */
| 39 | * @brief Encodes a premultiplied vertex color for QSGVertexColorMaterial. |
| 40 | */ |
| 41 | static void setVertexColor(QSGGeometry::ColoredPoint2D& vertex, |
| 42 | const float x, |
| 43 | const float y, |
| 44 | const QColor& color, |
| 45 | const double alpha) |
| 46 | { |
| 47 | Q_ASSERT(alpha >= 0.0); |
| 48 | Q_ASSERT(alpha <= 1.0); |
| 49 | |
| 50 | vertex.set(x, |
| 51 | y, |
| 52 | static_cast<unsigned char>(std::lround(color.redF() * alpha * 255.0)), |
| 53 | static_cast<unsigned char>(std::lround(color.greenF() * alpha * 255.0)), |
| 54 | static_cast<unsigned char>(std::lround(color.blueF() * alpha * 255.0)), |
| 55 | static_cast<unsigned char>(std::lround(alpha * 255.0))); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * @brief Constructs the fill item and enables scene-graph content. |
no test coverage detected