I want to only display a cairo drawing inside a drawingArea, but for some reason there is always a colored rectangle shaped background around the drawing. How can I get rid of this? I especially don't want to set it only as transparent (since I might not have support for transparency), but to only show the drawing itself.
My example is in Rust using gtk-rs, but any hints in other languages are great, too!
extern crate cairo;
extern crate gio;
extern crate gtk;
use gtk::prelude::*;
fn main() {
gtk::init();
show_drawing();
gtk::main();
}
fn show_drawing() {
let window = gtk::Window::new(gtk::WindowType::Popup);
window.set_default_size(500i32, 500i32);
// Make window a Notification
window.set_type_hint(gdk::WindowTypeHint::Notification);
window.set_position(gtk::WindowPosition::Center);
// Add drawing
let drawing_area = Box::new(gtk::DrawingArea::new)();
drawing_area.connect_draw(move |_, ctx| draw(ctx));
window.add(&drawing_area);
window.show_all();
}
fn draw(ctx: &cairo::Context) -> gtk::Inhibit {
ctx.scale(500f64, 500f64);
ctx.set_source_rgba(1.0, 0.2, 0.2, 1.0);
ctx.arc(0.5, 0.5, 0.5, 0., 3.1414 * 2.);
ctx.fill();
Inhibit(false)
}
I want this to only show the circle, and see and keep the browser clickable around the circle. How could I achieve this?