Created
August 7, 2012 14:25
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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