예제 #1
0
파일: canvas.go 프로젝트: phacops/canvas
// Copies a drawing surface to the canvas.
func (self *Canvas) Update() error {
	success := C.MagickDrawImage(self.wand, self.drawing)

	if success == C.MagickFalse {
		return fmt.Errorf("Could not update image: %s", self.Error())
	}

	return nil
}
예제 #2
0
func (self *Canvas) DrawAnnotation(content string, width, height uint) error {
	ccontent := C.CString("caption:" + content)
	defer C.free(unsafe.Pointer(ccontent))

	C.DrawAnnotation(self.drawing, 20, 20, (*C.uchar)(unsafe.Pointer(ccontent)))

	if C.MagickDrawImage(self.wand, self.drawing) == C.MagickFalse {
		return fmt.Errorf(`Could not draw annotation: %s`, self.Error())
	}

	return nil
}
예제 #3
0
func (self *Canvas) SetCaption(content string) error {
	ccontent := C.CString("caption:" + content)
	defer C.free(unsafe.Pointer(ccontent))

	if C.MagickReadImage(self.wand, ccontent) == C.MagickFalse {
		return fmt.Errorf(`Could not open image "%s": %s`, content, self.Error())
	}

	C.MagickDrawImage(self.wand, self.drawing)

	return nil
}
예제 #4
0
파일: canvas.go 프로젝트: mishudark/gosexy
// Copies a drawing surface to the canvas.
func (cv Canvas) Update() {
	C.MagickDrawImage(cv.wand, cv.drawing)
}