@@ -14,14 +14,20 @@ void CircularShadow::draw(const DrawArgs& args) { | |||||
if (opacity <= 0.0) | if (opacity <= 0.0) | ||||
return; | return; | ||||
nvgBeginPath(args.vg); | |||||
nvgRect(args.vg, -blurRadius, -blurRadius, box.size.x + 2 * blurRadius, box.size.y + 2 * blurRadius); | |||||
math::Vec center = box.size.div(2.0); | math::Vec center = box.size.div(2.0); | ||||
float radius = center.x; | float radius = center.x; | ||||
NVGcolor icol = nvgRGBAf(0.0, 0.0, 0.0, opacity); | NVGcolor icol = nvgRGBAf(0.0, 0.0, 0.0, opacity); | ||||
NVGcolor ocol = nvgRGBAf(0.0, 0.0, 0.0, 0.0); | NVGcolor ocol = nvgRGBAf(0.0, 0.0, 0.0, 0.0); | ||||
NVGpaint paint = nvgRadialGradient(args.vg, center.x, center.y, radius - blurRadius, radius, icol, ocol); | |||||
nvgFillPaint(args.vg, paint); | |||||
nvgBeginPath(args.vg); | |||||
if (blurRadius > 0.0) { | |||||
nvgRect(args.vg, -blurRadius, -blurRadius, box.size.x + 2 * blurRadius, box.size.y + 2 * blurRadius); | |||||
NVGpaint paint = nvgRadialGradient(args.vg, center.x, center.y, radius - blurRadius, radius, icol, ocol); | |||||
nvgFillPaint(args.vg, paint); | |||||
} | |||||
else { | |||||
nvgCircle(args.vg, center.x, center.y, radius); | |||||
nvgFillColor(args.vg, icol); | |||||
} | |||||
nvgFill(args.vg); | nvgFill(args.vg); | ||||
} | } | ||||
@@ -38,19 +38,21 @@ void LightWidget::drawLight(const DrawArgs& args) { | |||||
} | } | ||||
void LightWidget::drawHalo(const DrawArgs& args) { | void LightWidget::drawHalo(const DrawArgs& args) { | ||||
float radius = std::min(box.size.x, box.size.y) / 2.0; | |||||
float oradius = 4.0 * radius; | |||||
// Halo is now deprecated | |||||
nvgBeginPath(args.vg); | |||||
nvgRect(args.vg, radius - oradius, radius - oradius, 2 * oradius, 2 * oradius); | |||||
NVGpaint paint; | |||||
NVGcolor icol = color::mult(color, 0.07); | |||||
NVGcolor ocol = nvgRGB(0, 0, 0); | |||||
paint = nvgRadialGradient(args.vg, radius, radius, radius, oradius, icol, ocol); | |||||
nvgFillPaint(args.vg, paint); | |||||
nvgGlobalCompositeOperation(args.vg, NVG_LIGHTER); | |||||
nvgFill(args.vg); | |||||
// float radius = std::min(box.size.x, box.size.y) / 2.0; | |||||
// float oradius = 4.0 * radius; | |||||
// nvgBeginPath(args.vg); | |||||
// nvgRect(args.vg, radius - oradius, radius - oradius, 2 * oradius, 2 * oradius); | |||||
// NVGpaint paint; | |||||
// NVGcolor icol = color::mult(color, 0.04); | |||||
// NVGcolor ocol = nvgRGB(0, 0, 0); | |||||
// paint = nvgRadialGradient(args.vg, radius, radius, radius, oradius, icol, ocol); | |||||
// nvgFillPaint(args.vg, paint); | |||||
// nvgGlobalCompositeOperation(args.vg, NVG_LIGHTER); | |||||
// nvgFill(args.vg); | |||||
} | } | ||||