ebiten: add comments at ColorScale.Scale

Updates #2171
This commit is contained in:
Hajime Hoshi 2023-03-20 10:55:53 +09:00
parent ae625255f2
commit ffef8b433f

View File

@ -87,6 +87,10 @@ func (c *ColorScale) SetA(a float32) {
}
// Scale multiplies the given values to the current scale.
//
// Scale is slightly different from colorm.ColorM's Scale in terms of alphas.
// ColorScale is applied to premultiplied-alpha colors, while colorm.ColorM is applied to straight-alpha colors.
// Thus, colorm.ColorM.Scale(r, g, b, a) equals to ColorScale.Scale(r*a, g*a, b*a, a).
func (c *ColorScale) Scale(r, g, b, a float32) {
c.r_1 = (c.r_1+1)*r - 1
c.g_1 = (c.g_1+1)*g - 1