Exemplo n.º 1
0
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
}
Exemplo n.º 2
0
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
}
Exemplo n.º 3
0
//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)
}