當前位置: 首頁>>代碼示例>>Golang>>正文


Golang curve.CubicCurveFloat64類代碼示例

本文整理匯總了Golang中code/google/com/p/draw2d/newdraw2d/curve.CubicCurveFloat64的典型用法代碼示例。如果您正苦於以下問題:Golang CubicCurveFloat64類的具體用法?Golang CubicCurveFloat64怎麽用?Golang CubicCurveFloat64使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CubicCurveFloat64類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestSimpleRasterizer

func TestSimpleRasterizer(t *testing.T) {
	bounds := image.Rect(0, 0, 200, 200)
	img := image.NewRGBA(bounds)
	mask := image.NewAlpha(bounds)
	var p Path
	p.LineTo(10, 190)
	c := curve.CubicCurveFloat64{10, 190, 10, 10, 190, 10, 190, 190}
	c.Segment(&p, flattening_threshold)
	poly := Polygon(p.points)
	rgba := color.RGBA{0, 0, 0, 0xff}
	r := NewRasterizer()
	r.Fill(mask, poly, false)
	DrawSolidRGBA(img, mask, rgba)
	savepng("_testSimpleRasterizer.png", img)
}
開發者ID:zqc115322536,項目名稱:draw2d.newdraw2d,代碼行數:15,代碼來源:raster_test.go

示例2: BenchmarkRasterizer

func BenchmarkRasterizer(b *testing.B) {
	var p Path
	p.LineTo(10, 190)
	c := curve.CubicCurveFloat64{10, 190, 10, 10, 190, 10, 190, 190}
	c.Segment(&p, flattening_threshold)
	poly := Polygon(p.points)
	color := color.RGBA{0, 0, 0, 0xff}
	tr := [6]float64{1, 0, 0, 1, 0, 0}
	rasterizer := NewRasterizer8BitsSample(200, 200)
	for i := 0; i < b.N; i++ {
		img := image.NewRGBA(image.Rect(0, 0, 200, 200))

		rasterizer.RenderEvenOdd(img, color, []Polygon{poly}, tr)
	}
}
開發者ID:zqc115322536,項目名稱:draw2d.newdraw2d,代碼行數:15,代碼來源:raster_test.go

示例3: TestRasterizerNonZeroWinding

func TestRasterizerNonZeroWinding(t *testing.T) {
	img := image.NewRGBA(image.Rect(0, 0, 200, 200))
	var p Path
	p.LineTo(10, 190)
	c := curve.CubicCurveFloat64{10, 190, 10, 10, 190, 10, 190, 190}
	c.Segment(&p, flattening_threshold)
	poly := Polygon(p.points)
	color := color.RGBA{0, 0, 0, 0xff}
	tr := [6]float64{1, 0, 0, 1, 0, 0}
	r := NewRasterizer8BitsSample(200, 200)
	//PolylineBresenham(img, image.Black, poly...)

	r.RenderNonZeroWinding(img, color, []Polygon{poly}, tr)
	savepng("_testRasterizerNonZeroWinding.png", img)
}
開發者ID:zqc115322536,項目名稱:draw2d.newdraw2d,代碼行數:15,代碼來源:raster_test.go

示例4: BenchmarkSimpleRasterizerNonZero

func BenchmarkSimpleRasterizerNonZero(b *testing.B) {
	var p Path
	p.LineTo(10, 190)
	c := curve.CubicCurveFloat64{10, 190, 10, 10, 190, 10, 190, 190}
	c.Segment(&p, flattening_threshold)
	poly := Polygon(p.points)
	rgba := color.RGBA{0, 0, 0, 0xff}
	rasterizer := NewRasterizer()
	for i := 0; i < b.N; i++ {
		bounds := image.Rect(0, 0, 200, 200)
		img := image.NewRGBA(bounds)
		mask := image.NewAlpha(bounds)
		rasterizer.Fill(mask, poly, true)
		DrawSolidRGBA(img, mask, rgba)
	}
}
開發者ID:zqc115322536,項目名稱:draw2d.newdraw2d,代碼行數:16,代碼來源:raster_test.go

示例5: TestFreetype

func TestFreetype(t *testing.T) {
	var p Path
	p.LineTo(10, 190)
	c := curve.CubicCurveFloat64{10, 190, 10, 10, 190, 10, 190, 190}
	c.Segment(&p, flattening_threshold)
	poly := Polygon(p.points)
	rgba := color.RGBA{0, 0, 0, 0xff}

	bounds := image.Rect(0, 0, 200, 200)
	mask := image.NewAlpha(bounds)
	img := image.NewRGBA(bounds)
	rasterizer := raster.NewRasterizer(200, 200)
	rasterizer.UseNonZeroWinding = false
	rasterizer.Start(raster.Point{raster.Fix32(10 * 256), raster.Fix32(190 * 256)})
	for j := 0; j < len(poly); j = j + 2 {
		rasterizer.Add1(raster.Point{raster.Fix32(poly[j] * 256), raster.Fix32(poly[j+1] * 256)})
	}
	painter := raster.NewAlphaSrcPainter(mask)
	rasterizer.Rasterize(painter)
	DrawSolidRGBA(img, mask, rgba)
	savepng("_testFreetype.png", img)
}
開發者ID:zqc115322536,項目名稱:draw2d.newdraw2d,代碼行數:22,代碼來源:raster_test.go


注:本文中的code/google/com/p/draw2d/newdraw2d/curve.CubicCurveFloat64類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。