| 11 | } |
| 12 | |
| 13 | void CircularShadow::draw(const DrawArgs& args) { |
| 14 | if (opacity <= 0.0) |
| 15 | return; |
| 16 | |
| 17 | math::Vec center = box.size.div(2.0); |
| 18 | float radius = center.x; |
| 19 | NVGcolor icol = nvgRGBAf(0.0, 0.0, 0.0, opacity); |
| 20 | NVGcolor ocol = nvgRGBAf(0.0, 0.0, 0.0, 0.0); |
| 21 | nvgBeginPath(args.vg); |
| 22 | if (blurRadius > 0.0) { |
| 23 | nvgRect(args.vg, -blurRadius, -blurRadius, box.size.x + 2 * blurRadius, box.size.y + 2 * blurRadius); |
| 24 | NVGpaint paint = nvgRadialGradient(args.vg, center.x, center.y, radius - blurRadius, radius, icol, ocol); |
| 25 | nvgFillPaint(args.vg, paint); |
| 26 | } |
| 27 | else { |
| 28 | nvgCircle(args.vg, center.x, center.y, radius); |
| 29 | nvgFillColor(args.vg, icol); |
| 30 | } |
| 31 | nvgFill(args.vg); |
| 32 | } |
| 33 | |
| 34 | |
| 35 | } // namespace app |