Esempio n. 1
0
func android(gc draw2d.GraphicContext, x, y float64) {
	gc.SetLineCap(draw2d.RoundCap)
	gc.SetLineWidth(5)
	gc.ArcTo(x+80, y+70, 50, 50, 180*(math.Pi/180), 360*(math.Pi/180)) // head
	gc.FillStroke()
	gc.MoveTo(x+60, y+25)
	gc.LineTo(x+50, y+10)
	gc.MoveTo(x+100, y+25)
	gc.LineTo(x+110, y+10)
	gc.Stroke()
	draw2d.Circle(gc, x+60, y+45, 5) // left eye
	gc.FillStroke()
	draw2d.Circle(gc, x+100, y+45, 5) // right eye
	gc.FillStroke()
	draw2d.RoundRect(gc, x+30, y+75, x+30+100, y+75+90, 10, 10) // body
	gc.FillStroke()
	draw2d.Rect(gc, x+30, y+75, x+30+100, y+75+80)
	gc.FillStroke()
	draw2d.RoundRect(gc, x+5, y+80, x+5+20, y+80+70, 10, 10) // left arm
	gc.FillStroke()
	draw2d.RoundRect(gc, x+135, y+80, x+135+20, y+80+70, 10, 10) // right arm
	gc.FillStroke()
	draw2d.RoundRect(gc, x+50, y+150, x+50+20, y+150+50, 10, 10) // left leg
	gc.FillStroke()
	draw2d.RoundRect(gc, x+90, y+150, x+90+20, y+150+50, 10, 10) // right leg
	gc.FillStroke()
}
Esempio n. 2
0
func (d *Display) Draw(x, y, r float64, c color.Color) {
	d.gc.SetStrokeColor(c)
	d.gc.SetFillColor(c)
	draw2d.Circle(d.gc, x+d.bord, d.head+d.bord+d.h-y, r)
	d.gc.FillStroke()
	d.ximg.XDraw()
}
Esempio n. 3
0
// Defines the visualization of the figure according to position (0, 0).
func (this *Circle) Visualize() {
	graphicContext := GetTheImageGraphicContext()
	draw2d.Circle(graphicContext, 0, 0, this.Radius)
}
Esempio n. 4
0
func gordon(gc draw2d.GraphicContext, x, y, w, h float64) {
	h23 := (h * 2) / 3

	blf := color.RGBA{0, 0, 0, 0xff}
	wf := color.RGBA{0xff, 0xff, 0xff, 0xff}
	nf := color.RGBA{0x8B, 0x45, 0x13, 0xff}
	brf := color.RGBA{0x8B, 0x45, 0x13, 0x99}
	brb := color.RGBA{0x8B, 0x45, 0x13, 0xBB}

	gc.MoveTo(x, y+h)
	gc.CubicCurveTo(x, y+h, x+w/2, y-h, x+w, y+h)
	gc.Close()
	gc.SetFillColor(brb)
	gc.Fill()
	draw2d.RoundRect(gc, x, y+h, x+w, y+h+h, 10, 10)
	gc.Fill()
	draw2d.Circle(gc, x, y+h, w/12) // left ear
	gc.SetFillColor(brf)
	gc.Fill()
	draw2d.Circle(gc, x, y+h, w/12-10)
	gc.SetFillColor(nf)
	gc.Fill()

	draw2d.Circle(gc, x+w, y+h, w/12) // right ear
	gc.SetFillColor(brf)
	gc.Fill()
	draw2d.Circle(gc, x+w, y+h, w/12-10)
	gc.SetFillColor(nf)
	gc.Fill()

	draw2d.Circle(gc, x+w/3, y+h23, w/9) // left eye
	gc.SetFillColor(wf)
	gc.Fill()
	draw2d.Circle(gc, x+w/3+10, y+h23, w/10-10)
	gc.SetFillColor(blf)
	gc.Fill()
	draw2d.Circle(gc, x+w/3+15, y+h23, 5)
	gc.SetFillColor(wf)
	gc.Fill()

	draw2d.Circle(gc, x+w-w/3, y+h23, w/9) // right eye
	gc.Fill()
	draw2d.Circle(gc, x+w-w/3+10, y+h23, w/10-10)
	gc.SetFillColor(blf)
	gc.Fill()
	draw2d.Circle(gc, x+w-(w/3)+15, y+h23, 5)
	gc.SetFillColor(wf)
	gc.Fill()

	gc.SetFillColor(wf)
	draw2d.RoundRect(gc, x+w/2-w/8, y+h+30, x+w/2-w/8+w/8, y+h+30+w/6, 5, 5) // left tooth
	gc.Fill()
	draw2d.RoundRect(gc, x+w/2, y+h+30, x+w/2+w/8, y+h+30+w/6, 5, 5) // right tooth
	gc.Fill()

	draw2d.Ellipse(gc, x+(w/2), y+h+30, w/6, w/12) // snout
	gc.SetFillColor(nf)
	gc.Fill()
	draw2d.Ellipse(gc, x+(w/2), y+h+10, w/10, w/12) // nose
	gc.SetFillColor(blf)
	gc.Fill()

}