After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 345828 - color palette optimization
color palette optimization
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-06-24 17:51 UTC by David Trowbridge
Modified: 2014-03-22 22:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch against HEAD (15.79 KB, patch)
2006-06-24 17:55 UTC, David Trowbridge
needs-work Details | Review

Description David Trowbridge 2006-06-24 17:51:41 UTC
This is the color palette creation method used in xchat-gnome.  I had multiple requests from people wishing to use this method in other things (vte, etc), so it seems like something that could be useful for GTK+.
Comment 1 David Trowbridge 2006-06-24 17:55:14 UTC
Created attachment 67950 [details] [review]
patch against HEAD

My first shot at integrating this into GTK+.  I chose to do the API this way because any particular application is probably only interested in a subset of the colors (for example, vte only wants those colors which can be specified using ANSI codes).
Comment 2 Emmanuele Bassi (:ebassi) 2007-03-30 07:42:31 UTC
minor nitpicking on the code style:

 if (condition) statement;
 else           statement;

are ugly, error-prone and possibly other five or six other things; GLib already has a CLAMP() macro, no need to reinvent the wheel; I'd like a URL in the comment for the transformations, so that they can be checked, especially wrt. the magic numbers;

+  points[0][0] = color_regions[color][0]; points[0][1] = color_regions[color][2]; points[0][2] = color_regions[color][4];
+  points[1][0] = color_regions[color][0]; points[1][1] = color_regions[color][2]; points[1][2] = color_regions[color][5];
...

probably that wants a macro #defined and #undefined in the function body and a wee bit shorter lines (~90/100);

+GdkColor    gtk_style_render_foreground_color (GtkStyle        *style,
+                                               GtkStateType     state,
+                                               GtkPaletteColor  color);

probably you meant to return GdkColor* - but, in any case, this should probably return a boolean (conversion successful) and have a pointer to the returned GdkColor as an argument, like this:

  gboolean gtk_style_render_foreground_color (GtkStyle        *style,
                                              GtkStateType     state,
                                              GtkPaletteColor  palette_color,
                                              GdkColor        *color);
Comment 3 Matthias Clasen 2014-03-22 22:24:06 UTC
we have a new colorchooser now, and it has new palettes