Skip to content

Instantly share code, notes, and snippets.

@auroraeosrose
Created August 7, 2012 14:25
Show Gist options
  • Save auroraeosrose/3285787 to your computer and use it in GitHub Desktop.
Save auroraeosrose/3285787 to your computer and use it in GitHub Desktop.
How to use an alpha channel image on a gtk window to do a pixmap
/**
* public function set_image
*
* sets a background image for the splash screen
*
* @param string $image absolute path to splash background
* @return void
*/
public function set_image($image)
{
$pixbuf = GdkPixbuf::new_from_file($image);
list($pixmap, $mask) = $pixbuf->render_pixmap_and_mask();
list($width, $height) = $pixmap->get_size();
$this->set_app_paintable(true);
$this->set_size_request($width, $height);
$this->realize();
if($mask instanceof GdkPixmap)
{
$this->shape_combine_mask($mask, 0, 0);
}
$this->window->set_back_pixmap($pixmap, false);
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment