public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
* Completed RGB functionality
@ 2003-05-07  4:22 Marko Rauhamaa
  2003-05-15 23:00 ` Kevin Ryde
  0 siblings, 1 reply; 7+ messages in thread
From: Marko Rauhamaa @ 2003-05-07  4:22 UTC (permalink / raw)
  To: guile-gtk

Summary: Completed RGB functionality.

Details and Notes:

 - gdk-1.2.defs: Decided not to implement the function
   gdk_rgb_xpixel_from_rgb since it would have no use in scheme code.
   Instead, I implemented (gdk-color-new rgb), which calls
   gdk_rgb_xpixel_from_rgb to create a new GdkColor. Gdk-color-new has
   no C equivalent.

 - gdk-1.2.defs: Made the "pixel" field of GdkColor accessible to scheme
   code.

 - gdk-1.2.defs, guile-gtk.h, gdk-support.c: Implemented
   GdkRgbCmap and the remaining RGB functions.

 - All RGB functions make sure gdk_rgb_init gets called. The redundant
   function gdk-rgb-init is still accessible from scheme code, though.

-- 
Marko Rauhamaa      mailto:marko@pacujo.net     http://pacujo.net/marko/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Completed RGB functionality
  2003-05-07  4:22 Completed RGB functionality Marko Rauhamaa
@ 2003-05-15 23:00 ` Kevin Ryde
  2003-05-16  5:42   ` Marko Rauhamaa
                     ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kevin Ryde @ 2003-05-15 23:00 UTC (permalink / raw)
  To: Marko Rauhamaa; +Cc: guile-gtk

Marko Rauhamaa <marko@pacujo.net> writes:
>
>  - gdk-1.2.defs: Decided not to implement the function
>    gdk_rgb_xpixel_from_rgb since it would have no use in scheme code.
>    Instead, I implemented (gdk-color-new rgb), which calls
>    gdk_rgb_xpixel_from_rgb to create a new GdkColor. Gdk-color-new has
>    no C equivalent.

I don't think this should be called gdk-color-new, a name like that
gives no hint that GdkRGB is being run.

I'd suggest gdk-color-new should just create a GdkColor object with
zero fields.  Field setter functions can be introduced to manipulate
them.

I think field setters would be good anyway (for gdk_colormap_alloc and
friends for instance), and in this case they'd mean a direct
gdk_rgb_xpixel_from_rgb was useful.

Another thing field setters would do is mean that gdk-color-change can
take the same parameters as the C gdk_color_change, ie. a GdkColor
containing a pixel value.  Unnecessary variations between the C and
Scheme functions are not good.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Completed RGB functionality
  2003-05-15 23:00 ` Kevin Ryde
@ 2003-05-16  5:42   ` Marko Rauhamaa
  2003-06-14 23:46   ` GdkColor field setters (was: Completed RGB functionality) Kevin Ryde
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Marko Rauhamaa @ 2003-05-16  5:42 UTC (permalink / raw)
  To: guile-gtk

Kevin Ryde <user42@zip.com.au>:

> I don't think this should be called gdk-color-new, a name like that
> gives no hint that GdkRGB is being run.

I have since renamed the function as gdk-color-new-from-rgb.


Marko

-- 
Marko Rauhamaa      mailto:marko@pacujo.net     http://pacujo.net/marko/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* GdkColor field setters (was: Completed RGB functionality)
  2003-05-15 23:00 ` Kevin Ryde
  2003-05-16  5:42   ` Marko Rauhamaa
@ 2003-06-14 23:46   ` Kevin Ryde
  2003-06-15  0:11   ` gdk-color-change params " Kevin Ryde
  2003-08-09  0:47   ` gdk-color-new " Kevin Ryde
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Ryde @ 2003-06-14 23:46 UTC (permalink / raw)
  To: guile-gtk

[-- Attachment #1: Type: text/plain, Size: 241 bytes --]

I wrote:
>
> I'd suggest gdk-color-new should just create a GdkColor object with
> zero fields.  Field setter functions can be introduced to manipulate
> them.

As threatened,

        * gdk-1.2.defs (GdkColor): Add setters for all fields.


[-- Attachment #2: gdk-1.2.defs.color-setters.diff --]
[-- Type: text/plain, Size: 659 bytes --]

Index: gdk-1.2.defs
===================================================================
RCS file: /cvsroot/guile-gtk/guile-gtk-1.2/gdk-1.2.defs,v
retrieving revision 1.31
diff -u -u -r1.31 gdk-1.2.defs
--- gdk-1.2.defs	1 Jun 2003 05:52:43 -0000	1.31
+++ gdk-1.2.defs	14 Jun 2003 23:42:57 -0000
@@ -413,10 +413,10 @@
 (define-boxed GdkColor
   (copy gdk_color_copy)
   (free gdk_color_free)
-  (fields (ulong pixel)
-	  (uint red)
-	  (uint green)
-	  (uint blue))
+  (fields (ulong pixel (setter #t))
+	  (uint red    (setter #t))
+	  (uint green  (setter #t))
+	  (uint blue   (setter #t)))
   (conversion "sgtk_color_conversion"))
 
 (define-boxed GdkImage

^ permalink raw reply	[flat|nested] 7+ messages in thread

* gdk-color-change params (was: Completed RGB functionality)
  2003-05-15 23:00 ` Kevin Ryde
  2003-05-16  5:42   ` Marko Rauhamaa
  2003-06-14 23:46   ` GdkColor field setters (was: Completed RGB functionality) Kevin Ryde
