func Save(img *C.Image, path string) error { strCopy(&img.filename, []byte(path)) if C.WriteImage(imageInfo, img) == 0 { C.CatchException(&img.exception) return fmt.Errorf(C.GoString(img.exception.reason)) } return nil }
func Resize(img *C.Image, x, y int) (*C.Image, error) { newImg := C.ResizeImage(img, C.ulong(x), C.ulong(y), C.LanczosFilter, 1.0, &exceptionInfo) if newImg == nil { C.CatchException(&exceptionInfo) return nil, fmt.Errorf(C.GoString(exceptionInfo.reason)) } C.DestroyImage(img) return newImg, nil }
func Read(path string) (*C.Image, error) { strCopy(&imageInfo.filename, []byte(path)) img := C.ReadImage(imageInfo, &exceptionInfo) if img == nil { C.CatchException(&exceptionInfo) return nil, fmt.Errorf(C.GoString(exceptionInfo.reason)) } return img, nil }