-
Notifications
You must be signed in to change notification settings - Fork 181
/
magick_version.go
70 lines (58 loc) · 1.8 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright 2013 Herbert G. Fischer. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package imagick
/*
#include <wand/MagickWand.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 relinquishMemory(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.size_t(0)
csq := C.MagickGetQuantumDepth(&cst)
return C.GoString(csq), uint(cst)
}
// Returns the ImageMagick quantum range as a string constant.
func GetQuantumRange() (string, uint) {
cst := C.size_t(0)
csq := C.MagickGetQuantumRange(&cst)
return C.GoString(csq), uint(cst)
}
// Returns the specified resource in megabytes.
func GetResource(rtype ResourceType) int64 {
return int64(C.MagickGetResource(C.ResourceType(rtype)))
}
// 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() (version string, nversion uint) {
cnver := C.size_t(0)
csver := C.MagickGetVersion(&cnver)
version = C.GoString(csver)
nversion = uint(cnver)
return
}