当前位置: 首页>>代码示例>>Golang>>正文


Golang openvg.FillColor函数代码示例

本文整理汇总了Golang中github.com/ajstarks/openvg.FillColor函数的典型用法代码示例。如果您正苦于以下问题:Golang FillColor函数的具体用法?Golang FillColor怎么用?Golang FillColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FillColor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: moon

// moon shows the icon for clear weather at night
func (d *dimen) moon(bg, fg string) {
	x, y, w, h := d.x, d.y, d.width, d.height
	cx := x + w/2
	cy := y + h/2
	w2 := w / 2
	openvg.FillColor(fg)
	openvg.Circle(cx, cy, w2)
	openvg.FillColor(bg)
	openvg.Circle(x+w*0.65, cy, w2)
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:11,代码来源:twh.go

示例2: main

func main() {
	var color string
	openvg.Start(width, height)
	openvg.Background(200, 200, 200)
	for i := 0; i < niter; i++ {
		x := random(0, width)
		y := random(height/3, (height*2)/3)
		r := random(0, 10000)
		switch {
		case r >= 0 && r <= 2500:
			color = "white"
		case r > 2500 && r <= 5000:
			color = "maroon"
		case r > 5000 && r <= 7500:
			color = "gray"
		case r > 7500 && r <= 10000:
			color = "black"
		}
		openvg.FillColor(color, openvg.VGfloat(opacity))
		openvg.Circle(openvg.VGfloat(x), openvg.VGfloat(y), openvg.VGfloat(size))
	}
	openvg.End()
	bufio.NewReader(os.Stdin).ReadByte()
	openvg.Finish()
}
开发者ID:jhautefeuille,项目名称:openvg,代码行数:25,代码来源:bubtrail.go

示例3: drop

// drop shows the raindrop icon
func (d *dimen) drop(color string) {
	x, y, w, h := d.x, d.y, d.width, d.height
	openvg.FillColor(color)
	openvg.Ellipse(x+(w/2), y+(h*0.40), w*0.52, h*0.65)
	xp := []openvg.VGfloat{x + (w / 2), x + (w * 0.25), x + (w * 0.75)}
	yp := []openvg.VGfloat{y + h, y + (h / 2), y + (h / 2)}
	openvg.Polygon(xp, yp)
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:9,代码来源:twh.go

示例4: roundhand

func roundhand(cx, cy, px, py, stroke openvg.VGfloat, color string) {
	openvg.StrokeWidth(stroke)
	openvg.StrokeColor(color)
	openvg.Line(cx, cy, px, py)
	openvg.StrokeWidth(0)
	openvg.FillColor(color)
	openvg.Ellipse(px, py, stroke, stroke)
}
开发者ID:jhautefeuille,项目名称:openvg,代码行数:8,代码来源:clock.go

示例5: cloud

// cloud shows the cloudy icon
func (d *dimen) cloud(color string) {
	x, y, w, h := d.x, d.y, d.width, d.height
	radius := d.width / 3
	r2 := radius * 1.8
	openvg.FillColor(color)
	openvg.Circle(x+w*0.25, y+h*0.25, radius)
	openvg.Circle(x+w*0.30, y+h*0.45, radius)
	openvg.Circle(x+w*0.60, y+h*0.40, r2)
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:10,代码来源:twh.go

示例6: wind

// wind shows the windy icon
func (d *dimen) wind(bg, color string) {
	x, y, w, h := d.x, d.y, d.width, d.height
	openvg.FillColor(bg, 0)
	openvg.StrokeWidth(w / 25)
	openvg.StrokeColor(color)
	openvg.Qbezier(x+w*0.10, y+h*0.8, x+w*0.50, y+h*0.60, x+w*0.9, y+h*0.85)
	openvg.Qbezier(x+w*0.10, y+h*0.5, x+w*0.55, y+h*0.30, x+w*0.9, y+h*0.55)
	openvg.Qbezier(x+w*0.10, y+h*0.2, x+w*0.60, y+h*0.10, x+w*0.9, y+h*0.35)
	openvg.StrokeWidth(0)
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:11,代码来源:twh.go

示例7: secondhand

func secondhand(cx, cy, sx, sy, textsize openvg.VGfloat) {
	openvg.FillColor(secolor, 0.4)
	openvg.Ellipse(sx, sy, textsize, textsize)
	if secline {
		openvg.StrokeWidth(textsize / 6)
		openvg.StrokeColor(secolor)
		openvg.Line(cx, cy, sx, sy)
		openvg.StrokeWidth(0)
	}
}
开发者ID:jhautefeuille,项目名称:openvg,代码行数:10,代码来源:clock.go

示例8: face

func face(x, y, r openvg.VGfloat, ts int) {
	var fx, fy, va openvg.VGfloat
	va = openvg.VGfloat(ts) / 2.0
	secsize := openvg.VGfloat(ts) / 3
	radius := float64(r)
	ir := radius * 1.2
	// hour display
	openvg.FillColor(digitcolor)
	openvg.StrokeColor(digitcolor)
	openvg.StrokeWidth(5)
	for h := 12; h > 0; h-- {
		t := hourangles[h%12] * deg2rad
		fx = x + openvg.VGfloat(radius*math.Cos(t))
		fy = y + openvg.VGfloat(radius*math.Sin(t))
		ix := x + openvg.VGfloat(ir*math.Cos(t))
		iy := y + openvg.VGfloat(ir*math.Sin(t))
		if showdigits {
			openvg.TextMid(fx, fy-va, hourdigits[h%12], "sans", ts)
		} else {
			openvg.Line(fx, fy, ix, iy)
		}
	}
	// second display
	openvg.FillColor(dotcolor)
	openvg.StrokeColor(dotcolor)
	openvg.StrokeWidth(2)
	re := radius * edge
	for a := 0.0; a < 360; a += 6.0 {
		t := a * deg2rad
		sx := x + openvg.VGfloat(re*math.Cos(t))
		sy := y + openvg.VGfloat(re*math.Sin(t))
		if showdots {
			openvg.Ellipse(sx, sy, secsize, secsize)
		} else {
			ix := x + openvg.VGfloat(ir*math.Cos(t))
			iy := y + openvg.VGfloat(ir*math.Sin(t))
			openvg.Line(sx, sy, ix, iy)
		}
	}
	openvg.StrokeWidth(0)

}
开发者ID:jhautefeuille,项目名称:openvg,代码行数:42,代码来源:clock.go

示例9: countdown

// countdown shows a countdown display to the top of minute
func (d *display) countdown() {
	tick := time.NewTicker(1 * time.Second)
	ty := d.height / 2
	th := d.height / 20
	size := d.width / 70
	for delay := 60 - time.Now().Second(); delay > 0; delay-- {
		select {
		case <-tick.C:
			tx := d.width * (openvg.VGfloat(60-delay) / 60)
			openvg.BackgroundColor(d.bgcolor)
			openvg.FillColor("black")
			openvg.Rect(0, ty, d.width, th)
			openvg.FillColor("white")
			openvg.TextEnd(tx, ty+(th/4), fmt.Sprintf("start in %d ", delay), "sans", int(size))
			openvg.Rect(tx, ty, d.width-tx, th)
			openvg.End()
		}
	}
	openvg.BackgroundColor(d.bgcolor)
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:21,代码来源:twh.go

示例10: arrowhand

func arrowhand(cx, cy, px, py, r openvg.VGfloat, t float64, value int, color string) {
	ax := []openvg.VGfloat{cx, 0, px, 0, cx}
	ay := []openvg.VGfloat{cy, 0, py, 0, cy}
	t = minadjust(t, value) * deg2rad
	rf := float64(r * 0.9)
	tf := math.Pi / 45.0
	ax[1] = cx + openvg.VGfloat(rf*math.Cos(t-tf))
	ay[1] = cy + openvg.VGfloat(rf*math.Sin(t-tf))
	ax[3] = cx + openvg.VGfloat(rf*math.Cos(t+tf))
	ay[3] = cy + openvg.VGfloat(rf*math.Sin(t+tf))
	openvg.FillColor(color)
	openvg.Polygon(ax, ay)
}
开发者ID:jhautefeuille,项目名称:openvg,代码行数:13,代码来源:clock.go

示例11: planets

//planets is an exploration of scale
func planets(width, height int, message string) {

	w := float64(width)
	h := float64(height)
	y := h / 2

	margin := 100.0
	minsize := 7.0
	labeloc := 100.0
	bgcolor := "black"
	labelcolor := "white"
	maxsize := (h / 2) * 0.05

	origin := sun.distance
	mostDistant := neptune.distance
	firstSize := mercury.radius
	lastSize := neptune.radius

	openvg.Start(width, height)
	openvg.BackgroundColor(bgcolor)

	for _, p := range SolarSystem {
		x := vmap(p.distance, origin, mostDistant, margin, w-margin)
		r := vmap(p.radius, firstSize, lastSize, minsize, maxsize)

		if p.name == "Sun" {
			openvg.FillRGB(p.color.Red, p.color.Green, p.color.Blue, 1)
			openvg.Circle(margin-(r/2), y, r)
		} else {
			light(x, y, r, p.color)
			openvg.Circle(x, y, r)
			if p.name == "Saturn" {
				ringwidth := r * 2.35 // Saturn's rings are over 2x the planet radius
				openvg.StrokeWidth(3)
				openvg.StrokeRGB(p.color.Red, p.color.Green, p.color.Blue, 1)
				openvg.Line((x - ringwidth/2), y, (x + ringwidth/2), y)
				openvg.StrokeWidth(0)
			}
		}
		if p.name == "Earth" && len(message) > 1 {
			openvg.StrokeColor(labelcolor)
			openvg.StrokeWidth(1)
			openvg.Line(x, y+(r/2), x, y+labeloc)
			openvg.StrokeWidth(0)
			openvg.FillColor(labelcolor)
			openvg.TextMid(x, y+labeloc+10, message, "sans", 12)
		}
	}
	openvg.End()
}
开发者ID:sequoiar,项目名称:openvg,代码行数:51,代码来源:shapedemo.go

示例12: main

// main plots data from specified files or standard input in a
// grid where plotc specifies the number of columns.
func main() {
	w, h := openvg.Init()
	openvg.Start(w, h)
	openvg.FillColor("white")
	openvg.Rect(0, 0, gwidth, gheight)
	filenames := flag.Args()
	if len(filenames) == 0 {
		doplot(beginx, beginy, "")
	} else {
		plotgrid(beginx, beginy, filenames)
	}
	openvg.SaveEnd("vgplot.raw")
	bufio.NewReader(os.Stdin).ReadByte()
	openvg.Finish()
}
开发者ID:sequoiar,项目名称:openvg,代码行数:17,代码来源:vgplot.go

示例13: combohand

func combohand(cx, cy, px, py, r, stroke openvg.VGfloat, t float64, value int, color string) {
	thinr := float64(r * 0.25)
	t = minadjust(t, value) * deg2rad
	tx := cx + openvg.VGfloat(thinr*math.Cos(t))
	ty := cy + openvg.VGfloat(thinr*math.Sin(t))
	openvg.FillColor(color)
	openvg.Ellipse(px, py, stroke*2, stroke*2)
	openvg.Ellipse(tx, ty, stroke*2, stroke*2)
	openvg.StrokeWidth(stroke)
	openvg.StrokeColor(color)
	openvg.Line(cx, cy, tx, ty)
	openvg.StrokeWidth(stroke * 2)
	openvg.Line(tx, ty, px, py)
	openvg.StrokeWidth(0)
}
开发者ID:jhautefeuille,项目名称:openvg,代码行数:15,代码来源:clock.go

示例14: main

func main() {

	width, height := openvg.Init()

	w := openvg.VGfloat(width)
	h := openvg.VGfloat(height)
	y := h / 2
	var (
		margin  openvg.VGfloat = 100.0
		minsize openvg.VGfloat = 7.0
		labeloc openvg.VGfloat = 100.0
	)
	bgcolor := "black"
	labelcolor := "white"
	maxsize := (h / 2) * 0.05

	origin := sun.distance
	mostDistant := neptune.distance
	firstSize := mercury.radius
	lastSize := neptune.radius

	openvg.Start(width, height)
	openvg.BackgroundColor(bgcolor)

	for _, p := range solarSystem {
		x := vmap(p.distance, origin, mostDistant, margin, w-margin)
		r := vmap(p.radius, firstSize, lastSize, minsize, maxsize)

		if p.name == "Sun" {
			openvg.FillRGB(p.color.Red, p.color.Green, p.color.Blue, 1)
			openvg.Circle(margin-(r/2), y, r)
		} else {
			light(x, y, r, p.color)
			openvg.Circle(x, y, r)
		}
		if p.name == "Earth" && len(os.Args) > 1 {
			openvg.StrokeColor(labelcolor)
			openvg.StrokeWidth(1)
			openvg.Line(x, y+(r/2), x, y+labeloc)
			openvg.StrokeWidth(0)
			openvg.FillColor(labelcolor)
			openvg.TextMid(x, y+labeloc+10, os.Args[1], "sans", 12)
		}
	}
	openvg.End()
	bufio.NewReader(os.Stdin).ReadByte()
	openvg.Finish()
}
开发者ID:jhautefeuille,项目名称:openvg,代码行数:48,代码来源:planets.go

示例15: main

func main() {
	width, height := openvg.Init() // OpenGL, etc initialization

	w2 := float64(width / 2)
	h2 := float64(height / 2)
	w := float64(width)

	openvg.Start(width, height)                               // Start the picture
	openvg.BackgroundColor("black")                           // Black background
	openvg.FillRGB(44, 77, 232, 1)                            // Big blue marble
	openvg.Circle(w2, 0, w)                                   // The "world"
	openvg.FillColor("white")                                 // White text
	openvg.TextMid(w2, h2, "hello, world", "serif", width/10) // Greetings
	openvg.SaveEnd("hello.raw")                               // End the picture
	bufio.NewReader(os.Stdin).ReadBytes('\n')                 // Pause until [RETURN]
	openvg.Finish()                                           // Graphics cleanup
}
开发者ID:xranby,项目名称:openvg,代码行数:17,代码来源:hellovg.go


注:本文中的github.com/ajstarks/openvg.FillColor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。