Colours...
- From: Ian Molton <spyro armlinux org>
- To: gtk-app-devel-list gnome org
- Subject: Colours...
- Date: Mon, 3 Jun 2002 00:52:47 +0100
Hi.
Two things:
1) Can whoever receives this figure out why my mail is going to a
moderator?
I dont post here much, so I suspect Im receiving the mail from an old
address and my new one isnt registered.
my old address probably has imolton * in it.
my current address is spyro armlinux org
2) Can someone explain the horrible mess that seems to obscure choosing
a simple colour?
I want to modify the (gtk2) scribble example so that I can draw a chart
on the backing pixmap. to do this, I thought I would create my own GC
with its own foreground colour, and simply draw a line.
well, I thought I'd start simple and simply change the colour of the
'foreground' (the rectangle used to clear the pixmap). here is my
attempt, which does not work:
----------------------------------------------------------------
static GdkPixmap *pixmap = NULL;
/* Create a new backing pixmap of the appropriate size */
static gint configure_event( GtkWidget *widget,
GdkEventConfigure *event )
{
GdkGC *backgroundgc;
GdkColor colour;
GdkVisual *visual;
GdkColormap *colourmap;
if (pixmap)
g_object_unref (pixmap);
pixmap = gdk_pixmap_new (widget->window,
widget->allocation.width,
widget->allocation.height,
-1);
backgroundgc = gdk_gc_new(pixmap);
gdk_color_parse("004400", &colour);
visual = gdk_visual_get_system();
colourmap = gdk_colormap_new(visual, TRUE);
gdk_colormap_alloc_color(colourmap, &colour, FALSE, TRUE);
gdk_gc_set_foreground(backgroundgc, &colour);
gdk_draw_rectangle (pixmap,
/*widget->style->white_gc,*/
backgroundgc,
TRUE,
0, 0,
widget->allocation.width,
widget->allocation.height);
return TRUE;
}
------------------------------------------------
God, I miss GCOL r,g,b on BBC basic V5. colourmaps suck ass, IMO.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]