PHP-GTK
Monday, October 20, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGdkPixbuf::fill
GdkPixbuf::get_bits_per_samplenext

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

GdkPixbuf::fill_area

Fills the area specified by (x, y - width, height) with the specified color.

The color is either a pixel specification or a tuple of red, green, blue and alpha values (ranging from 0 to 255).

A pixel specification is an integer with the bits of red, green, blue and alpha shifted by 8. See the example how to create one.

An alpha value of 0 means completely transparent, while 255 means totally opaque.

Example 8. Filling an areas of a pixbuf with color

<?php
//Create a new pixbuf of size 320x240
$pixbuf = new GdkPixbuf(Gdk::COLORSPACE_RGB, true, 8, 320, 240);
 
//fill area at (10,10) of size (20,50) with color
//(rgba = 255, 255, 255, 255)
//the alpha value of 255 makes it opaque
$pixbuf->fill_area(10, 10, 20, 50, 255, 255, 255, 255);
 
 
//Create a pixel specification:
//First, we define the RGBA values we need
$r = 255;
$g = 128;
$b = 0;
$a = 128;
 
//Now create the pixel
$pixel = 0;
$pixel += $r << 24;
$pixel += $g << 16;
$pixel += $b << 8;
$pixel += $a;
 
//And fill another area with the pixel color
$pixbuf->fill_area(50, 50, 30, 40, $pixel);
 
 
//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_area.php
add a note about notes
There are no user contributed notes for this page.


previousGdkPixbuf::fill
GdkPixbuf::get_bits_per_samplenext

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