package vg
import (
"image"
"image/color"
"gonum.org/v1/plot/font"
)
func MultiCanvas (cs ...Canvas ) Canvas {
return teeCanvas {cs }
}
type teeCanvas struct {
cs []Canvas
}
func (tee teeCanvas ) SetLineWidth (w Length ) {
for _ , c := range tee .cs {
c .SetLineWidth (w )
}
}
func (tee teeCanvas ) SetLineDash (pattern []Length , offset Length ) {
for _ , c := range tee .cs {
c .SetLineDash (pattern , offset )
}
}
func (tee teeCanvas ) SetColor (c color .Color ) {
for _ , canvas := range tee .cs {
canvas .SetColor (c )
}
}
func (tee teeCanvas ) Rotate (rad float64 ) {
for _ , c := range tee .cs {
c .Rotate (rad )
}
}
func (tee teeCanvas ) Translate (pt Point ) {
for _ , c := range tee .cs {
c .Translate (pt )
}
}
func (tee teeCanvas ) Scale (x , y float64 ) {
for _ , c := range tee .cs {
c .Scale (x , y )
}
}
func (tee teeCanvas ) Push () {
for _ , c := range tee .cs {
c .Push ()
}
}
func (tee teeCanvas ) Pop () {
for _ , c := range tee .cs {
c .Pop ()
}
}
func (tee teeCanvas ) Stroke (p Path ) {
for _ , c := range tee .cs {
c .Stroke (p )
}
}
func (tee teeCanvas ) Fill (p Path ) {
for _ , c := range tee .cs {
c .Fill (p )
}
}
func (tee teeCanvas ) FillString (f font .Face , pt Point , text string ) {
for _ , c := range tee .cs {
c .FillString (f , pt , text )
}
}
func (tee teeCanvas ) DrawImage (rect Rectangle , img image .Image ) {
for _ , c := range tee .cs {
c .DrawImage (rect , img )
}
}
var _ Canvas = (*teeCanvas )(nil )
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .