summaryrefslogtreecommitdiff
path: root/eel/eel-gdk-extensions.c
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-06-16 13:35:02 +0200
committerraveit65 <[email protected]>2016-07-02 10:50:56 +0200
commite983f64abd52242d96d9ed3825395f2e1f3dea5e (patch)
tree1db22130eda2f1d23818334a76a926e37b056f13 /eel/eel-gdk-extensions.c
parentd829c648eb20daa6ad487768195e1379a2ddb135 (diff)
downloadcaja-e983f64abd52242d96d9ed3825395f2e1f3dea5e.tar.bz2
caja-e983f64abd52242d96d9ed3825395f2e1f3dea5e.tar.xz
GTK+-3 eel: rename GdkRGBA functions
Diffstat (limited to 'eel/eel-gdk-extensions.c')
-rw-r--r--eel/eel-gdk-extensions.c78
1 files changed, 55 insertions, 23 deletions
diff --git a/eel/eel-gdk-extensions.c b/eel/eel-gdk-extensions.c
index 878586ef..00697d4c 100644
--- a/eel/eel-gdk-extensions.c
+++ b/eel/eel-gdk-extensions.c
@@ -312,18 +312,18 @@ eel_gradient_set_bottom_color_spec (const char *gradient_spec,
return eel_gradient_set_edge_color (gradient_spec, bottom_color, FALSE, TRUE);
}
+#if GTK_CHECK_VERSION (3, 0, 0)
/**
- * eel_gdk_color_parse_with_white_default
- * @color_spec: A color spec, or NULL.
+ * eel_gdk_rgba_parse_with_white_default
* @color: Pointer to place to put resulting color.
+ * @color_spec: A color spec, or NULL.
*
- * The same as gdk_color_parse, except sets the color to white if
+ * The same as gdk_rgba_parse, except sets the color to white if
* the spec. can't be parsed, instead of returning a boolean flag.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
void
-eel_gdk_color_parse_with_white_default (const char *color_spec,
- GdkRGBA *color)
+eel_gdk_rgba_parse_with_white_default (GdkRGBA *color,
+ const char *color_spec)
{
gboolean got_color;
@@ -346,6 +346,14 @@ eel_gdk_color_parse_with_white_default (const char *color_spec,
}
}
#else
+/**
+ * eel_gdk_color_parse_with_white_default
+ * @color_spec: A color spec, or NULL.
+ * @color: Pointer to place to put resulting color.
+ *
+ * The same as gdk_color_parse, except sets the color to white if
+ * the spec. can't be parsed, instead of returning a boolean flag.
+ */
void
eel_gdk_color_parse_with_white_default (const char *color_spec,
GdkColor *color)
@@ -390,41 +398,50 @@ eel_rgb8_to_rgb (guchar r, guchar g, guchar b)
return eel_rgb16_to_rgb (r << 8, g << 8, b << 8);
}
+#if GTK_CHECK_VERSION (3, 0, 0)
/**
- * eel_gdk_color_to_rgb
- * @color: A GdkColor style color.
+ * eel_gdk_rgba_to_rgb
+ * @color: A GdkRGBA style color.
* Returns: An rgb value.
*
- * Converts from a GdkColor stlye color to a gdk_rgb one.
+ * Converts from a GdkRGBA style color to a gdk_rgb one.
* Alpha gets set to fully opaque
*/
guint32
-#if GTK_CHECK_VERSION (3, 0, 0)
-eel_gdk_color_to_rgb (const GdkRGBA *color)
+eel_gdk_rgba_to_rgb (const GdkRGBA *color)
{
return eel_rgb16_to_rgb ((guint) (color->red * 65535),
(guint) (color->green * 65535),
(guint) (color->blue * 65535));
}
#else
+/**
+ * eel_gdk_color_to_rgb
+ * @color: A GdkColor style color.
+ * Returns: An rgb value.
+ *
+ * Converts from a GdkColor style color to a gdk_rgb one.
+ * Alpha gets set to fully opaque
+ */
+guint32
eel_gdk_color_to_rgb (const GdkColor *color)
{
return eel_rgb16_to_rgb (color->red, color->green, color->blue);
}
#endif
+#if GTK_CHECK_VERSION (3, 0, 0)
/**
- * eel_gdk_rgb_to_color
+ * eel_gdk_rgb_to_rgba
* @color: a gdk_rgb style value.
*
- * Converts from a gdk_rgb value style to a GdkColor one.
+ * Converts from a gdk_rgb value style to a GdkRGBA one.
* The gdk_rgb color alpha channel is ignored.
*
- * Return value: A GdkColor structure version of the given RGB color.
+ * Return value: A GdkRGBA structure version of the given RGB color.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA
-eel_gdk_rgb_to_color (guint32 color)
+eel_gdk_rgb_to_rgba (guint32 color)
{
GdkRGBA result;
@@ -432,6 +449,15 @@ eel_gdk_rgb_to_color (guint32 color)
result.green = ((color >> 8) & 0xFF) / 0xFF;
result.blue = (color & 0xff) / 0xFF;
#else
+/**
+ * eel_gdk_rgb_to_color
+ * @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 GdkColor structure version of the given RGB color.
+ */
GdkColor
eel_gdk_rgb_to_color (guint32 color)
{
@@ -461,13 +487,13 @@ eel_gdk_rgb_to_color_spec (const guint32 color)
return g_strdup_printf ("#%06X", (guint) (color & 0xFFFFFF));
}
+#if GTK_CHECK_VERSION(3,0,0)
/**
- * eel_gdk_color_is_dark:
+ * eel_gdk_rgba_is_dark:
*
* Return true if the given color is `dark'
*/
gboolean
-#if GTK_CHECK_VERSION(3,0,0)
eel_gdk_rgba_is_dark (const GdkRGBA *color)
{
int intensity;
@@ -476,6 +502,12 @@ eel_gdk_rgba_is_dark (const GdkRGBA *color)
+ (((int) (color->green) >> 8) * 150)
+ (((int) (color->blue) >> 8) * 28)) >> 8;
#else
+/**
+ * eel_gdk_color_is_dark:
+ *
+ * Return true if the given color is `dark'
+ */
+gboolean
eel_gdk_color_is_dark (GdkColor *color)
{
int intensity;
@@ -612,7 +644,7 @@ eel_make_color_inactive (GdkRGBA *color)
#if GTK_CHECK_VERSION(3,0,0)
static char *
-eel_gdk_color_as_hex_string (GdkRGBA color)
+eel_gdk_rgba_as_hex_string (GdkRGBA color)
{
return g_strdup_printf ("%04X%04X%04X",
(guint) (color.red * 65535),
@@ -625,8 +657,8 @@ eel_self_check_parse (const char *color_spec)
{
GdkRGBA color;
- eel_gdk_color_parse_with_white_default (color_spec, &color);
- return eel_gdk_color_as_hex_string (color);
+ eel_gdk_rgba_parse_with_white_default (&color, color_spec);
+ return eel_gdk_rgba_as_hex_string (color);
}
static char *
@@ -634,9 +666,9 @@ eel_self_check_gdk_rgb_to_color (guint32 color)
{
GdkRGBA result;
- result = eel_gdk_rgb_to_color (color);
+ result = eel_gdk_rgb_to_rgba (color);
- return eel_gdk_color_as_hex_string (result);
+ return eel_gdk_rgba_as_hex_string (result);
}
#else
static char *