예제 #1
0
// cairo_path_t* cairo_copy_path_flat (cairo_t *cr);
func (self *Surface) CopyPathFlat() (PathData, Status) {
	path := C.cairo_copy_path_flat(self.context)
	defer C.cairo_path_destroy(path)

	raw_data := make(PathData, int(path.num_data*2))
	C.memcpy(unsafe.Pointer(&raw_data[0]), unsafe.Pointer(path.data), C.size_t(path.num_data*16))

	return raw_data, Status(path.status)
}
예제 #2
0
파일: cairo.go 프로젝트: jimmyfrasche/cairo
//CopyPathFlat returns a linearized copy of the current path.
//
//CopyPathFlat behaves like CopyPath except that any curves in the path will be
//approximated with piecewise-linear approximations, accurate to within the
//current tolerance value.
//That is, the result is guaranteed to not have any elements of type PathCurveTo
//which will instead be replaced by a series of PathLineTo elements.
//
//Originally cairo_copy_path_flat.
func (c *Context) CopyPathFlat() (Path, error) {
	p := C.cairo_copy_path_flat(c.c)
	defer C.cairo_path_destroy(p)
	return cPath(p)
}