• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang openvg.FillRGB函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

func main() {
	var cx, cy, cw, ch, midy int
	message := "Now is the time for all good men to come to the aid of the party"

	w, h := openvg.Init()
	var speed openvg.VGfloat = 0.5
	var x openvg.VGfloat = 0
	midy = (h / 2)
	fontsize := w / 50
	cx = 0
	ch = fontsize * 2
	cw = w
	cy = midy - (ch / 2)

	rx, ry, rw, rh := openvg.VGfloat(cx), openvg.VGfloat(cy), openvg.VGfloat(cw), openvg.VGfloat(ch)
	// scroll the text, only in the clipping rectangle
	for x = 0; x < rw+speed; x += speed {
		openvg.Start(w, h)
		openvg.Background(255, 255, 255)
		openvg.FillRGB(0, 0, 0, .2)
		openvg.Rect(rx, ry, rw, rh)
		openvg.ClipRect(cx, cy, cw, ch)
		openvg.Translate(x, ry+openvg.VGfloat(fontsize/2))
		openvg.FillRGB(0, 0, 0, 1)
		openvg.Text(0, 0, message, "sans", fontsize)
		openvg.ClipEnd()
		openvg.End()
	}
	bufio.NewReader(os.Stdin).ReadBytes('\n')
	openvg.Finish()
	os.Exit(0)
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:32,代码来源:clip.go


示例2: rshapes

// rshapes draws shapes with random colors, openvg.Strokes, and sizes.
func rshapes(width, height, n int) {

	var sx, sy, cx, cy, px, py, ex, ey, pox, poy openvg.VGfloat

	np := 10
	polyx := make([]openvg.VGfloat, np)
	polyy := make([]openvg.VGfloat, np)
	openvg.Start(width, height)
	for i := 0; i < n; i++ {
		openvg.FillRGB(randcolor(), randcolor(), randcolor(), openvg.VGfloat(rand.Float32()))
		openvg.Ellipse(randf(width), randf(height), randf(200), randf(100))
		openvg.Circle(randf(width), randf(height), randf(100))
		openvg.Rect(randf(width), randf(height), randf(200), randf(100))
		openvg.Arc(randf(width), randf(height), randf(200), randf(200), randf(360), randf(360))

		sx = randf(width)
		sy = randf(height)
		openvg.StrokeRGB(randcolor(), randcolor(), randcolor(), 1)
		openvg.StrokeWidth(randf(5))
		openvg.Line(sx, sy, sx+randf(200), sy+randf(100))
		openvg.StrokeWidth(0)

		sx = randf(width)
		sy = randf(height)
		ex = sx + randf(200)
		ey = sy
		cx = sx + ((ex - sx) / 2.0)
		cy = sy + randf(100)
		openvg.Qbezier(sx, sy, cx, cy, ex, ey)

		sx = randf(width)
		sy = randf(height)
		ex = sx + randf(200)
		ey = sy
		cx = sx + ((ex - sx) / 2.0)
		cy = sy + randf(100)
		px = cx
		py = sy - randf(100)
		openvg.Cbezier(sx, sy, cx, cy, px, py, ex, ey)

		pox = randf(width)
		poy = randf(height)
		for j := 0; j < np; j++ {
			polyx[j] = pox + randf(200)
			polyy[j] = poy + randf(100)
		}
		openvg.Polygon(polyx, polyy) // , np)

		pox = randf(width)
		poy = randf(height)
		for j := 0; j < np; j++ {
			polyx[j] = pox + randf(200)
			polyy[j] = poy + randf(100)
		}
		openvg.Polyline(polyx, polyy) // , np)
	}
	openvg.FillRGB(128, 0, 0, 1)
	openvg.Text(20, 20, "OpenVG on the Raspberry Pi", "sans", 32)
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:61,代码来源:shapedemo.go


示例3: tb

// tb draws a block of text
func tb(w, h int) {
	para := []string{
		"For lo,",
		"the winter is past,",
		"the rain is over and gone",
		"the flowers appear on the earth;",
		"the time for the singing of birds is come,",
		"and the voice of the turtle is heard in our land",
	}

	tmargin := openvg.VGfloat(w) * 0.50
	lmargin := openvg.VGfloat(w) * 0.10
	top := openvg.VGfloat(h) * .9
	mid := openvg.VGfloat(h) * .6
	bot := openvg.VGfloat(h) * .3

	fontsize := 24
	leading := openvg.VGfloat(40.0)
	lfontsize := fontsize * 2
	midb := ((leading * 2) + (leading / 2)) - openvg.VGfloat(lfontsize/2)

	openvg.Start(w, h)
	openvg.FillRGB(49, 79, 79, 1)
	textlines(tmargin, top, para, "serif", fontsize, leading)
	textlines(tmargin, mid, para, "sans", fontsize, leading)
	textlines(tmargin, bot, para, "mono", fontsize, leading)
	openvg.Text(lmargin, top-midb, "Serif", "sans", lfontsize)
	openvg.Text(lmargin, mid-midb, "Sans", "sans", lfontsize)
	openvg.Text(lmargin, bot-midb, "Mono", "sans", lfontsize)
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:32,代码来源:shapedemo.go


示例4: showgrid

// showgrid xrays a slide
func showgrid(d deck.Deck, n int, p float64) {
	w := openvg.VGfloat(d.Canvas.Width)
	h := openvg.VGfloat(d.Canvas.Height)
	percent := openvg.VGfloat(p)
	fs := (w / 100) // labels are 1% of the width
	xpct := (percent / 100.0) * w
	ypct := (percent / 100.0) * h

	openvg.StrokeColor("lightgray", 0.5)
	openvg.StrokeWidth(3)

	// horizontal gridlines
	xl := percent
	for x := xpct; x <= w; x += xpct {
		openvg.Line(x, 0, x, h)
		openvg.Text(x, percent, fmt.Sprintf("%.0f%%", xl), "sans", int(fs))
		xl += percent
	}

	// vertical gridlines
	yl := percent
	for y := ypct; y <= h; y += ypct {
		openvg.Line(0, y, w, y)
		openvg.Text(percent, y, fmt.Sprintf("%.0f%%", yl), "sans", int(fs))
		yl += percent
	}

	// show boundary and location of images
	if n < 0 || n > len(d.Slide) {
		return
	}
	for _, im := range d.Slide[n].Image {
		x := pct(im.Xp, w)
		y := pct(im.Yp, h)
		iw := openvg.VGfloat(im.Width)
		ih := openvg.VGfloat(im.Height)
		if im.Scale > 0 {
			iw *= openvg.VGfloat(im.Scale / 100)
			ih *= openvg.VGfloat(im.Scale / 100)
		}
		openvg.FillRGB(127, 0, 0, 0.3)
		openvg.Circle(x, y, fs)
		openvg.FillRGB(255, 0, 0, 0.1)
		openvg.Rect(x-iw/2, y-ih/2, iw, ih)
	}
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:48,代码来源:xmlview.go


示例5: paintBG

func paintBG(w, h openvg.VGfloat) {
	if !showTrails {
		openvg.Background(0, 0, 0)
		return
	}
	openvg.FillRGB(0, 0, 0, 0.3)
	openvg.Rect(0, 0, w, h)
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:8,代码来源:particles.go


示例6: imagetable

func imagetable(w, h int) {
	imgw, imgh := 422, 238
	itable := []it{
		{"desert0.jpg", imgw, imgh},
		{"desert1.jpg", imgw, imgh},
		{"desert2.jpg", imgw, imgh},
		{"desert3.jpg", imgw, imgh},
		{"desert4.jpg", imgw, imgh},
		{"desert5.jpg", imgw, imgh},
		{"desert6.jpg", imgw, imgh},
		{"desert7.jpg", imgw, imgh},
		//{"http://farm4.static.flickr.com/3546/3338566612_9c56bfb53e_m.jpg", 240, 164},
		//{"http://farm4.static.flickr.com/3642/3337734413_e36baba755_m.jpg", 240, 164},
	}
	offset := openvg.VGfloat(50)
	left := offset
	bot := openvg.VGfloat(h-imgh) - offset
	gutter := offset
	x := left
	y := bot
	openvg.Start(w, h)
	openvg.BackgroundColor("black")
	for _, iname := range itable {
		openvg.Image(x, y, iname.width, iname.height, iname.name)
		openvg.FillRGB(255, 255, 255, 0.3)
		openvg.Rect(x, y, openvg.VGfloat(imgw), 32)
		openvg.FillRGB(0, 0, 0, 1)
		openvg.TextMid(x+openvg.VGfloat(imgw/2), y+10, iname.name, "sans", 16)
		x += openvg.VGfloat(iname.width) + gutter
		if x > openvg.VGfloat(w) {
			x = left
			y -= openvg.VGfloat(iname.height) + gutter
		}
	}
	y = openvg.VGfloat(h) * 0.1
	openvg.FillRGB(128, 128, 128, 1)
	openvg.TextMid(openvg.VGfloat(w/2), 100, "Joshua Tree National Park", "sans", 48)
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:39,代码来源:shapedemo.go


示例7: raspi

// raspberry pi, scaled to the screen dimensions
func raspi(w, h int, s string) {
	midx := openvg.VGfloat(w) / 2
	midy := openvg.VGfloat(h) / 2
	rw := midx
	rh := (rw * 2) / 3
	fontsize := w / 25
	openvg.Start(w, h)
	openvg.Background(255, 255, 255)
	makepi(midx-(rw/2), midy-(rh/2), rw, rh)
	openvg.FillRGB(128, 0, 0, 1)
	openvg.TextMid(midx, midy-(rh/2)-openvg.VGfloat(fontsize*2), s, "sans", fontsize)
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:14,代码来源:shapedemo.go


示例8: planets

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

	w := openvg.VGfloat(width)
	h := openvg.VGfloat(height)
	y := h / 2

	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 == "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:Ebiroll,项目名称:openvg,代码行数:51,代码来源:shapedemo.go


示例9: draw

func draw(w, h openvg.VGfloat) {
	paintBG(w, h)

	var p particle
	var grav = openvg.VGfloat(gravity)
	for i := 0; i < nparticles; i++ {
		p = particles[i]
		openvg.FillRGB(p.r, p.g, p.b, 1)
		openvg.Circle(p.x, p.y, p.radius)

		// Apply the velocity
		p.x += p.vx
		p.y += p.vy

		p.vx *= 0.98
		if p.vy > 0 {
			p.vy *= 0.97
		}

		// Gravity
		p.vy -= grav

		// Stop p leaving the canvas
		if p.x < -50 {
			p.x = w + 50
		}
		if p.x > w+50 {
			p.x = -50
		}

		// When particle reaches the bottom of screen reset velocity & start posn
		if p.y < -50 {
			p.x = 0
			p.y = 0
			p.vx = openvg.VGfloat(rand.Intn(maxrand)%30) + 30
			p.vy = openvg.VGfloat(rand.Intn(maxrand)%20) + 40

			if directionRTL {
				p.vx *= -1
				p.x = w
			}
		}

		if p.y > h+50 {
			p.y = -50
		}
		particles[i] = p
	}
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:50,代码来源:particles.go


示例10: advert

// advert is an ad for the package
func advert(w, h int) {
	y := openvg.VGfloat(h) / 4
	fontsize := (w * 4) / 100
	f3 := fontsize / 3
	s := "github.com/ajstarks/openvg"
	a := "[email protected]"

	imw := 110
	imh := 110
	rw := openvg.VGfloat(w / 4)
	rh := (rw * 2) / 3
	midx := openvg.VGfloat(w / 2)

	openvg.Start(w, h)
	makepi(midx-openvg.VGfloat(rw/2), openvg.VGfloat(h/2), rw, rh)
	openvg.FillRGB(128, 0, 0, 1)
	openvg.TextMid(midx, y-openvg.VGfloat(fontsize/4), s, "sans", fontsize)
	y -= 100
	openvg.FillRGB(128, 128, 128, 1)
	openvg.TextMid(midx, y, a, "sans", f3)
	openvg.Image(openvg.VGfloat(w/2)-openvg.VGfloat(imw/2), 20, imw, imh, "starx.jpg")
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:24,代码来源:shapedemo.go


示例11: fontrange

// fontrange shows a range of fonts
func fontrange(w, h int) {
	var x, lx, length openvg.VGfloat
	y := openvg.VGfloat(h) / 2.0
	w2 := openvg.VGfloat(w) / 2.0
	spacing := openvg.VGfloat(50.0)
	s2 := spacing / 2.0
	sizes := []int{6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 21, 24, 36, 48, 60, 72, 96}

	openvg.Start(w, h)
	openvg.Background(255, 255, 255)

	// compute the length so we can center
	length = 0.0
	for _, s := range sizes {
		length += openvg.VGfloat(s) + spacing
	}
	length -= spacing
	lx = w2 - (length / 2) // center point

	// for each size, display a character and label
	x = lx
	for _, s := range sizes {
		openvg.FillRGB(128, 0, 0, 1)
		openvg.TextMid(x, y, "a", "serif", s)
		openvg.FillRGB(128, 128, 128, 1)
		openvg.TextMid(x, y-spacing, fmt.Sprintf("%d", s), "sans", 16)
		x += openvg.VGfloat(s) + spacing
	}
	// draw a openvg.Line below the characters, a curve above
	x -= spacing
	openvg.StrokeRGB(150, 150, 150, 0.5)
	openvg.StrokeWidth(2)
	openvg.Line(lx, y-s2, x, y-s2)
	openvg.FillRGB(255, 255, 255, 1)
	openvg.Qbezier(lx, y+s2, x, y+s2, x, y+(spacing*3))
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:38,代码来源:shapedemo.go


示例12: main

// raspberry pi, scaled to the screen dimensions
func main() {
	w, h := openvg.Init()
	midx := openvg.VGfloat(w) / 2
	midy := openvg.VGfloat(h) / 2
	rw := midx
	rh := (rw * 2) / 3
	fontsize := w / 25
	openvg.Start(w, h)
	openvg.Background(255, 255, 255)
	makepi(midx-(rw/2), midy-(rh/2), rw, rh)
	makepi(200, 100, 75, 50)
	openvg.FillRGB(128, 0, 0, 1)
	openvg.TextMid(midx, midy-(rh/2)-openvg.VGfloat(fontsize*2), "The Raspberry Pi", "sans", fontsize)
	WaitEnd()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:16,代码来源:raspi.go


示例13: 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:Ebiroll,项目名称:openvg,代码行数:48,代码来源:planets.go


示例14: makepi

// makepi draws the Raspberry Pi
func makepi(x, y, w, h openvg.VGfloat) {
	// dimensions
	socw := h / 5
	compw := h / 5
	cjw := h / 10
	cjh := h / 8
	audw := h / 5
	aujw := h / 10
	aujh := cjh / 2
	hdw := w / 6
	hdh := w / 10
	gpw := w / 3
	gph := h / 8
	pw := h / 10
	usw := w / 5
	ush := h / 5
	etw := w / 5
	eth := h / 5
	sdw := w / 6
	sdh := w / 4
	offset := (w / 2) / 10
	w34 := (w * 3) / 4
	w2 := w / 2
	h2 := h / 2
	h40 := (h * 2) / 5

	openvg.FillRGB(0, 128, 0, 1)
	openvg.Rect(x, y, w, h) // board

	openvg.FillRGB(255, 255, 0, 1)
	openvg.Rect(x+w2, (y+h)-compw, compw, compw) // composite
	openvg.FillRGB(192, 192, 192, 1)
	openvg.Rect(x+w2+(cjw/2), y+h, cjw, cjh) // composite jack

	openvg.FillRGB(0, 0, 0, 1)
	openvg.Rect(x+w34, y+h-audw, audw, audw)     // audio
	openvg.Rect(x+w34+(aujw/2), y+h, aujw, aujh) // audio jack

	openvg.FillRGB(192, 192, 192, 1)
	openvg.Rect(x+w2, y, hdw, hdh)                 // HDMI
	openvg.Rect((x+w)-etw, y, etw, eth)            // Ethernet
	openvg.Rect((x+w+offset)-usw, y+h40, usw, ush) // USB
	openvg.Rect(x, y, pw, pw)                      // Power

	openvg.FillRGB(0, 0, 0, 1)
	openvg.Rect(x+(w*2)/5, y+h40, socw, socw) // SoC
	openvg.Rect(x, (y+h)-gph, gpw, gph)       // GPIO
	openvg.FillRGB(0, 0, 255, 1)
	openvg.Rect(x-sdw, (y+h2)-(sdh/2), sdw, sdh) // SD card
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:51,代码来源:raspi.go


示例15: main

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

	w2 := openvg.VGfloat(width / 2)
	h2 := openvg.VGfloat(height / 2)
	w := openvg.VGfloat(width)

	openvg.Start(width, height)                               // Start the picture
	openvg.BackgroundColor("black")                           // Black background
	openvg.FillRGB(44, 100, 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.End()                                              // End the picture
	bufio.NewReader(os.Stdin).ReadBytes('\n')                 // Pause until [RETURN]
	openvg.Finish()                                           // Graphics cleanup
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:17,代码来源:hellovg.go


示例16: dodeck

// dodeck sets up the graphics environment and kicks off the interaction
func dodeck(filename, searchterm string, pausetime time.Duration, slidenum, cw, ch int, gp float64) {
	firstrun = 0
	w, h := openvg.Init()
	openvg.FillRGB(200, 200, 200, 1)
	openvg.Rect(0, 0, openvg.VGfloat(w), openvg.VGfloat(h))
	if cw > 0 {
		w = cw
	}
	if ch > 0 {
		h = ch
	}
	if pausetime == 0 {
		interact(filename, searchterm, w, h, slidenum, gp)
	} else {
		loop(filename, w, h, slidenum, pausetime)
	}
	openvg.Finish()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:19,代码来源:xmlview.go


示例17: gradient

func gradient(width, height int) {
	w := openvg.VGfloat(width)
	h := openvg.VGfloat(height)
	stops := []openvg.Offcolor{
		{0.0, openvg.RGB{255, 255, 255}, 1.0},
		{0.5, openvg.RGB{128, 128, 128}, 1.0},
		{1.0, openvg.RGB{0, 0, 0}, 1.0},
	}

	x1 := w / 8
	x2 := (w * 3) / 8
	y1 := h / 3
	y2 := (h * 2) / 3
	cx := (w * 3) / 4
	cy := (h / 2)
	r := (x2 - x1)
	fx := cx + (r / 4)
	fy := cy + (r / 4)
	openvg.Start(width, height)
	openvg.BackgroundRGB(128, 128, 128, 1)
	openvg.FillLinearGradient(x1, y1, x2, y2, stops)
	openvg.Rect(x1, y1, x2-x1, y2-y1)
	openvg.FillRadialGradient(cx, cy, fx, fy, r, stops)
	openvg.Circle(cx, cy, r)

	openvg.FillRGB(0, 0, 0, 0.3)
	openvg.Circle(x1, y1, 10)
	openvg.Circle(x2, y2, 10)
	openvg.Circle(cx, cy, 10)
	openvg.Circle(cx+r/2, cy, 10)
	openvg.Circle(fx, fy, 10)

	openvg.FillColor("black")
	SansTypeface := "sans"
	openvg.TextMid(x1, y1-20, "(x1, y1)", SansTypeface, 18)
	openvg.TextMid(x2, y2+10, "(x2, y2)", SansTypeface, 18)
	openvg.TextMid(cx, cy, "(cx, cy)", SansTypeface, 18)
	openvg.TextMid(fx, fy, "(fx, fy)", SansTypeface, 18)
	openvg.TextEnd(cx+(r/2)+20, cy, "r", SansTypeface, 18)

	openvg.TextMid(x1+((x2-x1)/2), h/6, "Linear Gradient", SansTypeface, 36)
	openvg.TextMid(cx, h/6, "Radial Gradient", SansTypeface, 36)
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:44,代码来源:shapedemo.go


示例18: rotext

// rotext draws text, rotated around the center of the screen, progressively faded
func rotext(w, h, n int, s string) {
	fade := (100.0 / openvg.VGfloat(n)) / 100.0
	deg := 360.0 / openvg.VGfloat(n)
	x := openvg.VGfloat(w) / 2.0
	y := openvg.VGfloat(h) / 2.0
	alpha := openvg.VGfloat(1.0)
	size := w / 8

	openvg.Start(w, h)
	openvg.Background(0, 0, 0)
	openvg.Translate(x, y)
	for i := 0; i < n; i++ {
		openvg.FillRGB(255, 255, 255, alpha)
		openvg.Text(0, 0, s, "serif", size)
		alpha -= fade // fade
		size += n     // enlarge
		openvg.Rotate(deg)
	}
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:21,代码来源:shapedemo.go


示例19: testpattern

// testpattern shows a test pattern
func testpattern(w, h int, s string) {
	var midx, midy1, midy2, midy3 openvg.VGfloat
	fontsize := 256
	h2 := openvg.VGfloat(h / 2)
	by := openvg.VGfloat(h - 100)
	bx := openvg.VGfloat(w - 100)
	tw1 := &FW{"mono", 0, fontsize}
	tw2 := &FW{"sans", 0, fontsize}
	tw3 := &FW{"serif", 0, fontsize}

	openvg.Start(w, h)

	// colored squares in the corners
	openvg.FillRGB(255, 0, 0, 1)
	openvg.Rect(0, 0, 100, 100)
	openvg.FillRGB(0, 255, 0, 1)
	openvg.Rect(0, by, 100, 100)
	openvg.FillRGB(0, 0, 255, 1)
	openvg.Rect(bx, 0, 100, 100)
	openvg.FillRGB(128, 128, 128, 1)
	openvg.Rect(bx, by, 100, 100)

	// for each font, (Sans, Serif, Mono), adjust the string to the w
	tw1.fitwidth(w, 20, s)
	tw2.fitwidth(w, 20, s)
	tw3.fitwidth(w, 20, s)

	midx = openvg.VGfloat(w / 2)

	// Adjust the baselines to be medial
	midy1 = h2 + 20 + openvg.VGfloat((tw1.fontsize)/2)
	midy2 = h2 - openvg.VGfloat((tw2.fontsize)/2)
	midy3 = h2 - 20 - openvg.VGfloat(tw2.fontsize) - openvg.VGfloat((tw3.fontsize)/2)

	openvg.FillRGB(128, 128, 128, 1)
	openvg.TextMid(midx, midy1, s, tw1.font, tw1.fontsize)
	openvg.FillRGB(128, 0, 0, 1)
	openvg.TextMid(midx, midy2, s, tw2.font, tw2.fontsize)
	openvg.FillRGB(0, 0, 128, 1)
	openvg.TextMid(midx, midy3, s, tw3.font, tw3.fontsize)
	openvg.End()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:43,代码来源:shapedemo.go


示例20: main

func main() {
	var nr = flag.Int("n", 500, "number of objects")
	var message = flag.String("m", "Go/OpenVG", "message")
	var bgcolor = flag.String("bg", "white", "background color")
	var fgcolor = flag.String("fg", "maroon", "text color")

	flag.Parse()
	rseed()

	width, height := openvg.Init()
	fw := openvg.VGfloat(width)
	fh := openvg.VGfloat(height)

	openvg.Start(width, height)
	openvg.BackgroundColor(*bgcolor)
	for i := 0; i < *nr; i++ {

		red := uint8(rand.Intn(255))
		green := uint8(rand.Intn(255))
		blue := uint8(rand.Intn(255))
		alpha := randf()

		x := randf() * fw
		y := randf() * fh
		radius := randf() * fw / 10

		openvg.FillRGB(red, green, blue, alpha)
		openvg.Circle(x, y, radius)
	}
	openvg.FillColor(*fgcolor)
	openvg.TextMid(fw/2, fh/2, *message, "sans", width/25)
	openvg.End()

	bufio.NewReader(os.Stdin).ReadBytes('\n')
	openvg.Finish()
}
开发者ID:Ebiroll,项目名称:openvg,代码行数:36,代码来源:randcircle.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang openvg.Start函数代码示例发布时间:2022-05-23
下一篇:
Golang openvg.End函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap