2

我正在尝试制作一个透明的 GTK 窗口来绘制;但是,我似乎无法弄清楚如何使用go-cairogo-gtk来实现这一点。有谁知道如何做到这一点?

4

1 回答 1

2

go-gtk doesn't have any window opacity functionality yet, making the task impossible unless you implement them yourself. This is evidenced by lines 1392 and 1393 of gtk.go.

As for go-cairo(which I haven't personally used) if you look at this, you'll see the functionality that is compatible with this. The Go function in questions is:

func (self *Surface) SetSourceRGBA(red, green, blue, alpha float64) {
    C.cairo_set_source_rgba(self.context, C.double(red), C.double(green), C.double(blue), C.double(alpha))
}

which is the wrapper for cairo_set_source_rgba. A C-based example of this in action is available through plan99.net.

I would say that playing with alpha channels in go-cairo is the best bet right now to get the desired effect.

于 2013-01-28T19:12:09.300 回答