Creating GCs
To create a GC, call the new_gc() method of a drawable. This method can also take an associative array specifying some initial values (only foreground, background, tile, stipple, and clip_mask are currently supported). The rest have to be set manually.

 1: <?php
 2
:   // create a default GC
 
3:   $gc $window->new_gc();
 
4
 
5:   or
 
6
 
7:   // create GC and set some fields
 
8:   $gc $window->new_gc(array('foreground' => $fg_color,
 
9:                               'background' => $bg_color));
10:   $gc->function   GDK_XOR;
11:   $gc->line_width 3;
12:   $gc->cap_style  GDK_CAP_ROUND;
13?>
Using GCs
Simply pass the GC to the drawing function that you need to use. Which GC fields are used for the drawing operation depends on the function.

<?php gdk::draw_line($pixmap$gc00100100); ?>