コード例 #1
0
ファイル: imageinput.go プロジェクト: kingland/openimageigo
// Create an ImageInput subclass instance that is able to read the given file and open it,
// returning the opened ImageInput if successful. If it fails, return error.
func OpenImageInput(filename string) (*ImageInput, error) {
	c_str := C.CString(filename)
	defer C.free(unsafe.Pointer(c_str))

	cfg := unsafe.Pointer(nil)
	ptr := C.ImageInput_Open(c_str, cfg)

	in := newImageInput(ptr)

	return in, in.LastError()
}
コード例 #2
0
ファイル: imageinput.go プロジェクト: kingland/openimageigo
// Open file with given name. Return true if the file was found and opened okay.
func (i *ImageInput) Open(filename string) error {
	i.Close()

	deleteImageInput(i)

	c_str := C.CString(filename)
	defer C.free(unsafe.Pointer(c_str))

	cfg := unsafe.Pointer(nil)
	ptr := C.ImageInput_Open(c_str, cfg)
	i.ptr = ptr

	return i.LastError()
}