summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-gdk-extensions.c
diff options
context:
space:
mode:
authorMathieu Lacage <mathieu@eazel.com>2000-08-24 23:44:02 +0000
committerMathieu Lacage <mathieu@src.gnome.org>2000-08-24 23:44:02 +0000
commitd1fe890d5ad698532f254a4ee0b0e27cebf97379 (patch)
tree2dc590d0434b71451b7bbb7a8cda27d59a3d2162 /libnautilus-private/nautilus-gdk-extensions.c
parentad87d257ec37ec7c5861f88a97e21b717b3d3f9e (diff)
downloadnautilus-d1fe890d5ad698532f254a4ee0b0e27cebf97379.tar.gz
space, (nautilus_gdk_rgb_to_color): add function.. could be useful. add
2000-08-24 Mathieu Lacage <mathieu@eazel.com> * nautilus-gdk-extensions.c: (nautilus_gdk_color_to_rgb): space, (nautilus_gdk_rgb_to_color): add function.. could be useful. * nautilus-gdk-extensions.h: add prototype. * nautilus-gtk-extensions.c: (rgb_to_hls): new internal function. converts from rgb to hls., (hls_to_rgb): from hls to rgb, (nautilus_gtk_style_shade): necassery magic to "shade a color by a given amount... All this was copied from panel.c which was in turn copied from gtk. * nautilus-gtk-extensions.h: add prototype.
Diffstat (limited to 'libnautilus-private/nautilus-gdk-extensions.c')
-rw-r--r--libnautilus-private/nautilus-gdk-extensions.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/libnautilus-private/nautilus-gdk-extensions.c b/libnautilus-private/nautilus-gdk-extensions.c
index b6c870415..7381b48d2 100644
--- a/libnautilus-private/nautilus-gdk-extensions.c
+++ b/libnautilus-private/nautilus-gdk-extensions.c
@@ -472,7 +472,7 @@ guint32
nautilus_gdk_color_to_rgb (const GdkColor *color)
{
guint32 result;
-
+
result = (0xff0000 | (color->red & 0xff00));
result <<= 8;
result |= ((color->green & 0xff00) | (color->blue >> 8));
@@ -480,6 +480,30 @@ nautilus_gdk_color_to_rgb (const GdkColor *color)
return result;
}
+/**
+ * nautilus_gdk_color_to_rgb
+ * @color: a gdk_rgb style value.
+ *
+ * Converts from a gdk_rgb value style to a GdkColor one.
+ * The gdk_rgb color alpha channel is ignored.
+ *
+ * Return value: a newly allocated GdkColor.
+ */
+GdkColor *
+nautilus_gdk_rgb_to_color (const guint32 color)
+{
+ GdkColor *result;
+
+ result = g_new0 (GdkColor, 1);
+
+ result->red = (color & 0xff0000) >> 16 ;
+ result->green = (color & 0xff00);
+ result->blue = color << 8;
+
+ return result;
+}
+
+
static guint32
nautilus_shift_color_component (guchar component, float shift_by)
{