adapt project to the new structure && resolve issue 1
16
Makefile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
include $(GOROOT)/src/Make.inc
|
||||||
|
|
||||||
|
all: install
|
||||||
|
|
||||||
|
install:
|
||||||
|
cd draw2d && make install
|
||||||
|
cd postscript && make install
|
||||||
|
|
||||||
|
clean:
|
||||||
|
cd draw2d && make clean
|
||||||
|
cd postscript && make clean
|
||||||
|
|
||||||
|
nuke:
|
||||||
|
cd draw2d && make nuke
|
||||||
|
cd postscript && make nuke
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
include $(GOROOT)/src/Make.inc
|
include $(GOROOT)/src/Make.inc
|
||||||
|
|
||||||
TARG=gettingStarted testdraw2d testX11draw testandroid testgopher testpostscript
|
TARG=gettingStarted testdraw2d testX11draw testandroid testgopher testimage testpostscript
|
||||||
|
|
||||||
OFILES=$(TARG:%=%.$O)
|
OFILES=$(TARG:%=%.$O)
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,7 @@ import (
|
||||||
|
|
||||||
"image"
|
"image"
|
||||||
"image/png"
|
"image/png"
|
||||||
//"draw2d"
|
"draw2d.googlecode.com/hg/draw2d"
|
||||||
"draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
15
cmd/test.go
|
@ -1,15 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
toto := make([]int, 2, 2)
|
|
||||||
toto[0] = 1
|
|
||||||
toto[1] = 2
|
|
||||||
fmt.Printf("%v\n", toto)
|
|
||||||
toto = toto[0:0]
|
|
||||||
fmt.Printf("%v\n", toto)
|
|
||||||
fmt.Printf("%v\n", cap(toto))
|
|
||||||
}
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
"exp/draw/x11"
|
"exp/draw/x11"
|
||||||
"image"
|
"image"
|
||||||
"math"
|
"math"
|
||||||
//"draw2d"
|
"draw2d.googlecode.com/hg/draw2d"
|
||||||
"draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -11,8 +11,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"image"
|
"image"
|
||||||
"image/png"
|
"image/png"
|
||||||
//"draw2d"
|
"draw2d.googlecode.com/hg/draw2d"
|
||||||
"draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -21,7 +20,7 @@ const (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
lastTime int64
|
lastTime int64
|
||||||
folder = "../../../../wiki/test_results/"
|
folder = "../resource/result/"
|
||||||
)
|
)
|
||||||
|
|
||||||
func initGc(w, h int) (image.Image, *draw2d.GraphicContext) {
|
func initGc(w, h int) (image.Image, *draw2d.GraphicContext) {
|
||||||
|
|
|
@ -13,8 +13,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"image"
|
"image"
|
||||||
"image/png"
|
"image/png"
|
||||||
//"draw2d"
|
"draw2d.googlecode.com/hg/draw2d"
|
||||||
"draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -23,7 +22,7 @@ const (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
lastTime int64
|
lastTime int64
|
||||||
folder = "../../../../wiki/test_results/"
|
folder = "../resource/result/"
|
||||||
)
|
)
|
||||||
|
|
||||||
func initGc(w, h int) (image.Image, *draw2d.GraphicContext) {
|
func initGc(w, h int) (image.Image, *draw2d.GraphicContext) {
|
||||||
|
@ -489,7 +488,7 @@ func TestPathTransform() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFillString() {
|
func TestFillString() {
|
||||||
draw2d.SetFontFolder("../../fonts/")
|
draw2d.SetFontFolder("../resource/font/")
|
||||||
i, gc := initGc(100, 100)
|
i, gc := initGc(100, 100)
|
||||||
draw2d.RoundRect(gc, 5, 5, 95, 95, 10, 10)
|
draw2d.RoundRect(gc, 5, 5, 95, 95, 10, 10)
|
||||||
gc.FillStroke()
|
gc.FillStroke()
|
||||||
|
|
|
@ -11,8 +11,7 @@ import (
|
||||||
|
|
||||||
"image"
|
"image"
|
||||||
"image/png"
|
"image/png"
|
||||||
//"draw2d"
|
"draw2d.googlecode.com/hg/draw2d"
|
||||||
"draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -21,7 +20,7 @@ const (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
lastTime int64
|
lastTime int64
|
||||||
folder = "../../../../wiki/test_results/"
|
folder = "../resource/result/"
|
||||||
)
|
)
|
||||||
|
|
||||||
func initGc(w, h int) (image.Image, *draw2d.GraphicContext) {
|
func initGc(w, h int) (image.Image, *draw2d.GraphicContext) {
|
||||||
|
|
|
@ -9,8 +9,7 @@ import (
|
||||||
"image"
|
"image"
|
||||||
"time"
|
"time"
|
||||||
"image/png"
|
"image/png"
|
||||||
//"draw2d"
|
"draw2d.googlecode.com/hg/draw2d"
|
||||||
"draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +66,7 @@ func testBubble(gc *draw2d.GraphicContext) {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
source := loadFromPngFile("../../Varna_Railway_Station_HDR.png")
|
source := loadFromPngFile("../resource/image/Varna_Railway_Station_HDR.png")
|
||||||
i := image.NewRGBA(1024, 768)
|
i := image.NewRGBA(1024, 768)
|
||||||
gc := draw2d.NewGraphicContext(i)
|
gc := draw2d.NewGraphicContext(i)
|
||||||
gc.Scale(2, 0.5)
|
gc.Scale(2, 0.5)
|
||||||
|
@ -77,5 +76,5 @@ func main() {
|
||||||
gc.DrawImage(source)
|
gc.DrawImage(source)
|
||||||
dt := time.Nanoseconds() - lastTime
|
dt := time.Nanoseconds() - lastTime
|
||||||
fmt.Printf("Draw image: %f ms\n", float64(dt)*1e-6)
|
fmt.Printf("Draw image: %f ms\n", float64(dt)*1e-6)
|
||||||
saveToPngFile("../../TestDrawImage.png", i)
|
saveToPngFile("../resource/result/TestDrawImage.png", i)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"image"
|
"image"
|
||||||
"image/png"
|
"image/png"
|
||||||
"draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d"
|
"draw2d.googlecode.com/hg/draw2d"
|
||||||
"postscript"
|
"draw2d.googlecode.com/hg/postscript"
|
||||||
//"postscript-go.googlecode.com/svn/trunk/postscript-go/src/pkg/postscript"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +44,7 @@ func main() {
|
||||||
gc.Scale(1, -1)
|
gc.Scale(1, -1)
|
||||||
gc.Translate(0, -380)
|
gc.Translate(0, -380)
|
||||||
lastTime := time.Nanoseconds()
|
lastTime := time.Nanoseconds()
|
||||||
src, err := os.Open("../../test_files/tiger.ps", 0, 0)
|
src, err := os.Open("../resource/postscript/tiger.ps", 0, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -56,5 +55,5 @@ func main() {
|
||||||
interpreter.Execute(reader)
|
interpreter.Execute(reader)
|
||||||
dt := time.Nanoseconds() - lastTime
|
dt := time.Nanoseconds() - lastTime
|
||||||
fmt.Printf("Draw image: %f ms\n", float64(dt)*1e-6)
|
fmt.Printf("Draw image: %f ms\n", float64(dt)*1e-6)
|
||||||
saveToPngFile("../../TestPostscript.png", i)
|
saveToPngFile("../resource/result/TestPostscript.png", i)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
include $(GOROOT)/src/Make.inc
|
include $(GOROOT)/src/Make.inc
|
||||||
|
|
||||||
TARG=draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d
|
TARG=draw2d.googlecode.com/hg/draw2d
|
||||||
GOFILES=\
|
GOFILES=\
|
||||||
arc.go\
|
arc.go\
|
||||||
curves.go\
|
curves.go\
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
fontFolder = "../../fonts/"
|
fontFolder = "../resource/font/"
|
||||||
fonts = make(map[string]*truetype.Font)
|
fonts = make(map[string]*truetype.Font)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ func (p *PathStorage) QuadCurveTo(cx, cy, x, y float64) *PathStorage {
|
||||||
|
|
||||||
func (p *PathStorage) RQuadCurveTo(dcx, dcy, dx, dy float64) *PathStorage {
|
func (p *PathStorage) RQuadCurveTo(dcx, dcy, dx, dy float64) *PathStorage {
|
||||||
x, y := p.LastPoint()
|
x, y := p.LastPoint()
|
||||||
p.RQuadCurveTo(x+dcx, y+dcy, x+dx, y+dy)
|
p.QuadCurveTo(x+dcx, y+dcy, x+dx, y+dy)
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ func (p *PathStorage) CubicCurveTo(cx1, cy1, cx2, cy2, x, y float64) *PathStorag
|
||||||
|
|
||||||
func (p *PathStorage) RCubicCurveTo(dcx1, dcy1, dcx2, dcy2, dx, dy float64) *PathStorage {
|
func (p *PathStorage) RCubicCurveTo(dcx1, dcy1, dcx2, dcy2, dx, dy float64) *PathStorage {
|
||||||
x, y := p.LastPoint()
|
x, y := p.LastPoint()
|
||||||
p.RCubicCurveTo(x+dcx1, y+dcy1, x+dcx2, y+dcy2, x+dx, y+dy)
|
p.CubicCurveTo(x+dcx1, y+dcy1, x+dcx2, y+dcy2, x+dx, y+dy)
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ func (p *PathStorage) ArcTo(cx, cy, rx, ry, startAngle, angle float64) *PathStor
|
||||||
|
|
||||||
func (p *PathStorage) RArcTo(dcx, dcy, rx, ry, startAngle, angle float64) *PathStorage {
|
func (p *PathStorage) RArcTo(dcx, dcy, rx, ry, startAngle, angle float64) *PathStorage {
|
||||||
x, y := p.LastPoint()
|
x, y := p.LastPoint()
|
||||||
p.RArcTo(x+dcx, y+dcy, rx, ry, startAngle, angle)
|
p.ArcTo(x+dcx, y+dcy, rx, ry, startAngle, angle)
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
include $(GOROOT)/src/Make.inc
|
include $(GOROOT)/src/Make.inc
|
||||||
|
|
||||||
TARG=postscript-go.googlecode.com/svn/trunk/postscript-go/src/pkg/postscript
|
TARG=draw2d.googlecode.com/hg/postscript
|
||||||
GOFILES=operators_array.go\
|
GOFILES=operators_array.go\
|
||||||
operators_dictionary.go\
|
operators_dictionary.go\
|
||||||
operators_misc.go\
|
operators_misc.go\
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"io"
|
"io"
|
||||||
"draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d"
|
"draw2d.googlecode.com/hg/draw2d"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ package postscript
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
"draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d"
|
"draw2d.googlecode.com/hg/draw2d"
|
||||||
"math"
|
"math"
|
||||||
"log"
|
"log"
|
||||||
)
|
)
|
||||||
|
|
Before Width: | Height: | Size: 592 KiB After Width: | Height: | Size: 592 KiB |
BIN
resource/result/TestAndroid.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
resource/result/TestBubble.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
resource/result/TestCurveRectangle.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
resource/result/TestDash.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
resource/result/TestDrawArc.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
resource/result/TestDrawArcNegative.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
resource/result/TestDrawCubicCurve.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
resource/result/TestDrawImage.png
Normal file
After Width: | Height: | Size: 650 KiB |
BIN
resource/result/TestFillString.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
resource/result/TestFillStroke.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
resource/result/TestFillStyle.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
resource/result/TestGopher.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
resource/result/TestLineCap.png
Normal file
After Width: | Height: | Size: 906 B |
BIN
resource/result/TestLineJoin.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
resource/result/TestMultiSegmentCaps.png
Normal file
After Width: | Height: | Size: 893 B |
BIN
resource/result/TestPath.png
Normal file
After Width: | Height: | Size: 968 B |
BIN
resource/result/TestPathTransform.png
Normal file
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 158 KiB |
BIN
resource/result/TestRoundRectangle.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
resource/result/TestStar.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
resource/result/TestTransform.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 650 KiB |
Before Width: | Height: | Size: 795 B |