mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
parent
fbeed96bb5
commit
c22857ca89
12
colorm.go
12
colorm.go
@ -15,6 +15,8 @@
|
|||||||
package ebiten
|
package ebiten
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"image/color"
|
"image/color"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/internal/affine"
|
"github.com/hajimehoshi/ebiten/internal/affine"
|
||||||
@ -35,6 +37,16 @@ type ColorM struct {
|
|||||||
impl *affine.ColorM
|
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.
|
// Reset resets the ColorM as identity.
|
||||||
func (c *ColorM) Reset() {
|
func (c *ColorM) Reset() {
|
||||||
c.impl = nil
|
c.impl = nil
|
||||||
|
8
geom.go
8
geom.go
@ -15,6 +15,8 @@
|
|||||||
package ebiten
|
package ebiten
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/internal/affine"
|
"github.com/hajimehoshi/ebiten/internal/affine"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,6 +30,12 @@ type GeoM struct {
|
|||||||
impl *affine.GeoM
|
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.
|
// Reset resets the GeoM as identity.
|
||||||
func (g *GeoM) Reset() {
|
func (g *GeoM) Reset() {
|
||||||
g.impl = nil
|
g.impl = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user