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