gdk_gc_get_values returns strange things.



Hi,

I'm trying to retrieve colours from a a GdkGC, using
gdk_gc_get_values.

For some reason it doesn't do what I expect.  Can someone tell me why
the assertion in the following fragment fails:

static GtkGC *gc;

{
  GdkColor fg;
  gdouble colour[4];
  GdkGCValues values;
  GdkColormap *cmap = gdk_colormap_get_system();



  gtk_color_selection_get_color(clr_sel,colour);

  fg.red   = (gushort)(colour[0] * 65535);
  fg.green = (gushort)(colour[1] * 65535);
  fg.blue  = (gushort)(colour[2] * 65535);
 
  gdk_colormap_alloc_color(cmap,&fg,FALSE,TRUE) ;
  
  gdk_gc_set_foreground(gc,&fg);

  gdk_gc_get_values(gc,&values);

  assert(gdk_color_equal(&values.foreground,&fg));
}


It seems wierd to me.


-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://wwwkeys.pgp.net or any PGP keyserver for public key.


 

Attachment: pgpccS5_5pV6L.pgp
Description: PGP signature



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