[gnome-love] GnomeCanvas-2.0.0 and clipgroups



Hi There.

Have been playing around with the Gnome 2 environment for a while and   
though its great environ to code in, I've been running into a wall with
some of the Documentation (a situation I hope to able to contribute to
... when I understand it myself =) )

I've been primarily working with the Canvas for the last few days, and
have a handle on most of the basic primitives (after digging through the
canvas-demo code).  The problem now lies with trying to clip a group of
GnomeCanvasItems in a rectangular bounding box.  

I've grepped for gnome_canvas_clipgroup_get_type through all the Gnome2-based 
code I can lay my hands on, but the only place its used is in gnome-print-preview.c
... and I can't seem to track the codepath that uses the code in question.

To do this, I've tried using:


clip_path = gnome_canvas_path_def_new_sized (4);
        
gnome_canvas_path_def_moveto (clip_path, CLIP_OFFSET, CLIP_OFFSET);
gnome_canvas_path_def_lineto (clip_path, WIDTH - CLIP_OFFSET,
        CLIP_OFFSET);
gnome_canvas_path_def_lineto (clip_path, WIDTH - CLIP_OFFSET,   HEIGHT -
        CLIP_OFFSET);
gnome_canvas_path_def_lineto (clip_path, CLIP_OFFSET, HEIGHT -
        CLIP_OFFSET);
gnome_canvas_path_def_closepath (clip_path);

root = gnome_canvas_root (GNOME_CANVAS (canvas));       
clipgroup = gnome_canvas_item_new (root, 
        gnome_canvas_clipgroup_get_type (),
        "path", clip_path,
        NULL);  
root = GNOME_CANVAS_GROUP (clipgroup); 


And then using root as the GnomeCanvasGroup for subsequent item_new
calls.

This, however, doesn't work.  Its obvious that I don't understand how
(and if) clipping works as I'd expect.

Is there a way to do this?  And if so, how would one go about it?

Thanks in advance,
Brad.
-- 
Bradley Shuttleworth
Deimos Information Engineering
brad deimos co za

Necessity is the plea for every infringement of human freedom. It is the
argument of tyrants; it is the creed of slaves. -William Pitt, British
prime-minister (1759-1806) 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]