예제 #1
0
파일: cairo.go 프로젝트: zvin/gocairo
func (self *Surface) PathExtents() (left, top, right, bottom float64) {
	var x1, y1, x2, y2 float64
	px1 := (*C.double)(&x1)
	py1 := (*C.double)(&y1)
	px2 := (*C.double)(&x2)
	py2 := (*C.double)(&y2)
	C.cairo_path_extents(self.context, px1, py1, px2, py2)
	left = float64(*px1)
	top = float64(*py1)
	right = float64(*px2)
	bottom = float64(*py2)
	return
}
예제 #2
0
파일: surface.go 프로젝트: ungerik/go-cairo
func (self *Surface) PathExtents() (left, top, right, bottom float64) {
	C.cairo_path_extents(self.context,
		(*C.double)(&left), (*C.double)(&top),
		(*C.double)(&right), (*C.double)(&bottom))
	return left, top, right, bottom
}
예제 #3
0
파일: cairo.go 프로젝트: jimmyfrasche/cairo
//PathExtents computes a bounding box in user-space coordinates covering
//the points on the current path.
//If the current path is empty, returns ZR.
//Stroke parameters, fill rule, surface dimensions and clipping are not taken
//into account.
//
//PathExtents is in contrast to FillExtents and StrokeExtents which return
//the extents of only the area that would be "inked" by the corresponding
//drawing operations.
//
//The result of PathExtents is defined as equivalent to the limit
//of StrokeExtents with LineCapRound as the line width approaches 0, but never
//approaching the empty rectangle returned by StrokeExtents for a line width
//of 0.
//
//Specifically, this means that zero-area sub-paths such as MoveTo contribute
//to the extents.
//However, a lone MoveTo will not contribute to the results of PathExtents.
//
//Originally cairo_path_extents.
func (c *Context) PathExtents() Rectangle {
	var x, y, x1, y1 C.double
	C.cairo_path_extents(c.c, &x, &y, &x1, &y1)
	return cRect(x, y, x1, y1)
}