mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
parent
fbeed96bb5
commit
c22857ca89
12
colorm.go
12
colorm.go
@ -15,6 +15,8 @@
|
||||
package ebiten
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"image/color"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/internal/affine"
|
||||
@ -35,6 +37,16 @@ type ColorM struct {
|
||||
impl *affine.ColorM
|
||||
}
|
||||
|
||||
// String returns a string representation of ColorM.
|
||||
func (c *ColorM) String() string {
|
||||
b, t := c.impl.UnsafeElements()
|
||||
return fmt.Sprintf("[[%f, %f, %f, %f, %f], [%f, %f, %f, %f, %f], [%f, %f, %f, %f, %f], [%f, %f, %f, %f, %f]]",
|
||||
b[0], b[4], b[8], b[12], t[0],
|
||||
b[1], b[5], b[9], b[13], t[1],
|
||||
b[2], b[6], b[10], b[14], t[2],
|
||||
b[3], b[7], b[11], b[15], t[3])
|
||||
}
|
||||
|
||||
// Reset resets the ColorM as identity.
|
||||
func (c *ColorM) Reset() {
|
||||
c.impl = nil
|
||||
|
8
geom.go
8
geom.go
@ -15,6 +15,8 @@
|
||||
package ebiten
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/internal/affine"
|
||||
)
|
||||
|
||||
@ -28,6 +30,12 @@ type GeoM struct {
|
||||
impl *affine.GeoM
|
||||
}
|
||||
|
||||
// String returns a string representation of GeoM.
|
||||
func (g *GeoM) String() string {
|
||||
a, b, c, d, tx, ty := g.impl.Elements()
|
||||
return fmt.Sprintf("[[%f, %f, %f], [%f, %f, %f]]", a, b, tx, c, d, ty)
|
||||
}
|
||||
|
||||
// Reset resets the GeoM as identity.
|
||||
func (g *GeoM) Reset() {
|
||||
g.impl = nil
|
||||
|
Loading…
Reference in New Issue
Block a user