Skip to content

Instantly share code, notes, and snippets.

@henryscala
Created May 28, 2015 06:33
Show Gist options
  • Save henryscala/73b1f3786256d0088017 to your computer and use it in GitHub Desktop.
Save henryscala/73b1f3786256d0088017 to your computer and use it in GitHub Desktop.
using svgo to draw a logo in SVG format
package main
import (
"github.com/ajstarks/svgo"
"os"
"fmt"
)
/*width 50, height 50*/
func drawHeart(canvas *svg.SVG, x, y int ) {
apath := fmt.Sprintf("M%d %d q 0 25 25 50 q 25 -25 25 -50 q -25 -15 -25 15 q 0 -30 -25 -15",x,y)
canvas.Path(apath ,
`fill="none"`,`stroke="rgb(255,51,204)"`, `stroke-width="3"`)
}
func qinmishuLogo(){
width := 104
height := 64
canvas := svg.New(os.Stdout)
canvas.Start(width, height)
drawHeart(canvas,7,7)
drawHeart(canvas,47,7)
//canvas.Rect(0,0,width,height,`fill="none"`,`stroke="black"`)//draw borders
canvas.Text(width/2, height/2, "220~284", "text-anchor:middle;font-size:22px;fill:blue")
canvas.End()
}
func main() {
qinmishuLogo()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment