The problem I am having is that in Puppy Linux I cannot get a transparent background!
Here is my code:
Code: Select all
uses
Gtk
Cairo
def on_expose (wid : Widget, event : Gdk.EventExpose) : bool
// Get a cairo context for our window
var ctx = Gdk.cairo_create (wid.window)
// This should make the current color transparent (a = 0)
ctx.set_source_rgba (1, 1, 1, 0)
// Paint the entire window transparent to start with.
ctx.set_operator (Cairo.Operator.SOURCE)
ctx.paint ()
// Draw circle
var pat = new Cairo.Pattern.radial (75, 75, 20, 100, 100, 75)
pat.add_color_stop_rgba (0, 1, 1, 1, 1)
pat.add_color_stop_rgba (1, 0, 0, 0, 1)
ctx.set_source (pat)
ctx.arc (100, 100, 175, 0, 2 * 3.1416)
ctx.fill ()
return true
init
Gtk.init (ref args)
var window = new Gtk.Window
window.title = "Demo window"
window.set_default_size (200,200)
window.app_paintable = true
var cm = window.screen.get_rgba_colormap()
window.set_colormap(cm)
window.expose_event.connect(on_expose)
window.destroy.connect (Gtk.main_quit)
window.show_all ()
Gtk.main ()
Can anyone guide me as to what I am doing wrong as I am pretty new to all this Cairo/GTK etc.?
Thanks,
Rob