| 80 | } |
| 81 | |
| 82 | bool Animation_KnightRider::Play(HyperImage& painter) |
| 83 | { |
| 84 | bool ret = true; |
| 85 | |
| 86 | for (int i = 0; i < increment; i++) |
| 87 | { |
| 88 | position += direction; |
| 89 | if (position == -1) |
| 90 | { |
| 91 | position = 1; |
| 92 | direction = 1; |
| 93 | } |
| 94 | else if (position == KNIGHT_WIDTH) |
| 95 | { |
| 96 | position = KNIGHT_WIDTH - 2; |
| 97 | direction = -1; |
| 98 | } |
| 99 | |
| 100 | for (int j = 0; j < KNIGHT_WIDTH; j++) { |
| 101 | imageData[3 * j] = uint8_t(clamp(int(fadeFactor * imageData[3 * j]), 0, 255)); |
| 102 | imageData[3 * j + 1] = uint8_t(clamp(int(fadeFactor * imageData[3 * j + 1]), 0, 255)); |
| 103 | imageData[3 * j + 2] = uint8_t(clamp(int(fadeFactor * imageData[3 * j + 2]), 0, 255)); |
| 104 | |
| 105 | painter.setPen(ColorRgb(imageData[3 * j], imageData[3 * j + 1], imageData[3 * j + 2])); |
| 106 | painter.drawVerticalLine(j, 0, KNIGHT_HEIGHT - 1); |
| 107 | |
| 108 | |
| 109 | } |
| 110 | |
| 111 | imageData[3 * position] = color.x; |
| 112 | imageData[3 * position + 1] = color.y; |
| 113 | imageData[3 * position + 2] = color.z; |
| 114 | |
| 115 | //QImage img(imageData, KNIGHT_WIDTH, KNIGHT_HEIGHT, KNIGHT_WIDTH, QImage::Format_RGB888); |
| 116 | painter.setPen(ColorRgb(color.x, color.y, color.z)); |
| 117 | painter.drawVerticalLine(position, 0, KNIGHT_HEIGHT - 1); |
| 118 | } |
| 119 | return ret; |
| 120 | } |
| 121 | |
| 122 | bool Animation_KnightRider::isRegistered = hyperhdr::effects::REGISTER_EFFECT(Animation_KnightRider::getDefinition()); |
nothing calls this directly
no test coverage detected