From dd9db1c14586ecec7e9783f09cceb86fd04825ce Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 26 Aug 2018 17:26:53 -0400 Subject: [PATCH] And migrated the examples back; also fixed a spot I missed. --- draw.go | 2 +- BBB_GOFILES/zz_controls.go => zz_controls.go | 0 BBB_GOFILES/zz_drawtext.go => zz_drawtext.go | 0 .../zz_histogram.go => zz_histogram.go | 24 +++++++++---------- 4 files changed, 13 insertions(+), 13 deletions(-) rename BBB_GOFILES/zz_controls.go => zz_controls.go (100%) rename BBB_GOFILES/zz_drawtext.go => zz_drawtext.go (100%) rename BBB_GOFILES/zz_histogram.go => zz_histogram.go (91%) diff --git a/draw.go b/draw.go index 59f8e5d..4e02e65 100644 --- a/draw.go +++ b/draw.go @@ -190,7 +190,7 @@ const ( ) // TODO document -const DefaultMiterLimit = 10.0 +const DrawDefaultMiterLimit = 10.0 // TODO type DrawBrush struct { diff --git a/BBB_GOFILES/zz_controls.go b/zz_controls.go similarity index 100% rename from BBB_GOFILES/zz_controls.go rename to zz_controls.go diff --git a/BBB_GOFILES/zz_drawtext.go b/zz_drawtext.go similarity index 100% rename from BBB_GOFILES/zz_drawtext.go rename to zz_drawtext.go diff --git a/BBB_GOFILES/zz_histogram.go b/zz_histogram.go similarity index 91% rename from BBB_GOFILES/zz_histogram.go rename to zz_histogram.go index eb0c8c4..610d65a 100644 --- a/BBB_GOFILES/zz_histogram.go +++ b/zz_histogram.go @@ -29,8 +29,8 @@ const ( ) // helper to quickly set a brush color -func mkSolidBrush(color uint32, alpha float64) *ui.Brush { - brush := new(ui.Brush) +func mkSolidBrush(color uint32, alpha float64) *ui.DrawBrush { + brush := new(ui.DrawBrush) brush.Type = ui.DrawBrushTypeSolid component := uint8((color >> 16) & 0xFF) brush.R = float64(component) / 255 @@ -64,9 +64,9 @@ func pointLocations(width, height float64) (xs, ys [10]float64) { return xs, ys } -func constructGraph(width, height float64, extend bool) *ui.Path { +func constructGraph(width, height float64, extend bool) *ui.DrawPath { xs, ys := pointLocations(width, height) - path := ui.NewPath(ui.DrawFillModeWinding) + path := ui.DrawNewPath(ui.DrawFillModeWinding) path.NewFigure(xs[0], ys[0]) for i := 1; i < 10; i++ { @@ -93,7 +93,7 @@ type areaHandler struct{} func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) { // fill the area with white brush := mkSolidBrush(colorWhite, 1.0) - path := ui.NewPath(ui.DrawFillModeWinding) + path := ui.DrawNewPath(ui.DrawFillModeWinding) path.AddRectangle(0, 0, p.AreaWidth, p.AreaHeight) path.End() p.Context.Fill(path, brush) @@ -101,16 +101,16 @@ func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) { graphWidth, graphHeight := graphSize(p.AreaWidth, p.AreaHeight) - sp := &ui.StrokeParams{ - Cap: ui.FlatCap, - Join: ui.MiterJoin, + sp := &ui.DrawStrokeParams{ + Cap: ui.DrawLineCapFlat, + Join: ui.DrawLineJoinMiter, Thickness: 2, - MiterLimit: ui.DefaultMiterLimit, + MiterLimit: ui.DrawDefaultMiterLimit, } // draw the axes brush = mkSolidBrush(colorBlack, 1.0) - path = ui.NewPath(ui.DrawFillModeWinding) + path = ui.DrawNewPath(ui.DrawFillModeWinding) path.NewFigure(xoffLeft, yoffTop) path.LineTo(xoffLeft, yoffTop + graphHeight) path.LineTo(xoffLeft + graphWidth, yoffTop + graphHeight) @@ -119,7 +119,7 @@ func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) { path.Free() // now transform the coordinate space so (0, 0) is the top-left corner of the graph - m := ui.NewMatrix() + m := ui.DrawNewMatrix() m.Translate(xoffLeft, yoffTop) p.Context.Transform(m) @@ -146,7 +146,7 @@ func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) { // now draw the point being hovered over if currentPoint != -1 { xs, ys := pointLocations(graphWidth, graphHeight) - path = ui.NewPath(ui.DrawFillModeWinding) + path = ui.DrawNewPath(ui.DrawFillModeWinding) path.NewFigureWithArc( xs[currentPoint], ys[currentPoint], pointRadius,