diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..eb8f9e6 --- /dev/null +++ b/.hgignore @@ -0,0 +1,3 @@ +mode:regex + +\.exe$ diff --git a/cmd/gopngquant/main.go b/cmd/gopngquant/main.go new file mode 100644 index 0000000..183a77c --- /dev/null +++ b/cmd/gopngquant/main.go @@ -0,0 +1,20 @@ +package main + +import ( + "flag" + "fmt" + "os" + + "code.ivysaur.me/imagequant" +) + +func main() { + ShouldDisplayVersion := flag.Bool("Version", false, "") + + flag.Parse() + + if *ShouldDisplayVersion { + fmt.Printf("libimagequant %d\n", imagequant.GetLibraryVersion()) + os.Exit(1) + } +} diff --git a/imagequant.go b/imagequant.go new file mode 100644 index 0000000..39dac20 --- /dev/null +++ b/imagequant.go @@ -0,0 +1,14 @@ +package imagequant + +/* +#cgo CFLAGS: -O3 -fno-math-errno -fopenmp -funroll-loops -fomit-frame-pointer -Wall -Wno-attributes -std=c99 -DNDEBUG -DUSE_SSE=1 -msse -fexcess-precision=fast +#cgo LDFLAGS: -fopenmp -static +#include "libimagequant.h" +*/ +import ( + "C" +) + +func GetLibraryVersion() int { + return int(C.liq_version()) +}