| 53 | }; |
| 54 | |
| 55 | bool Animation4Music_QuatroRed::getImage(Image<ColorRgb>& newImage) |
| 56 | { |
| 57 | if (hasResult == nullptr) |
| 58 | return false; |
| 59 | |
| 60 | bool newData = false; |
| 61 | auto r = hasResult(this, _internalIndex, NULL, NULL, &newData, &_oldMulti); |
| 62 | |
| 63 | if (r == nullptr || !newData) |
| 64 | return false; |
| 65 | |
| 66 | int value = r->getValue(_oldMulti); |
| 67 | |
| 68 | if (value < 0) |
| 69 | return false; |
| 70 | |
| 71 | newImage.clear(); |
| 72 | |
| 73 | { |
| 74 | int hm = (newImage.height() / 2); |
| 75 | int h = std::min((hm * value) / 255, 255); |
| 76 | int h1 = std::max(hm - h, 0); |
| 77 | int h2 = std::min(hm + h, (int)newImage.height() - 1); |
| 78 | |
| 79 | if (h2 > h1) |
| 80 | { |
| 81 | int width = newImage.width() * 0.04; |
| 82 | |
| 83 | ColorRgb selected(255, 0, 0); |
| 84 | |
| 85 | newImage.gradientVBox(0, h1, width, h2, selected.Red(), selected.Green(), selected.Blue()); |
| 86 | newImage.gradientVBox(newImage.width() - 1 - width, h1, newImage.width() - 1, h2, selected.Red(), selected.Green(), selected.Blue()); |
| 87 | } |
| 88 | } |
| 89 | { |
| 90 | int wm = (newImage.width() / 2); |
| 91 | int w = std::min((wm * value) / 255, 255); |
| 92 | int w1 = std::max(wm - w, 0); |
| 93 | int w2 = std::min(wm + w, (int)newImage.width() - 1); |
| 94 | |
| 95 | if (w2 > w1) |
| 96 | { |
| 97 | int height = newImage.height() * 0.067; |
| 98 | |
| 99 | ColorRgb selected(255, 0, 0); |
| 100 | |
| 101 | newImage.gradientHBox(w1, 0, w2, height, selected.Red(), selected.Green(), selected.Blue()); |
| 102 | newImage.gradientHBox(w1, newImage.height() - 1 - height, w2, newImage.height() - 1, selected.Red(), selected.Green(), selected.Blue()); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | return true; |
| 107 | }; |
| 108 | |
| 109 | bool Animation4Music_QuatroRed::isRegistered = hyperhdr::effects::REGISTER_EFFECT(Animation4Music_QuatroRed::getDefinition()); |
nothing calls this directly
no test coverage detected