Re: Colours...



On Mon, 3 Jun 2002 12:48:55 +0100
Ian Molton <spyro armlinux org> wrote:

I think you can also use the colormap of your widget when allocating
the color, rather than creating a new one.

colormap = gtk_widget_get_colormap (widget);
gdk_colormap_alloc_color (colormap, &colour, TRUE, TRUE);

that wouldnt compile, but this did, although it didnt work any better
than the previous code...

        backgroundgc = gdk_gc_new(pixmap);
        gdk_color_parse("004000", &colour);
        colourmap = gdk_drawable_get_colormap(pixmap);
        gdk_colormap_alloc_color(colourmap, &colour, FALSE, TRUE);
        gdk_gc_set_foreground(backgroundgc, &colour);

I get a 'muddy orange', when I am sure it should be a darkish green...

I think you need "#004000" (with the hash).

Instead of gdk_color_parse, I always use:

colour.red = 0x0000;
colour.green = 0x4000;
colour.blue = 0x0000;
gdk_colormap_alloc_color(...);


-- 
Peter.



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