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