| 138 | |
| 139 | |
| 140 | juce::Rectangle<float> UIBase::drawShadowEllipse(juce::Graphics& g, |
| 141 | juce::Rectangle<float> box_bounds, |
| 142 | float corner_size, |
| 143 | const FillShadowEllipseArgs& margs) const { |
| 144 | auto args = margs; |
| 145 | if (!args.change_main) |
| 146 | args.main_colour = getBackgroundColour(); |
| 147 | if (!args.change_dark) |
| 148 | args.dark_shadow_color = getDarkShadowColour(); |
| 149 | if (!args.change_bright) |
| 150 | args.bright_shadow_color = getBrightShadowColour(); |
| 151 | |
| 152 | juce::Path path; |
| 153 | auto radius = juce::jmax(juce::roundToInt(corner_size * 0.75f), 1); |
| 154 | if (args.fit) { |
| 155 | box_bounds = box_bounds.reduced((static_cast<float>(radius) + 1.5f * corner_size) * .5f); |
| 156 | } |
| 157 | path.addEllipse(box_bounds); |
| 158 | auto offset = static_cast<int>(corner_size * args.blur_radius); |
| 159 | juce::Path mask; |
| 160 | mask.addEllipse(box_bounds.withSizeKeepingCentre(box_bounds.getWidth() * 3, box_bounds.getHeight() * 3)); |
| 161 | mask.setUsingNonZeroWinding(false); |
| 162 | mask.addEllipse(box_bounds); |
| 163 | g.saveState(); |
| 164 | g.reduceClipRegion(mask); |
| 165 | if (!args.flip) { |
| 166 | if (args.draw_dark) { |
| 167 | juce::DropShadow dark_shadow(args.dark_shadow_color, radius, |
| 168 | {offset, offset}); |
| 169 | dark_shadow.drawForPath(g, path); |
| 170 | } |
| 171 | if (args.draw_bright) { |
| 172 | juce::DropShadow bright_shadow(args.bright_shadow_color, radius, |
| 173 | {-offset, -offset}); |
| 174 | bright_shadow.drawForPath(g, path); |
| 175 | } |
| 176 | } else { |
| 177 | if (args.draw_dark) { |
| 178 | juce::DropShadow dark_shadow(args.dark_shadow_color, radius, |
| 179 | {-offset, -offset}); |
| 180 | dark_shadow.drawForPath(g, path); |
| 181 | } |
| 182 | if (args.draw_bright) { |
| 183 | juce::DropShadow bright_shadow(args.bright_shadow_color, radius, |
| 184 | {offset, offset}); |
| 185 | bright_shadow.drawForPath(g, path); |
| 186 | } |
| 187 | } |
| 188 | g.restoreState(); |
| 189 | return box_bounds; |
| 190 | } |
| 191 | |
| 192 | juce::Rectangle<float> UIBase::getInnerShadowEllipseArea(juce::Rectangle<float> box_bounds, |
| 193 | const float corner_size, |
no test coverage detected