From b4f19d35fe2b5bf9b2a4b185ec7efc5991f3b3a2 Mon Sep 17 00:00:00 2001 From: Laurent Le Goff Date: Sun, 19 Apr 2015 17:14:42 +0200 Subject: [PATCH] Merge simpler import path --- Makefile | 15 +---- README.md | 2 +- draw2d/advanced_path.go => advanced_path.go | 0 draw2d/arc.go => arc.go | 0 cmd/draw2dgl.go | 2 + cmd/gettingStarted.go | 4 +- cmd/roundedrectgl.go | 4 +- cmd/testX11draw.go | 60 +++++++++++++++++++ cmd/testandroid.go | 4 +- cmd/testdraw2d.go | 4 +- cmd/testgopher.go | 4 +- cmd/testimage.go | 4 +- {draw2d/curve => curve}/Makefile | 0 {draw2d/curve => curve}/arc.go | 0 {draw2d/curve => curve}/cubic_float64.go | 0 .../curve => curve}/cubic_float64_others.go | 0 {draw2d/curve => curve}/curve_test.go | 2 +- {draw2d/curve => curve}/quad_float64.go | 0 draw2d/curves.go => curves.go | 0 draw2d/dasher.go => dasher.go | 0 .../demux_converter.go => demux_converter.go | 0 draw2d/doc.go => doc.go | 0 draw2dgl/gc.go | 2 +- draw2d/font.go => font.go | 0 draw2d/gc.go => gc.go | 0 draw2d/image.go => image.go | 0 issue23/issue23.go | 2 +- draw2d/math.go => math.go | 0 draw2d/paint.go => paint.go | 0 draw2d/path.go => path.go | 0 draw2d/path_adder.go => path_adder.go | 0 draw2d/path_converter.go => path_converter.go | 0 draw2d/path_storage.go => path_storage.go | 0 {draw2d/raster => raster}/coverage_table.go | 0 {draw2d/raster => raster}/fillerAA.go | 0 .../raster => raster}/fillerV1/fillerAA.go | 3 + .../raster => raster}/fillerV2/fillerAA.go | 3 + {draw2d/raster => raster}/fixed_point.go | 0 {draw2d/raster => raster}/line.go | 0 {draw2d/raster => raster}/polygon.go | 0 {draw2d/raster => raster}/raster_test.go | 2 +- ..._interpolation.go => rgba_interpolation.go | 0 draw2d/stack_gc.go => stack_gc.go | 0 draw2d/stroker.go => stroker.go | 0 draw2d/transform.go => transform.go | 0 draw2d/vertex2d.go => vertex2d.go | 0 wingui/wingdi.go | 2 + wingui/wintest/wintest.go | 2 + wingui/wintestgdi/wintestgdi.go | 4 +- 49 files changed, 101 insertions(+), 24 deletions(-) rename draw2d/advanced_path.go => advanced_path.go (100%) rename draw2d/arc.go => arc.go (100%) create mode 100644 cmd/testX11draw.go rename {draw2d/curve => curve}/Makefile (100%) rename {draw2d/curve => curve}/arc.go (100%) rename {draw2d/curve => curve}/cubic_float64.go (100%) rename {draw2d/curve => curve}/cubic_float64_others.go (100%) rename {draw2d/curve => curve}/curve_test.go (99%) rename {draw2d/curve => curve}/quad_float64.go (100%) rename draw2d/curves.go => curves.go (100%) rename draw2d/dasher.go => dasher.go (100%) rename draw2d/demux_converter.go => demux_converter.go (100%) rename draw2d/doc.go => doc.go (100%) rename draw2d/font.go => font.go (100%) rename draw2d/gc.go => gc.go (100%) rename draw2d/image.go => image.go (100%) rename draw2d/math.go => math.go (100%) rename draw2d/paint.go => paint.go (100%) rename draw2d/path.go => path.go (100%) rename draw2d/path_adder.go => path_adder.go (100%) rename draw2d/path_converter.go => path_converter.go (100%) rename draw2d/path_storage.go => path_storage.go (100%) rename {draw2d/raster => raster}/coverage_table.go (100%) rename {draw2d/raster => raster}/fillerAA.go (100%) rename {draw2d/raster => raster}/fillerV1/fillerAA.go (99%) rename {draw2d/raster => raster}/fillerV2/fillerAA.go (99%) rename {draw2d/raster => raster}/fixed_point.go (100%) rename {draw2d/raster => raster}/line.go (100%) rename {draw2d/raster => raster}/polygon.go (100%) rename {draw2d/raster => raster}/raster_test.go (99%) rename draw2d/rgba_interpolation.go => rgba_interpolation.go (100%) rename draw2d/stack_gc.go => stack_gc.go (100%) rename draw2d/stroker.go => stroker.go (100%) rename draw2d/transform.go => transform.go (100%) rename draw2d/vertex2d.go => vertex2d.go (100%) diff --git a/Makefile b/Makefile index 226d04f..af73a66 100644 --- a/Makefile +++ b/Makefile @@ -4,14 +4,10 @@ all: install test install: - cd draw2d && go install - cd draw2dgl && go install -# cd wingui && make install + go install ./... build: - cd draw2d && go build - cd draw2dgl && go build -# cd wingui && make build + go build ./... test: cd cmd && go build draw2dgl.go @@ -23,14 +19,9 @@ test: #cd cmd && go build testX11draw.go clean: - cd draw2d && go clean -# cd draw2dgl && make clean - cd cmd && go clean + go clean ./... # cd wingui && make clean -command: - cd cmd && make - fmt: gofmt -w . diff --git a/README.md b/README.md index a036d92..9385822 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Some algorithms have been translated from the [antigrain.com](http://www.antigra Once you have Go installed, to install `draw2d`: ```sh -$ go get github.com/llgcode/draw2d/draw2d +$ go get github.com/llgcode/draw2d ``` a good starting point is the [getting started](http://github.com/llgcode/draw2d/wiki/GettingStarted) wiki page. diff --git a/draw2d/advanced_path.go b/advanced_path.go similarity index 100% rename from draw2d/advanced_path.go rename to advanced_path.go diff --git a/draw2d/arc.go b/arc.go similarity index 100% rename from draw2d/arc.go rename to arc.go diff --git a/cmd/draw2dgl.go b/cmd/draw2dgl.go index 964fbc7..029e938 100644 --- a/cmd/draw2dgl.go +++ b/cmd/draw2dgl.go @@ -1,3 +1,5 @@ +// +build ignore + // Ported from GLUT's samples. Original copyright below applies. /* Copyright (c) Mark J. Kilgard, 1996. */ diff --git a/cmd/gettingStarted.go b/cmd/gettingStarted.go index e7422f6..774c29d 100644 --- a/cmd/gettingStarted.go +++ b/cmd/gettingStarted.go @@ -1,6 +1,8 @@ // Copyright 2010 The draw2d Authors. All rights reserved. // created: 21/11/2010 by Laurent Le Goff +// +build ignore + package main import ( @@ -11,7 +13,7 @@ import ( "log" "os" - "github.com/llgcode/draw2d/draw2d" + "github.com/llgcode/draw2d" ) func saveToPngFile(filePath string, m image.Image) { diff --git a/cmd/roundedrectgl.go b/cmd/roundedrectgl.go index 86a3e07..9ad4742 100644 --- a/cmd/roundedrectgl.go +++ b/cmd/roundedrectgl.go @@ -1,3 +1,5 @@ +// +build ignore + // Ported from GLUT's samples. Original copyright below applies. /* Copyright (c) Mark J. Kilgard, 1996. */ @@ -24,7 +26,7 @@ import ( "github.com/go-gl/gl/v2.1/gl" "github.com/go-gl/glfw/v3.1/glfw" - "github.com/llgcode/draw2d/draw2d" + "github.com/llgcode/draw2d" "github.com/llgcode/draw2d/draw2dgl" ) diff --git a/cmd/testX11draw.go b/cmd/testX11draw.go new file mode 100644 index 0000000..65d7e91 --- /dev/null +++ b/cmd/testX11draw.go @@ -0,0 +1,60 @@ +// +build ignore + +package main + +import ( + "exp/gui" + "exp/gui/x11" + "fmt" + "image" + "math" + + "github.com/llgcode/draw2d" +) + +func main() { + window, err := x11.NewWindow() + if err != nil { + fmt.Printf("Cannot open an x11 window\n") + return + } + screen := window.Screen() + gc := draw2d.NewGraphicContext(screen) + gc.SetStrokeColor(image.Black) + gc.SetFillColor(image.White) + gc.Clear() + for i := 0.0; i < 360; i = i + 10 { // Go from 0 to 360 degrees in 10 degree steps + gc.BeginPath() // Start a new path + gc.Save() // Keep rotations temporary + gc.MoveTo(144, 144) + gc.Rotate(i * (math.Pi / 180.0)) // Rotate by degrees on stack from 'for' + gc.RLineTo(72, 0) + gc.Stroke() + gc.Restore() // Get back the unrotated state + } + + window.FlushImage() + + gc.SetLineWidth(3) + nbclick := 0 + for { + + switch evt := (<-window.EventChan()).(type) { + case gui.KeyEvent: + if evt.Key == 'q' { + window.Close() + } + case gui.MouseEvent: + if evt.Buttons&1 != 0 { + if nbclick%2 == 0 { + gc.MoveTo(float64(evt.Loc.X), float64(evt.Loc.Y)) + } else { + gc.LineTo(float64(evt.Loc.X), float64(evt.Loc.Y)) + gc.Stroke() + window.FlushImage() + } + nbclick = nbclick + 1 + } + } + } +} diff --git a/cmd/testandroid.go b/cmd/testandroid.go index 615c3b6..042fc2e 100644 --- a/cmd/testandroid.go +++ b/cmd/testandroid.go @@ -1,3 +1,5 @@ +// +build ignore + package main import ( @@ -10,7 +12,7 @@ import ( "math" "os" - "github.com/llgcode/draw2d/draw2d" + "github.com/llgcode/draw2d" ) const ( diff --git a/cmd/testdraw2d.go b/cmd/testdraw2d.go index 644d600..fa32abf 100644 --- a/cmd/testdraw2d.go +++ b/cmd/testdraw2d.go @@ -1,6 +1,8 @@ // Copyright 2010 The draw2d Authors. All rights reserved. // created: 21/11/2010 by Laurent Le Goff +// +build ignore + package main import ( @@ -13,7 +15,7 @@ import ( "math" "os" - "github.com/llgcode/draw2d/draw2d" + "github.com/llgcode/draw2d" ) const ( diff --git a/cmd/testgopher.go b/cmd/testgopher.go index f365b0f..19f18ed 100644 --- a/cmd/testgopher.go +++ b/cmd/testgopher.go @@ -1,3 +1,5 @@ +// +build ignore + package main import ( @@ -10,7 +12,7 @@ import ( "math" "os" - "github.com/llgcode/draw2d/draw2d" + "github.com/llgcode/draw2d" ) const ( diff --git a/cmd/testimage.go b/cmd/testimage.go index c852f73..c18d4ef 100644 --- a/cmd/testimage.go +++ b/cmd/testimage.go @@ -1,3 +1,5 @@ +// +build ignore + package main import ( @@ -10,7 +12,7 @@ import ( "math" "os" - "github.com/llgcode/draw2d/draw2d" + "github.com/llgcode/draw2d" ) func saveToPngFile(filePath string, m image.Image) { diff --git a/draw2d/curve/Makefile b/curve/Makefile similarity index 100% rename from draw2d/curve/Makefile rename to curve/Makefile diff --git a/draw2d/curve/arc.go b/curve/arc.go similarity index 100% rename from draw2d/curve/arc.go rename to curve/arc.go diff --git a/draw2d/curve/cubic_float64.go b/curve/cubic_float64.go similarity index 100% rename from draw2d/curve/cubic_float64.go rename to curve/cubic_float64.go diff --git a/draw2d/curve/cubic_float64_others.go b/curve/cubic_float64_others.go similarity index 100% rename from draw2d/curve/cubic_float64_others.go rename to curve/cubic_float64_others.go diff --git a/draw2d/curve/curve_test.go b/curve/curve_test.go similarity index 99% rename from draw2d/curve/curve_test.go rename to curve/curve_test.go index e706581..c101e6a 100644 --- a/draw2d/curve/curve_test.go +++ b/curve/curve_test.go @@ -11,7 +11,7 @@ import ( "os" "testing" - "github.com/llgcode/draw2d/draw2d/raster" + "github.com/llgcode/draw2d/raster" ) var ( diff --git a/draw2d/curve/quad_float64.go b/curve/quad_float64.go similarity index 100% rename from draw2d/curve/quad_float64.go rename to curve/quad_float64.go diff --git a/draw2d/curves.go b/curves.go similarity index 100% rename from draw2d/curves.go rename to curves.go diff --git a/draw2d/dasher.go b/dasher.go similarity index 100% rename from draw2d/dasher.go rename to dasher.go diff --git a/draw2d/demux_converter.go b/demux_converter.go similarity index 100% rename from draw2d/demux_converter.go rename to demux_converter.go diff --git a/draw2d/doc.go b/doc.go similarity index 100% rename from draw2d/doc.go rename to doc.go diff --git a/draw2dgl/gc.go b/draw2dgl/gc.go index 0dca03e..2833dcc 100644 --- a/draw2dgl/gc.go +++ b/draw2dgl/gc.go @@ -8,7 +8,7 @@ import ( "code.google.com/p/freetype-go/freetype/raster" "github.com/go-gl/gl/v2.1/gl" - "github.com/llgcode/draw2d/draw2d" + "github.com/llgcode/draw2d" ) func init() { diff --git a/draw2d/font.go b/font.go similarity index 100% rename from draw2d/font.go rename to font.go diff --git a/draw2d/gc.go b/gc.go similarity index 100% rename from draw2d/gc.go rename to gc.go diff --git a/draw2d/image.go b/image.go similarity index 100% rename from draw2d/image.go rename to image.go diff --git a/issue23/issue23.go b/issue23/issue23.go index 4266410..3e7643a 100644 --- a/issue23/issue23.go +++ b/issue23/issue23.go @@ -10,7 +10,7 @@ import ( "math" "os" - "github.com/llgcode/draw2d/draw2d" + "github.com/llgcode/draw2d" ) func saveToPngFile(filePath string, m image.Image) { diff --git a/draw2d/math.go b/math.go similarity index 100% rename from draw2d/math.go rename to math.go diff --git a/draw2d/paint.go b/paint.go similarity index 100% rename from draw2d/paint.go rename to paint.go diff --git a/draw2d/path.go b/path.go similarity index 100% rename from draw2d/path.go rename to path.go diff --git a/draw2d/path_adder.go b/path_adder.go similarity index 100% rename from draw2d/path_adder.go rename to path_adder.go diff --git a/draw2d/path_converter.go b/path_converter.go similarity index 100% rename from draw2d/path_converter.go rename to path_converter.go diff --git a/draw2d/path_storage.go b/path_storage.go similarity index 100% rename from draw2d/path_storage.go rename to path_storage.go diff --git a/draw2d/raster/coverage_table.go b/raster/coverage_table.go similarity index 100% rename from draw2d/raster/coverage_table.go rename to raster/coverage_table.go diff --git a/draw2d/raster/fillerAA.go b/raster/fillerAA.go similarity index 100% rename from draw2d/raster/fillerAA.go rename to raster/fillerAA.go diff --git a/draw2d/raster/fillerV1/fillerAA.go b/raster/fillerV1/fillerAA.go similarity index 99% rename from draw2d/raster/fillerV1/fillerAA.go rename to raster/fillerV1/fillerAA.go index a85d34c..976ac5f 100644 --- a/draw2d/raster/fillerV1/fillerAA.go +++ b/raster/fillerV1/fillerAA.go @@ -1,5 +1,8 @@ // Copyright 2011 The draw2d Authors. All rights reserved. // created: 27/05/2011 by Laurent Le Goff + +// +build ignore + package raster import ( diff --git a/draw2d/raster/fillerV2/fillerAA.go b/raster/fillerV2/fillerAA.go similarity index 99% rename from draw2d/raster/fillerV2/fillerAA.go rename to raster/fillerV2/fillerAA.go index 0bda5a4..2303747 100644 --- a/draw2d/raster/fillerV2/fillerAA.go +++ b/raster/fillerV2/fillerAA.go @@ -1,5 +1,8 @@ // Copyright 2011 The draw2d Authors. All rights reserved. // created: 27/05/2011 by Laurent Le Goff + +// +build ignore + package raster import ( diff --git a/draw2d/raster/fixed_point.go b/raster/fixed_point.go similarity index 100% rename from draw2d/raster/fixed_point.go rename to raster/fixed_point.go diff --git a/draw2d/raster/line.go b/raster/line.go similarity index 100% rename from draw2d/raster/line.go rename to raster/line.go diff --git a/draw2d/raster/polygon.go b/raster/polygon.go similarity index 100% rename from draw2d/raster/polygon.go rename to raster/polygon.go diff --git a/draw2d/raster/raster_test.go b/raster/raster_test.go similarity index 99% rename from draw2d/raster/raster_test.go rename to raster/raster_test.go index 8ae3711..7d595cc 100644 --- a/draw2d/raster/raster_test.go +++ b/raster/raster_test.go @@ -10,7 +10,7 @@ import ( "testing" "code.google.com/p/freetype-go/freetype/raster" - "github.com/llgcode/draw2d/draw2d/curve" + "github.com/llgcode/draw2d/curve" ) var flattening_threshold float64 = 0.5 diff --git a/draw2d/rgba_interpolation.go b/rgba_interpolation.go similarity index 100% rename from draw2d/rgba_interpolation.go rename to rgba_interpolation.go diff --git a/draw2d/stack_gc.go b/stack_gc.go similarity index 100% rename from draw2d/stack_gc.go rename to stack_gc.go diff --git a/draw2d/stroker.go b/stroker.go similarity index 100% rename from draw2d/stroker.go rename to stroker.go diff --git a/draw2d/transform.go b/transform.go similarity index 100% rename from draw2d/transform.go rename to transform.go diff --git a/draw2d/vertex2d.go b/vertex2d.go similarity index 100% rename from draw2d/vertex2d.go rename to vertex2d.go diff --git a/wingui/wingdi.go b/wingui/wingdi.go index c430fb3..88b9468 100644 --- a/wingui/wingdi.go +++ b/wingui/wingdi.go @@ -1,3 +1,5 @@ +// +build windows + package wingui import ( diff --git a/wingui/wintest/wintest.go b/wingui/wintest/wintest.go index 2c8ffe1..156513f 100644 --- a/wingui/wintest/wintest.go +++ b/wingui/wintest/wintest.go @@ -1,3 +1,5 @@ +// +build ignore + package main import ( diff --git a/wingui/wintestgdi/wintestgdi.go b/wingui/wintestgdi/wintestgdi.go index 46c2e5e..a82cef5 100644 --- a/wingui/wintestgdi/wintestgdi.go +++ b/wingui/wintestgdi/wintestgdi.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build ignore + package main import ( @@ -15,7 +17,7 @@ import ( "time" "unsafe" - "github.com/llgcode/draw2d/draw2d" + "github.com/llgcode/draw2d" "github.com/llgcode/draw2d/wingui" "github.com/llgcode/ps" )