Linux puskom-ProLiant-DL385-Gen10 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64
/
usr
/
share
/
doc
/
libcairo-gobject-perl
/
examples
/
//usr/share/doc/libcairo-gobject-perl/examples/draw-widget.pl
#!/usr/bin/perl use Cairo::GObject; use Glib::Object::Introspection; Glib::Object::Introspection->setup ( basename => 'Gtk', version => '3.0', package => 'Gtk3'); Gtk3::init ([]); my $window = Gtk3::Window->new ('toplevel'); my $button = Gtk3::Button->new_with_label ('Kazam!'); $window->add ($button); $window->show_all; my ($width, undef) = $button->get_preferred_width; my ($height, undef) = $button->get_preferred_height; my $surf = Cairo::ImageSurface->create ('argb32', $width,$height); my $cr = Cairo::Context->create ($surf); Glib::Idle->add (sub { $button->draw ($cr); Gtk3::main_quit (); }); Gtk3::main (); $surf->write_to_png ('draw-widget.png');