image: Deprecate ScaleColor and TranslateColor

This commit is contained in:
Hajime Hoshi 2016-02-06 21:49:11 +09:00
parent c90811c554
commit 439c8a62d3
3 changed files with 6 additions and 5 deletions

View File

@ -125,7 +125,7 @@ func Monochrome() ColorM {
}
}
// ScaleColor returns a color matrix that scales a color matrix by the given color (r, g, b, a).
// Deprecated as of 1.2.0-alpha. Use Scale instead.
func ScaleColor(r, g, b, a float64) ColorM {
return ColorM{
initialized: true,
@ -138,7 +138,7 @@ func ScaleColor(r, g, b, a float64) ColorM {
}
}
// TranslateColor returns a color matrix that translates a color matrix by the given color (r, g, b, a).
// Deprecated as of 1.2.0-alpha. Use Translate instead.
func TranslateColor(r, g, b, a float64) ColorM {
return ColorM{
initialized: true,

View File

@ -50,7 +50,8 @@ func TestColorInit(t *testing.T) {
}
func TestColorAssign(t *testing.T) {
m := ScaleColor(1, 1, 1, 1) // Create elements explicitly
m := ColorM{}
m.Scale(1, 1, 1, 1) // Create elements explicitly
m2 := m
m.SetElement(0, 0, 0)
got := m2.Element(0, 0)

View File

@ -166,11 +166,11 @@ func (f *Field) Update() error {
func (f *Field) flushingColor() ebiten.ColorM {
clr := ebiten.ColorM{}
alpha := (float64(f.flushCount) / maxFlushCount) / 2
clr.Concat(ebiten.ScaleColor(1, 1, 1, alpha))
clr.Scale(1, 1, 1, alpha)
r := (1 - float64(f.flushCount)/maxFlushCount) * 2
g := (1 - float64(f.flushCount)/maxFlushCount) / 2
b := (1 - float64(f.flushCount)/maxFlushCount) / 2
clr.Concat(ebiten.TranslateColor(r, g, b, 0))
clr.Translate(r, g, b, 0)
return clr
}