mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2026-04-22 15:57:15 +08:00
@@ -66,6 +66,14 @@ func (c *ColorScale) elements() (float32, float32, float32, float32) {
|
|||||||
return c.r_1 + 1, c.g_1 + 1, c.b_1 + 1, c.a_1 + 1
|
return c.r_1 + 1, c.g_1 + 1, c.b_1 + 1, c.a_1 + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set overwrites the current scale with r, g, b, a.
|
||||||
|
func (c *ColorScale) Set(r, g, b, a float32) {
|
||||||
|
c.r_1 = r - 1
|
||||||
|
c.g_1 = g - 1
|
||||||
|
c.b_1 = b - 1
|
||||||
|
c.a_1 = a - 1
|
||||||
|
}
|
||||||
|
|
||||||
// SetR overwrites the current red value with r.
|
// SetR overwrites the current red value with r.
|
||||||
func (c *ColorScale) SetR(r float32) {
|
func (c *ColorScale) SetR(r float32) {
|
||||||
c.r_1 = r - 1
|
c.r_1 = r - 1
|
||||||
@@ -86,6 +94,12 @@ func (c *ColorScale) SetA(a float32) {
|
|||||||
c.a_1 = a - 1
|
c.a_1 = a - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetWithColor overwrites the current scale with the given color.
|
||||||
|
func (c *ColorScale) SetWithColor(clr color.Color) {
|
||||||
|
cr, cg, cb, ca := clr.RGBA()
|
||||||
|
c.Set(float32(cr)/0xffff, float32(cg)/0xffff, float32(cb)/0xffff, float32(ca)/0xffff)
|
||||||
|
}
|
||||||
|
|
||||||
// Scale multiplies the given values to the current scale.
|
// Scale multiplies the given values to the current scale.
|
||||||
//
|
//
|
||||||
// Scale is slightly different from colorm.ColorM's Scale in terms of alphas.
|
// Scale is slightly different from colorm.ColorM's Scale in terms of alphas.
|
||||||
|
|||||||
Reference in New Issue
Block a user