diff --git a/colorm.go b/colorm.go index a2bfd6ccd..16addf0ff 100644 --- a/colorm.go +++ b/colorm.go @@ -83,10 +83,12 @@ func (c *ColorM) Scale(r, g, b, a float64) { if !c.initialized { *c = colorMI } - c.es[0][0] *= r - c.es[1][1] *= g - c.es[2][2] *= b - c.es[3][3] *= a + for i := 0; i < ColorMDim; i++ { + c.es[0][i] *= r + c.es[1][i] *= g + c.es[2][i] *= b + c.es[3][i] *= a + } } func (c *ColorM) Translate(r, g, b, a float64) { diff --git a/geom.go b/geom.go index 2ec8d2294..d2ce3833a 100644 --- a/geom.go +++ b/geom.go @@ -76,8 +76,10 @@ func (g *GeoM) Scale(x, y float64) { if !g.initialized { *g = geoMI } - g.es[0][0] *= x - g.es[1][1] *= y + for i := 0; i < GeoMDim; i++ { + g.es[0][i] *= x + g.es[1][i] *= y + } } func (g *GeoM) Translate(tx, ty float64) {