diff options
author | Dan Vrátil <dvratil@redhat.com> | 2012-07-27 18:12:39 +0800 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2012-07-27 18:13:20 +0800 |
commit | 440e43d2894fdd517cc91302d4364b082e7d1d8b (patch) | |
tree | 7c39a2b70fe8bdef99ed1cce3c7b2e6d2406d0cc /e-util/e-util.c | |
parent | e03d9fbc7efba1a0239f85a8cf7339bbad6b1c7d (diff) | |
download | gsoc2013-evolution-440e43d2894fdd517cc91302d4364b082e7d1d8b.tar.gz gsoc2013-evolution-440e43d2894fdd517cc91302d4364b082e7d1d8b.tar.zst gsoc2013-evolution-440e43d2894fdd517cc91302d4364b082e7d1d8b.zip |
Bug #679404 - Read colors for message preview from Gtk theme
Diffstat (limited to 'e-util/e-util.c')
-rw-r--r-- | e-util/e-util.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c index a57998576a..2f84c34d9e 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -835,6 +835,31 @@ e_color_to_value (GdkColor *color) return (guint32) (((red << 16) | (green << 8) | blue) & 0xffffff); } +/** + * e_rgba_to_value: + * @rgba: a #GdkRGBA + * + + * Converts #GdkRGBA to a 24-bit RGB color value + * + * Returns: a 24-bit color value + **/ +guint32 +e_rgba_to_value (GdkRGBA *rgba) +{ + guint16 red; + guint16 green; + guint16 blue; + + g_return_val_if_fail (rgba != NULL, 0); + + red = ((guint16) (G_MAXUINT16 * rgba->red)) >> 8; + green = ((guint16) (G_MAXUINT16 * rgba->green)) >> 8; + blue = ((guint16) (G_MAXUINT16 * rgba->blue)) >> 8; + + return (guint32) (((red << 16) | (green << 8) | blue) & 0xffffff); +} + static gint epow10 (gint number) { |