-
Notifications
You must be signed in to change notification settings - Fork 21
/
magick_version.go
54 lines (45 loc) · 1.31 KB
/
magick_version.go
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package gmagick
/*
#include <wand/wand_api.h>
*/
import "C"
import "unsafe"
// Returns the ImageMagick API copyright as a string constant.
func GetCopyright() string {
cstr := C.MagickGetCopyright()
return C.GoString(cstr)
}
// Returns the ImageMagick home URL.
func GetHomeURL() string {
cstr := C.MagickGetHomeURL()
defer C.MagickRelinquishMemory(unsafe.Pointer(cstr))
return C.GoString(cstr)
}
// Returns the ImageMagick package name as a string constant.
func GetPackageName() string {
cstr := C.MagickGetPackageName()
return C.GoString(cstr)
}
// Returns the ImageMagick release date as a string constant.
func GetReleaseDate() string {
cstr := C.MagickGetReleaseDate()
return C.GoString(cstr)
}
// Returns the ImageMagick quantum depth as a string constant.
func GetQuantumDepth() (string, uint) {
cst := C.ulong(0)
csq := C.MagickGetQuantumDepth(&cst)
return C.GoString(csq), uint(cst)
}
// Returns the specified resource limit in megabytes.
func GetResourceLimit(rtype ResourceType) int64 {
return int64(C.MagickGetResourceLimit(C.ResourceType(rtype)))
}
// Returns the ImageMagick API version as a string constant and as a number.
func GetVersion() (string, uint) {
cnver := C.ulong(0)
csver := C.MagickGetVersion(&cnver)
version := C.GoString(csver)
nversion := uint(cnver)
return version, nversion
}