Drawing a selection-region




Using something like this (see below), I create a filled polygon that
looks like the selected-region of an application like Nautilus. It's
not, however, the exact same drawing. On my drawing I can see the points
which make it appear semi-transparant. On Nautilus, you cannot see such
points, the drawables in the background have gotten another color so
that it looks like stuff is semitransparant or .. well, thats the
question. How do I make a selected region like nautilus does.

The Nautilus experts know from the code below that I already searched
their code to know how to use the "eel_stipple_bitmap_for_screen"
function of eel. So I am not finding it in the sources of Nautilus if
your answer is going to be: Use the force Luke. Lets face it :-),
Nautilus is a huge piece of code.

Note that I want to draw this on a GtkDrawingArea which might already
have other stuff drawn upon it (and that stuff should still be visible
but while selected should get another color or the selected-area should
look like a colored-glass in front of it, just like the selected-region
of Nautilus).

        GdkPoint *points = g_new0 (GdkPoint, 4);
        GdkColor color;
        GdkDrawable *drawable = (my GtkDrawingArea)->window
        GdkGC *gc = new for drawable

        gdk_gc_set_rgb_fg_color (gc, &color);
        gdk_gc_set_fill (gc, GDK_STIPPLED);
        gdk_gc_set_stipple (gc, eel_stipple_bitmap_for_screen (
                gdk_drawable_get_screen (GDK_DRAWABLE (drawable))));

        gdk_draw_polygon (drawable, gc, TRUE, points, 4); 

        gdk_gc_set_fill (gc, GDK_SOLID);
        gdk_gc_set_line_attributes (gc, 1, GDK_LINE_SOLID, GDK_CAP_ROUND,
GDK_JOIN_ROUND);

        gdk_draw_polygon (drawable, gc, FALSE, points, 4);



-- 
Philip Van Hoof, Software Developer @ Cronos
home: me at freax dot org
gnome: pvanhoof at gnome dot org
work: philip dot vanhoof at cronos dot be
junk: philip dot vanhoof at gmail dot com
http://www.freax.be, http://www.freax.eu.org




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