Exemple #1
0
static color32::byte to_byte(sample s) noexcept
{
    return static_cast<color32::byte>(color32::BYTE_MAX * s.value());
}
Exemple #2
0
sample operator/(sample a, sample b)
{
    return sample{a.value() / b.value()};
}
Exemple #3
0
sample operator-(sample a, sample b)
{
    return sample{a.value() - b.value()};
}
Exemple #4
0
sample operator+(sample a, sample b)
{
    return sample{a.value() + b.value()};
}
Exemple #5
0
sample sample::operator*(sample other) const
{
    sample result;
    result.value_ = value() * other.value(); // can't overflow
    return result;
}
Exemple #6
0
sample interpolate(sample a, sample weight, sample b)
{
    return sample{(1 - weight.value()) * a.value() + weight.value() * b.value()};
}