PHP-GTK
Thursday, October 23, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGdkPixbuf::copy_area
GdkPixbuf::fill_areanext

Last updated: Sun, 12 May 2013
view this page in English

GdkPixbuf::fill

Fills the whole image with the specified color.

You can either supply one parameter, a pixel specification or four parameters that represent values from 0-255 for red, green, blue and alpha. An alpha value of 255 means opaque, while 0 means fully transparent.

Example 7. Filling the whole image with one color

<?php
//Create a new pixbuf of size 320x240
$pixbuf = new GdkPixbuf(Gdk::COLORSPACE_RGB, true, 8, 320, 240);
 
//Create a pixel specification:
$pixel = 0;
$pixel += 255 << 24;//red
$pixel += 128 << 16;//green
$pixel += 0   <<  8;//blue
$pixel += 128;      //alpha
 
//And fill another area with the pixel color
$pixbuf->fill($pixel);
 
 
//Alternative:
//green, half-transparent
//overwrites the previously set color
$pixbuf->fill(128, 255, 0, 128);
 
 
//Display the pixbuf by using a GtkImage widget
$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
$wnd->add(GtkImage::new_from_pixbuf($pixbuf));
$wnd->show_all();
Gtk::main();
?>

User Contributed Notes
gdk.gdkpixbuf.method.fill.php
add a note about notes
There are no user contributed notes for this page.


previousGdkPixbuf::copy_area
GdkPixbuf::fill_areanext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:50:55 2013 CEST