GdkGC::foreground

GdkGC::foreground

Access: Read Write
Type:
GdkColor

This looks so straightforward, and isn't. GdkGC objects are so far down in the evolutionary scale that they don't have an associated colormap. If you try to apply color directly, any color will be returned as a muddy brown.

The way around this is to borrow an existing GdkColormap and allocate a color from there. You can use gdk::colormap_get_system() to do this, or you can access the colormap in a GdkWindow.

The syntax is: $gc->foreground = $colormap->alloc('red');

As with the GdkColor constructor, you could use '#FF0000' or 65535, 0, 0 in place of 'red', but not 1.0, 0.0. 0.0.

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.