@ 2003-06-15  0:11   ` Kevin Ryde
  2003-06-15  2:38     ` Marko Rauhamaa
  2003-08-09  0:47   ` gdk-color-new " Kevin Ryde
  3 siblings, 1 reply; 7+ messages in thread
From: Kevin Ryde @ 2003-06-15  0:11 UTC (permalink / raw)
  To: guile-gtk

[-- Attachment #1: Type: text/plain, Size: 797 bytes --]

I wrote:
>
> Another thing field setters would do is mean that gdk-color-change can
> take the same parameters as the C gdk_color_change, ie. a GdkColor
> containing a pixel value.  Unnecessary variations between the C and
> Scheme functions are not good.

I propose to make this change,

        * gdk-1.2.defs (gdk_color_change): Remove separate pixel parameter,
        take scheme-level parameters the same as the C function.
        * gdk-support.c (gdk_color_change_interp): Remove.

Whether a GdkColor structure is a particularly good way to pass
pixel+r+g+b is a matter for debate, personally I think it's sensible
enough in the context of colormap tricks.  Either way if there's a
burning need for some other interface then it should be under a new
name to avoid any possible confusion.


[-- Attachment #2: gdk-1.2.defs.color-change.diff --]
[-- Type: text/plain, Size: 618 bytes --]

--- gdk-1.2.defs.~1.32.~	2003-06-15 09:28:33.000000000 +1000
+++ gdk-1.2.defs	2003-06-15 09:59:06.000000000 +1000
@@ -1413,14 +1413,9 @@
   (GdkColor (copy #f))
   ((string spec)))
 
-(define-func gdk_color_change_interp
+(define-func gdk_color_change
   bool
   ((GdkColormap colormap)
-   ; The cmap_index is not there in gdk_color_change; gdk_color_change
-   ; adopts the ugly XStoreColor hack that stores the index in the pixel
-   ; value of the color. We ignore the pixel value and devote a whole
-   ; parameter for the worthy cause.
-   (int cmap_index)
    (GdkColor color)))
 
 (define-func gdk_color_equal

[-- Attachment #3: gdk-support.c.color-change.diff --]
[-- Type: text/plain, Size: 493 bytes --]

--- gdk-support.c.~1.22.~	2003-06-15 09:31:25.000000000 +1000
+++ gdk-support.c	2003-06-15 10:01:46.000000000 +1000
@@ -1406,16 +1406,6 @@
   return gdk_color_black (colormap, &color) ? gdk_color_copy (&color) : NULL;
 }
 
-int
-gdk_color_change_interp (GdkColormap *colormap, gint cmap_index,
-			 GdkColor *color)
-{
-  GdkColor _color;
-  _color = *color;
-  _color.pixel = cmap_index;
-  return gdk_color_change (colormap, &_color);
-}
-
 guint
 gdk_color_hash_interp (GdkColor *color)
 {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: gdk-color-change params (was: Completed RGB functionality)
  2003-06-15  0:11   ` gdk-color-change params " Kevin Ryde
@ 2003-06-15  2:38     ` Marko Rauhamaa
  0 siblings, 0 replies; 7+ messages in thread
From: Marko Rauhamaa @ 2003-06-15  2:38 UTC (permalink / raw)
  To: guile-gtk

Kevin Ryde <user42@zip.com.au>:

> I propose to make this change,

Go ahead.

I joined the group when I realized that my unemployment was long-term.
"Unfortunately," I landed a job a few weeks after the realization, and
at the moment I have very little time for extra-curricular activities.

I'm following the list, though, and I'm always willing to clean up
messes I may have caused.

So take it over, Kevin. You seem to have the will and the vision.


Marko

-- 
Marko Rauhamaa      mailto:marko@pacujo.net     http://pacujo.net/marko/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* gdk-color-new (was: Completed RGB functionality)
  2003-05-15 23:00 ` Kevin Ryde
                     ` (2 preceding siblings ...)
  2003-06-15  0:11   ` gdk-color-change params " Kevin Ryde
@ 2003-08-09  0:47   ` Kevin Ryde
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Ryde @ 2003-08-09  0:47 UTC (permalink / raw)
  To: guile-gtk

I added gdk-color-new, as threatened.  I propose to remove
gdk-color-new-from-rgb, since I don't think it adds much.  Pixels can
be had directly with gdk-rgb-xpixel-from-rgb if desired.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-08-09  0:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-07  4:22 Completed RGB functionality Marko Rauhamaa
2003-05-15 23:00 ` Kevin Ryde
2003-05-16  5:42   ` Marko Rauhamaa
2003-06-14 23:46   ` GdkColor field setters (was: Completed RGB functionality) Kevin Ryde
2003-06-15  0:11   ` gdk-color-change params " Kevin Ryde
2003-06-15  2:38     ` Marko Rauhamaa
2003-08-09  0:47   ` gdk-color-new " Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).