Exemplo n.º 1
0
// Destroy frees the C memory for the image. Should be called after processing is done.
func (im *MagickImage) Destroy() (err error) {
	C.DestroyImage(im.Image)
	C.DestroyImageInfo(im.ImageInfo)
	im.Image = nil
	im.ImageInfo = nil
	return
}
Exemplo n.º 2
0
func unrefImage(image *C.Image) {
	if atomic.AddInt32((*int32)(unsafe.Pointer(&image.client_data)), -1) == 0 {
		mu.Lock()
		delete(liveImages, image)
		mu.Unlock()
		atomic.AddInt32(&live, -1)
		C.DestroyImage(image)
	}
}
Exemplo n.º 3
0
Arquivo: magick.go Projeto: mat/magick
// Destroy frees the C memory for the image. Should be called after processing is done.
func (im *MagickImage) Destroy() (err error) {
	if im.Image != nil {
		C.DestroyImage(im.Image)
	}
	if im.ImageInfo != nil {
		C.DestroyImageInfo(im.ImageInfo)
	}
	im.Image = nil
	im.ImageInfo = nil
	return
}
Exemplo n.º 4
0
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
}
Exemplo n.º 5
0
Arquivo: magick.go Projeto: mat/magick
// ReplaceImage Replaces the underlying image, freeing the old one
func (im *MagickImage) ReplaceImage(new_image *C.Image) {
	C.DestroyImage(im.Image)
	im.Image = new_image
}
Exemplo n.º 6
0
func unrefImage(image *C.Image) {
	if atomic.AddInt32((*int32)(unsafe.Pointer(&image.client_data)), -1) == 0 {
		C.DestroyImage(image)
	}
}