affine: Refactoring

This commit is contained in:
Hajime Hoshi 2017-09-16 15:49:12 +09:00
parent 05d91eac09
commit 803aa77c20
4 changed files with 18 additions and 48 deletions

View File

@ -92,15 +92,21 @@ func Monochrome() ColorM {
// ScaleColor is deprecated as of 1.2.0-alpha. Use Scale instead.
func ScaleColor(r, g, b, a float64) ColorM {
return ColorM{affine.ScaleColor(r, g, b, a)}
c := ColorM{}
c.Scale(r, g, b, a)
return c
}
// TranslateColor is deprecated as of 1.2.0-alpha. Use Translate instead.
func TranslateColor(r, g, b, a float64) ColorM {
return ColorM{affine.TranslateColor(r, g, b, a)}
c := ColorM{}
c.Translate(r, g, b, a)
return c
}
// RotateHue is deprecated as of 1.2.0-alpha. Use RotateHue member function instead.
func RotateHue(theta float64) ColorM {
return ColorM{affine.RotateHue(theta)}
c := ColorM{}
c.RotateHue(theta)
return c
}

12
geom.go
View File

@ -88,15 +88,21 @@ func (g *GeoM) SetElement(i, j int, element float64) {
// ScaleGeo is deprecated as of 1.2.0-alpha. Use Scale instead.
func ScaleGeo(x, y float64) GeoM {
return GeoM{affine.ScaleGeo(x, y)}
g := GeoM{}
g.Scale(x, y)
return g
}
// TranslateGeo is deprecated as of 1.2.0-alpha. Use Translate instead.
func TranslateGeo(tx, ty float64) GeoM {
return GeoM{affine.TranslateGeo(tx, ty)}
g := GeoM{}
g.Translate(tx, ty)
return g
}
// RotateGeo is deprecated as of 1.2.0-alpha. Use Rotate instead.
func RotateGeo(theta float64) GeoM {
return GeoM{affine.RotateGeo(theta)}
g := GeoM{}
g.Rotate(theta)
return g
}

View File

@ -211,24 +211,3 @@ func init() {
func Monochrome() ColorM {
return monochrome
}
// ScaleColor is deprecated as of 1.2.0-alpha. Use Scale instead.
func ScaleColor(r, g, b, a float64) ColorM {
c := ColorM{}
c.Scale(r, g, b, a)
return c
}
// TranslateColor is deprecated as of 1.2.0-alpha. Use Translate instead.
func TranslateColor(r, g, b, a float64) ColorM {
c := ColorM{}
c.Translate(r, g, b, a)
return c
}
// RotateHue is deprecated as of 1.2.0-alpha. Use RotateHue member function instead.
func RotateHue(theta float64) ColorM {
c := ColorM{}
c.RotateHue(theta)
return c
}

View File

@ -169,24 +169,3 @@ func (g *GeoM) Rotate(theta float64) {
g.d = sin*b + cos*d
g.ty = sin*tx + cos*ty
}
// ScaleGeo is deprecated as of 1.2.0-alpha. Use Scale instead.
func ScaleGeo(x, y float64) GeoM {
g := GeoM{}
g.Scale(x, y)
return g
}
// TranslateGeo is deprecated as of 1.2.0-alpha. Use Translate instead.
func TranslateGeo(tx, ty float64) GeoM {
g := GeoM{}
g.Translate(tx, ty)
return g
}
// RotateGeo is deprecated as of 1.2.0-alpha. Use Rotate instead.
func RotateGeo(theta float64) GeoM {
g := GeoM{}
g.Rotate(theta)
return g
}