Browse Source

Remove LightWidget halo. Decrease default CircularShadow opacity slightly. Render shadow with hard edges by default.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
d6fdb2a2c1
2 changed files with 24 additions and 16 deletions
  1. +10
    -4
      src/app/CircularShadow.cpp
  2. +14
    -12
      src/app/LightWidget.cpp

+ 10
- 4
src/app/CircularShadow.cpp View File

@@ -14,14 +14,20 @@ void CircularShadow::draw(const DrawArgs& args) {
if (opacity <= 0.0)
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);
float radius = center.x;
NVGcolor icol = nvgRGBAf(0.0, 0.0, 0.0, opacity);
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);
}



+ 14
- 12
src/app/LightWidget.cpp View File

@@ -38,19 +38,21 @@ void LightWidget::drawLight(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);
}




Loading…
Cancel
Save