示例#1
0
// Read the file from disk. Generally will skip the read if we've already got a current
// version of the image in memory, unless force==true.
// This uses ImageInput underneath, so will read any file format for which an appropriate
// imageio plugin can be found.
//
// Specify a specific conversion format or TypeUnknown for automatic handling.
//
// This call optionally supports passing a callback pointer to both track the progress,
// and to optionally abort the processing. The callback function will receive
// a float32 value indicating the percentage done of the processing, and should
// return true if the process should abort, and false if it should continue.
//
func (i *ImageBuf) ReadFormatCallback(force bool, convert TypeDesc, progress *ProgressCallback) error {
	var cbk unsafe.Pointer
	if progress != nil {
		cbk = unsafe.Pointer(progress)
	}

	ok := C.ImageBuf_read(i.ptr, 0, 0, C.bool(force), C.TypeDesc(convert), cbk)
	if !bool(ok) {
		return i.LastError()
	}

	return nil
}
示例#2
0
// EraseAttributeType removes the specified attribute from the list of extra_attribs.
// If not found, do nothing.
// If searchtype is anything but TypeUnknown, restrict matches to only those of
// the given type.
// If caseSensitive is true, the name search will be case-sensitive, otherwise
// the name search will be performed without regard to case
func (s *ImageSpec) EraseAttributeType(name string, searchType TypeDesc, caseSensitive bool) {
	c_str := C.CString(name)
	defer C.free(unsafe.Pointer(c_str))

	C.ImageSpec_erase_attribute(s.ptr, c_str, C.TypeDesc(searchType), C.bool(caseSensitive))
}
示例#3
0
// Inform the ImageBuf what data format you'd like for any subsequent write().
func (i *ImageBuf) SetWriteFormat(format TypeDesc) {
	C.ImageBuf_set_write_format(i.ptr, C.TypeDesc(format))
}