Re: gnome canvas



Thanks, I'm probably going to try the pixbuf approach. There are also
two macros GNOME_CANVAS_COLOR, and GNOME_CANVAS_COLOR_A, which pack the
bits as you described.


On Thu, 2003-09-18 at 14:48, Ole Laursen wrote:
> Jacob Gladish <gladish spinnakernet com> writes:
> 
> > I'm using a GnomeCanvas to draw a gradient, and the only way I see to do
> > that is to draw a series of lines with colors gradually changing from
> > the start color to the finish color. Is there a better way to do
> > this,
> 
> Depending on your needs, perhaps it would be faster if you rendered a
> GdkPixbuf yourself and used GnomeCanvasPixbuf.
> 
> > and if not, is there a way to set an rgb color value for a line, or
> > better yet, an rgba value? I'm using an anti-aliased GnomeCanvas.
> > 
> >   gnome_canvas_item_new(
> >             gnome_canvas_root( GNOME_CANVAS(canvas) ),
> >             gnome_canvas_line_get_type(),
> >             "points",     points,
> >             "fill_color", (idx % 2 == 0 ? "red" : "green"),
> >             "width_units", 1.0,
> >             NULL );
> 
> You can use the property "fill_color_rbga" which takes a packed
> unsigned int with the color; you can pack it with
> 
>   (r & 255) << 24) | ((g & 255) << 16) | ((b & 255) << 8) | (a & 255)
> 
> if I recall correctly.
-- 
Jacob Gladish <gladish spinnakernet com>
Spinnaker Networks




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