コード例 #1
0
ファイル: pattern.go プロジェクト: jimmyfrasche/cairo
//NewLinearGradient creates a new linear gradient, from start to end,
//with specified color stops.
//
//Originally cairo_pattern_create_linear and cairo_pattern_add_color_stop_rgba.
func NewLinearGradient(start, end Point, colorStops ...ColorStop) LinearGradient {
	x0, y0 := start.c()
	x1, y1 := end.c()
	p := C.cairo_pattern_create_linear(x0, y0, x1, y1)
	P := patternGradient{
		XtensionPattern: XtensionNewPattern(p),
	}
	P.addColorStops(colorStops)
	return LinearGradient{
		patternGradient: P,
		start:           start,
		end:             end,
	}
}
コード例 #2
0
// cairo_pattern_t* cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
func LinearGradient(x0, y0, x1, y1 float64) (pattern *Pattern) {
	return &Pattern{C.cairo_pattern_create_linear(C.double(x0), C.double(y0),
		C.double(x1), C.double(y1))}
}