This commit is contained in:
Andrea Blankenstijn 2021-07-27 21:52:38 +02:00
parent 55fbd59c36
commit 0dfc8cdf02

View file

@ -16,14 +16,21 @@ namespace bwidgets::core
)
noexcept
{
const auto d_clamp {std::abs(std::clamp<float>(d, -aa_pixels, 0))};
const auto d_norm {d_clamp / aa_pixels};
const auto factor {3 * d_norm * d_norm - 2 * d_norm * d_norm * d_norm};
SDL_Color c {base_color};
if (aa_pixels == 0)
{
if (d > 0) c.a = 0;
}
else
{
const auto d_clamp {std::abs(std::clamp<float>(d, -aa_pixels, 0))};
const auto d_norm {d_clamp / aa_pixels};
const auto factor {3 * d_norm * d_norm - 2 * d_norm * d_norm * d_norm};
return {
base_color.r, base_color.g, base_color.b,
(uint8_t)(base_color.a * factor)
};
c.a *= factor;
}
return c;
}
core::Texture* filled_circle(