PHP-GTK News #15

Summer may have had its unofficial start this week but that doesn’t mean the PHP-GTK team is taking a vacation. This week we have several development advances in some pretty important areas:

  • The cause of a critical Win32 bug has been found.
  • PHP-GTK 2 has been preped for PHP 5.2.
  • More filling out of the docs
  • And PHP-GTK 2 gets some respect

Development

GdkPixbuf::fill() Patch:
Christian supplied yet another patch this week. His latest makes GdkPixbuf::fill() accept both pixel specification and rgba values. This means that you can fill a pixbuf with a single color (black in this example) using either:

$pb->fill(0×00000000);
// or
$pb->fill(0, 0, 0, 0); // The last 0 is the alpha channel

GdkPixbuf::new_from_gd transfers red colors only Bug:
Christian filed a bug this week that points out an issue when trying to create a from a GD image. The title of the bug says that only red values are transfered. GdkPixbuf::new_from_gd() is the method used to new images created at runtime. An image such as a graph might be created from user data and then shown in the application after being converted to a GdkPixbuf. Until this bug is fixed, it will be difficult to create images on the fly.

PHP 5.2 Compat Patch:
Steph supplied a patch this week that addresses issues when PHP-GTK 2 is built against PHP 5.2. An explanation of what the patch does is well beyond me at this point. Anyway, once it is commited, it should be safe to build against PHP 5.2 (sort or, see the next item).

Ides Of March:
Steph has been hard at work trying to track down the cause of the “Win32 Crash”. The crash occurs when an application shutsdown if PHP-GTK 2 was built against PHP 5.1.4 or later (maybe 5.1.3 also but it isn’t confirmed). After many days of hard work, Steph finally cracked the problem. It is related to bug #36568 which was fixed by including the Win32 config file in the Zend config file. Apparently this throws off TSRM. The TSRM config tries to redefine something that was already defined in the Zend config. At this point, Steph is waiting for Dmitry Stogov to re-fix the bug. When that is cleared up the PHP-GTK 2 Win32 crash should disappear.

GtkSourceView:
xxoes came through again this week, providing the files needed to compile GtkSourceView on Windows. This helps close the gap between Windows and Linux. GtkSourceView is an extended GtkTextView widget that automatically highlights text based on its syntax. For example, if you tell GtkSourceView that it has XML, it will highlight the elements and attributes to make the text easier to read.

GtkComboBox/GtkTreeView::set_row_separator_func() Patch:
Christian supplied another patch this week to fix the implementation of GtkComboBox::set_row_separator_func() and GtkTreeView::set_row_separator_func(). These two methods are used to add decorative row separators to lists and trees. Basically, the two methods take the name of a callback which is called when each row is rendered. The callback should check the value of the row and return true if the value should be replaced with a row separator (similar to an HTML


element).Documentation

Documentation updates this week:

General

Gnope Game_Of_Life:
Gnope had release a Game of Life package. This is an important release since no programming language is really respected until someone creates a “Game of Life” implemenation. With this package, PHP-GTK 2 now has some street cred. :)

IRC

Animations:
There was a brief discussion on the IRC channel (freenode #php-gtk) this week about using animated images in an application. Showing an animated image is no harder than showing a static image:

< ?php
$win = new GtkWindow();
$win->connect_simple(’destroy’, array(’Gtk’, ‘main_quit’));

$pb = new GdkPixbufAnimation(’/path/to/images/animatedLogo.gif’);
$img = GtkImage::new_from_animation($pb);

$win->add($img);
$win->show_all();

Gtk::main();
?>

Leave a Reply