mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
image: Deprecate ScaleColor and TranslateColor
This commit is contained in:
parent
c90811c554
commit
439c8a62d3
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user