internal/affine/colorm.go
func (c *ColorM) Translate(r, g, b, a float32) *ColorM {
	if !c.isInited() {
		return &ColorM{
			translate: []float32{r, g, b, a},
		}
	}
	es := make([]float32, len(colorMIdentityTranslate))
	if c.translate != nil {
		copy(es, c.translate)
	}
	es[0] += r
	es[1] += g
	es[2] += b
	es[3] += a
	return &ColorM{
		body:      c.body,
		translate: es,
	}
}
func (c *ColorM) Translate(r, g, b, a float32) *ColorM {
	if !c.isInited() {
		return &ColorM{
			translate: []float32{r, g, b, a},
		}
	}
	es := make([]float32, len(colorMIdentityTranslate))
	if c.translate != nil {
		copy(es, c.translate)
	}
	es[0] += r
	es[1] += g
	es[2] += b
	es[3] += a
	return &ColorM{
		body:      c.body,
		translate: es,
	}
}
func ( c * ColorM ) Translate ( r , g , b , a float32 ) * ColorM { if ! c . isInited ( ) { return & ColorM { translate : [ ] float32 { r , g , b , a } , } } es := make ( [ ] float32 , len ( colorMIdentityTranslate ) ) if c . translate != nil { copy ( es , c . translate ) } es [ 0 ] += r es [ 1 ] += g es [ 2 ] += b es [ 3 ] += a return & ColorM { body : c . body , translate : es , } }
// Translate translates the matrix by (r, g, b, a).
Translate translates the matrix by ( r g b a ) .