MCPcopy Create free account
hub / github.com/awawa-dev/HyperHDR / Play

Method Play

sources/effects/Animation_KnightRider.cpp:82–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82bool 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
122bool Animation_KnightRider::isRegistered = hyperhdr::effects::REGISTER_EFFECT(Animation_KnightRider::getDefinition());

Callers

nothing calls this directly

Calls 4

clampFunction · 0.85
ColorRgbClass · 0.85
setPenMethod · 0.80
drawVerticalLineMethod · 0.80

Tested by

no test coverage detected