Merge branch 'sbinet-github-imports'
This commit is contained in:
commit
3d2a09c9e2
43 changed files with 941 additions and 921 deletions
12
Makefile
12
Makefile
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
#include $(GOROOT)/src/Make.inc
|
#include $(GOROOT)/src/Make.inc
|
||||||
|
|
||||||
all: install
|
all: install test
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cd draw2d && go install
|
cd draw2d && go install
|
||||||
|
@ -15,6 +15,16 @@ build:
|
||||||
cd postscript && go build
|
cd postscript && go build
|
||||||
# cd wingui && make build
|
# cd wingui && make build
|
||||||
|
|
||||||
|
test:
|
||||||
|
#cd cmd && go build draw2dgl.go
|
||||||
|
cd cmd && go build gettingStarted.go
|
||||||
|
cd cmd && go build testandroid.go
|
||||||
|
cd cmd && go build testdraw2d.go
|
||||||
|
cd cmd && go build testgopher.go
|
||||||
|
cd cmd && go build testimage.go
|
||||||
|
cd cmd && go build testpostscript.go
|
||||||
|
#cd cmd && go build testX11draw.go
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cd draw2d && go clean
|
cd draw2d && go clean
|
||||||
# cd draw2dgl && make clean
|
# cd draw2dgl && make clean
|
||||||
|
|
8
README
8
README
|
@ -11,14 +11,14 @@ Some algorithm have been translated from http://www.antigrain.com project ([http
|
||||||
Once you have Go installed, to install draw2d:
|
Once you have Go installed, to install draw2d:
|
||||||
|
|
||||||
* First see the installation procedure of [http://code.google.com/p/freetype-go/ freetype-go]
|
* First see the installation procedure of [http://code.google.com/p/freetype-go/ freetype-go]
|
||||||
* goinstall draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d
|
* `go get github.com/llgcode/draw2d/draw2d`
|
||||||
|
|
||||||
a good starting point is the [http://code.google.com/p/draw2d/wiki/GettingStarted getting started]
|
a good starting point is the [http://github.com/llgcode/draw2d/wiki/GettingStarted getting started]
|
||||||
|
|
||||||
|
|
||||||
=== [http://code.google.com/p/draw2d/wiki/Samples Samples] ===
|
=== [http://github.com/llgcode/draw2d/wiki/Samples Samples] ===
|
||||||
Sample images generated by draw2d (inspired by [http://cairographics.org/samples/ cairo samples]):
|
Sample images generated by draw2d (inspired by [http://cairographics.org/samples/ cairo samples]):
|
||||||
there's already some bugs please refer to [http://code.google.com/p/draw2d/issues/list issue tracking]
|
there's already some bugs please refer to [http://github.com/llgcode/draw2d/issues issue tracking]
|
||||||
|
|
||||||
[http://draw2d.googlecode.com/svn/wiki/test_results/TestPath.png]
|
[http://draw2d.googlecode.com/svn/wiki/test_results/TestPath.png]
|
||||||
[http://draw2d.googlecode.com/svn/wiki/test_results/TestDrawArc.png]
|
[http://draw2d.googlecode.com/svn/wiki/test_results/TestDrawArc.png]
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/draw2d/draw2dgl"
|
|
||||||
"code.google.com/p/draw2d/postscript"
|
|
||||||
"gl"
|
"gl"
|
||||||
"glut"
|
"glut"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -28,6 +26,9 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2dgl"
|
||||||
|
"github.com/llgcode/draw2d/postscript"
|
||||||
)
|
)
|
||||||
|
|
||||||
var postscriptContent string
|
var postscriptContent string
|
||||||
|
|
|
@ -6,12 +6,12 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"image"
|
||||||
|
"image/png"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"code.google.com/p/draw2d/draw2d"
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
"image"
|
|
||||||
"image/png"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func saveToPngFile(filePath string, m image.Image) {
|
func saveToPngFile(filePath string, m image.Image) {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/draw2d/draw2d"
|
|
||||||
"exp/gui"
|
"exp/gui"
|
||||||
"exp/gui/x11"
|
"exp/gui/x11"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,14 +3,14 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"code.google.com/p/draw2d/draw2d"
|
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"image/png"
|
"image/png"
|
||||||
|
"log"
|
||||||
"math"
|
"math"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -6,14 +6,14 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"code.google.com/p/draw2d/draw2d"
|
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"image/png"
|
"image/png"
|
||||||
|
"log"
|
||||||
"math"
|
"math"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -3,14 +3,14 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"image"
|
||||||
|
"image/color"
|
||||||
|
"image/png"
|
||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"code.google.com/p/draw2d/draw2d"
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
"image"
|
|
||||||
"image/color"
|
|
||||||
"image/png"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"code.google.com/p/draw2d/draw2d"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
|
@ -10,6 +9,8 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
)
|
)
|
||||||
|
|
||||||
func saveToPngFile(filePath string, m image.Image) {
|
func saveToPngFile(filePath string, m image.Image) {
|
||||||
|
|
|
@ -2,8 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"code.google.com/p/draw2d/draw2d"
|
|
||||||
"code.google.com/p/draw2d/postscript"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/png"
|
"image/png"
|
||||||
|
@ -11,6 +9,9 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
|
"github.com/llgcode/draw2d/postscript"
|
||||||
)
|
)
|
||||||
|
|
||||||
func saveToPngFile(filePath string, m image.Image) {
|
func saveToPngFile(filePath string, m image.Image) {
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
package draw2d
|
package draw2d
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/freetype-go/freetype/raster"
|
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
|
"code.google.com/p/freetype-go/freetype/raster"
|
||||||
)
|
)
|
||||||
|
|
||||||
func arc(t VertexConverter, x, y, rx, ry, start, angle, scale float64) (lastX, lastY float64) {
|
func arc(t VertexConverter, x, y, rx, ry, start, angle, scale float64) (lastX, lastY float64) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "code.google.com/p/draw2d/draw2d/curve"
|
import "github.com/llgcode/draw2d/draw2d/curve"
|
||||||
import "testing"
|
import "testing"
|
||||||
import __os__ "os"
|
import __os__ "os"
|
||||||
import __regexp__ "regexp"
|
import __regexp__ "regexp"
|
||||||
|
|
|
@ -24,7 +24,7 @@ func SegmentArc(t LineTracer, x, y, rx, ry, start, angle, scale float64) {
|
||||||
if (angle < end-da/4) != clockWise {
|
if (angle < end-da/4) != clockWise {
|
||||||
curX = x + math.Cos(end)*rx
|
curX = x + math.Cos(end)*rx
|
||||||
curY = y + math.Sin(end)*ry
|
curY = y + math.Sin(end)*ry
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
curX = x + math.Cos(angle)*rx
|
curX = x + math.Cos(angle)*rx
|
||||||
curY = y + math.Sin(angle)*ry
|
curY = y + math.Sin(angle)*ry
|
||||||
|
|
|
@ -2,7 +2,6 @@ package curve
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"code.google.com/p/draw2d/draw2d/raster"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
@ -11,6 +10,8 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2d/raster"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -4,10 +4,11 @@
|
||||||
package draw2d
|
package draw2d
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/freetype-go/freetype/truetype"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
|
"code.google.com/p/freetype-go/freetype/truetype"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -4,14 +4,15 @@
|
||||||
package draw2d
|
package draw2d
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/freetype-go/freetype/raster"
|
|
||||||
"code.google.com/p/freetype-go/freetype/truetype"
|
|
||||||
"errors"
|
"errors"
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
|
"code.google.com/p/freetype-go/freetype/raster"
|
||||||
|
"code.google.com/p/freetype-go/freetype/truetype"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Painter interface {
|
type Painter interface {
|
||||||
|
|
|
@ -2,14 +2,15 @@ package raster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"code.google.com/p/draw2d/draw2d/curve"
|
|
||||||
"code.google.com/p/freetype-go/freetype/raster"
|
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"image/png"
|
"image/png"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"code.google.com/p/freetype-go/freetype/raster"
|
||||||
|
"github.com/llgcode/draw2d/draw2d/curve"
|
||||||
)
|
)
|
||||||
|
|
||||||
var flattening_threshold float64 = 0.5
|
var flattening_threshold float64 = 0.5
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
package draw2d
|
package draw2d
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/freetype-go/freetype/truetype"
|
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
|
||||||
|
"code.google.com/p/freetype-go/freetype/truetype"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StackGraphicContext struct {
|
type StackGraphicContext struct {
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
package draw2d
|
package draw2d
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/freetype-go/freetype/raster"
|
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
|
"code.google.com/p/freetype-go/freetype/raster"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MatrixTransform [6]float64
|
type MatrixTransform [6]float64
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package draw2dgl
|
package draw2dgl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/draw2d/draw2d"
|
|
||||||
"code.google.com/p/freetype-go/freetype/raster"
|
|
||||||
"gl"
|
"gl"
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
|
|
||||||
|
"code.google.com/p/freetype-go/freetype/raster"
|
||||||
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
//"log"
|
//"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,14 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"code.google.com/p/draw2d/draw2d"
|
|
||||||
"image"
|
"image"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
"image/png"
|
"image/png"
|
||||||
|
"log"
|
||||||
"math"
|
"math"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
)
|
)
|
||||||
|
|
||||||
func saveToPngFile(filePath string, m image.Image) {
|
func saveToPngFile(filePath string, m image.Image) {
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
package postscript
|
package postscript
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/draw2d/draw2d"
|
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Interpreter struct {
|
type Interpreter struct {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
package postscript
|
package postscript
|
||||||
|
|
||||||
import ()
|
|
||||||
|
|
||||||
//int array array -> Create array of length int
|
//int array array -> Create array of length int
|
||||||
func array(interpreter *Interpreter) {
|
func array(interpreter *Interpreter) {
|
||||||
interpreter.Push(make([]Value, interpreter.PopInt()))
|
interpreter.Push(make([]Value, interpreter.PopInt()))
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
package postscript
|
package postscript
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/draw2d/draw2d"
|
|
||||||
"image/color"
|
"image/color"
|
||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
)
|
)
|
||||||
|
|
||||||
//Path Construction Operators
|
//Path Construction Operators
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
// Miscellaneous Operators
|
// Miscellaneous Operators
|
||||||
package postscript
|
package postscript
|
||||||
|
|
||||||
import (
|
|
||||||
//"log"
|
|
||||||
)
|
|
||||||
|
|
||||||
//proc bind proc Replace operator names in proc with operators; perform idiom recognition
|
//proc bind proc Replace operator names in proc with operators; perform idiom recognition
|
||||||
func bind(interpreter *Interpreter) {
|
func bind(interpreter *Interpreter) {
|
||||||
pdef := interpreter.PopProcedureDefinition()
|
pdef := interpreter.PopProcedureDefinition()
|
||||||
|
|
|
@ -5,7 +5,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
. "code.google.com/p/draw2d/wingui"
|
|
||||||
|
. "github.com/llgcode/draw2d/wingui"
|
||||||
)
|
)
|
||||||
|
|
||||||
// some help functions
|
// some help functions
|
||||||
|
|
|
@ -5,18 +5,19 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/draw2d/draw2d"
|
|
||||||
"code.google.com/p/draw2d/wingui"
|
|
||||||
"code.google.com/p/draw2d/postscript"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"io/ioutil"
|
|
||||||
"image/color"
|
"image/color"
|
||||||
"strings"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/llgcode/draw2d/draw2d"
|
||||||
|
"github.com/llgcode/draw2d/postscript"
|
||||||
|
"github.com/llgcode/draw2d/wingui"
|
||||||
)
|
)
|
||||||
|
|
||||||
// some help functions
|
// some help functions
|
||||||
|
|
Loading…
Reference in a new issue