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

Re: setting Gtk2::Gdk::Color pixel



muppet <scott asofyet org> writes:
>
> In my experience, you don't try to take that kind of knowledge of the  
> background; either do the plain XOR or expect to clear and redraw the  
> background.

I suppose it's a bit old school, but in the right circumstances it's
portable and fast.  At any rate could Gtk2::Gdk::Color->new take an
optional pixel value per below?

(I thought about a couple of words for the docs there, or even just the
comments, but I suspect it's better to leave the obscurities of what
fields are used when to Gtk and X.)

Some setter funcs too could let you re-use a color object I guess, for
doing things in a loop, but making a new one each time probably isn't
terribly expensive.

--- GdkColor.xs	23 Jul 2007 07:50:20 +1000	1.21
+++ GdkColor.xs	19 Nov 2007 10:59:49 +1100	
@@ -186,19 +186,18 @@
 =cut
 
 GdkColor_own *
-gdk_color_new (class, red, green, blue)
+gdk_color_new (class, red, green, blue, pixel=0)
 	guint16 red
 	guint16 green
 	guint16 blue
+	guint32 pixel
     PREINIT:
 	GdkColor c;
     CODE:
-	/* pixel==0 for unallocated color is not enforced by gdk, but
-	 * doing this hushes valgrind about using uninitialized values. */
-	c.pixel = 0;
 	c.red = red;
 	c.green = green;
 	c.blue = blue;
+	c.pixel = pixel;
 	RETVAL = gdk_color_copy (&c);
     OUTPUT:
 	RETVAL


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