mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
parent
84289a06ba
commit
0660c4ea8a
14
colorm.go
14
colorm.go
@ -15,6 +15,7 @@
|
|||||||
package ebiten
|
package ebiten
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/v2/internal/affine"
|
"github.com/hajimehoshi/ebiten/v2/internal/affine"
|
||||||
@ -128,3 +129,16 @@ func (c *ColorM) IsInvertible() bool {
|
|||||||
func (c *ColorM) Invert() {
|
func (c *ColorM) Invert() {
|
||||||
c.impl = c.affineColorM().Invert()
|
c.impl = c.affineColorM().Invert()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReadElements reads the body part and the translation part to the given float32 slices.
|
||||||
|
//
|
||||||
|
// len(body) must be 16 and len(translation) must be 4. Otherwise, ReadElements panics.
|
||||||
|
func (c *ColorM) ReadElements(body []float32, translation []float32) {
|
||||||
|
if len(body) != 16 {
|
||||||
|
panic(fmt.Sprintf("ebiten: len(body) must be 16 but %d", len(body)))
|
||||||
|
}
|
||||||
|
if len(translation) != 4 {
|
||||||
|
panic(fmt.Sprintf("ebiten: len(translation) must be 4 but %d", len(translation)))
|
||||||
|
}
|
||||||
|
c.affineColorM().Elements(body, translation)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user