mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
Rename *MatrixI -> New*Matrix
This commit is contained in:
parent
f7b2157585
commit
d53d55a629
@ -32,8 +32,8 @@ type ColorMatrix struct {
|
||||
es [ColorMatrixDim - 1][ColorMatrixDim]float64
|
||||
}
|
||||
|
||||
// ColorMatrixI returns an identity color matrix.
|
||||
func ColorMatrixI() ColorMatrix {
|
||||
// NewColorMatrix returns an identity color matrix.
|
||||
func NewColorMatrix() ColorMatrix {
|
||||
return ColorMatrix{
|
||||
[ColorMatrixDim - 1][ColorMatrixDim]float64{
|
||||
{1, 0, 0, 0, 0},
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func TestColorIdentity(t *testing.T) {
|
||||
m := ColorMatrixI()
|
||||
m := NewColorMatrix()
|
||||
got := m.IsIdentity()
|
||||
want := true
|
||||
if want != got {
|
||||
|
@ -27,8 +27,8 @@ type GeometryMatrix struct {
|
||||
es [GeometryMatrixDim - 1][GeometryMatrixDim]float64
|
||||
}
|
||||
|
||||
// GeometryMatrixI returns an identity geometry matrix.
|
||||
func GeometryMatrixI() GeometryMatrix {
|
||||
// NewGeometryMatrix returns an identity geometry matrix.
|
||||
func NewGeometryMatrix() GeometryMatrix {
|
||||
return GeometryMatrix{
|
||||
[GeometryMatrixDim - 1][GeometryMatrixDim]float64{
|
||||
{1, 0, 0},
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGeometryIdentity(t *testing.T) {
|
||||
m := GeometryMatrixI()
|
||||
m := NewGeometryMatrix()
|
||||
got := m.IsIdentity()
|
||||
want := true
|
||||
if want != got {
|
||||
|
@ -67,7 +67,7 @@ func (c *graphicsContext) postUpdate() error {
|
||||
|
||||
scale := float64(c.screenScale)
|
||||
geo := ScaleGeometry(scale, scale)
|
||||
clr := ColorMatrixI()
|
||||
clr := NewColorMatrix()
|
||||
option := &DrawImageOptions{
|
||||
GeometryMatrix: &geo,
|
||||
ColorMatrix: &clr,
|
||||
|
16
image.go
16
image.go
@ -69,12 +69,12 @@ func (i *innerImage) drawImage(img *innerImage, options *DrawImageOptions) error
|
||||
}
|
||||
geo := options.GeometryMatrix
|
||||
if geo == nil {
|
||||
i := GeometryMatrixI()
|
||||
i := NewGeometryMatrix()
|
||||
geo = &i
|
||||
}
|
||||
clr := options.ColorMatrix
|
||||
if clr == nil {
|
||||
i := ColorMatrixI()
|
||||
i := NewColorMatrix()
|
||||
clr = &i
|
||||
}
|
||||
|
||||
@ -155,10 +155,16 @@ func (i *Image) Fill(clr color.Color) (err error) {
|
||||
}
|
||||
|
||||
// DrawImage draws the given image on the receiver image.
|
||||
// This method accepts the parts of the given image at the parts of the destination as the options.
|
||||
// After determining parts to draw, this applies the geometry matrix and the color matrix as the options.
|
||||
//
|
||||
// If you want to draw a whole image simply, use DrawWholeImage.
|
||||
// This method accepts the options.
|
||||
// The parts of the given image at the parts of the destination.
|
||||
// After determining parts to draw, this applies the geometry matrix and the color matrix.
|
||||
//
|
||||
// If options is nil or its members are nil, the default values are used.
|
||||
// DstParts: (0, 0) - (source width, source height)
|
||||
// SrcParts: (0, 0) - (source width, source height) (i.e. the whole source image)
|
||||
// GeometryMatrix: Identity matrix
|
||||
// ColorMatrix: Identity matrix (that changes no colors)
|
||||
func (i *Image) DrawImage(image *Image, options *DrawImageOptions) (err error) {
|
||||
return i.drawImage(image.inner, options)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user