aboutsummaryrefslogtreecommitdiff
path: root/ps/main.go
blob: 478e52c8c5009202f006a38317544472d517a8ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main

import (
	"io/ioutil"
	"log"
	"os"
	"strings"

	"dim13.org/robo/gc"
	"github.com/llgcode/ps"
)

var postscriptContent string

func main() {
	src, err := os.OpenFile("tiger.ps", 0, 0)
	if err != nil {
		log.Println("can't find postscript file.")
		return
	}
	defer src.Close()
	bytes, err := ioutil.ReadAll(src)
	postscriptContent = string(bytes)
	if err != nil {
		panic(err)
	}

	GC := gc.NewGraphicContext()

	interpreter := ps.NewInterpreter(GC)
	reader := strings.NewReader(postscriptContent)
	interpreter.Execute(reader)

}