From 77f95d22034783d6d41ec2ef42b5a225b012d6ca Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Fri, 16 Feb 2024 22:08:29 +0100 Subject: [PATCH] cogl: Drop unused Color APIs Simplifies the overall API as preparation of merging both CoglColor and ClutterColor Part-of: --- cogl/cogl/cogl-color.c | 114 ---------------------------- cogl/cogl/cogl-color.h | 165 ----------------------------------------- 2 files changed, 279 deletions(-) diff --git a/cogl/cogl/cogl-color.c b/cogl/cogl/cogl-color.c index 3e7bc024e..6014f1d1a 100644 --- a/cogl/cogl/cogl-color.c +++ b/cogl/cogl/cogl-color.c @@ -41,13 +41,6 @@ G_DEFINE_BOXED_TYPE (CoglColor, cogl_color_copy, cogl_color_free) - -CoglColor * -cogl_color_new (void) -{ - return g_new0 (CoglColor, 1); -} - CoglColor * cogl_color_copy (const CoglColor *color) { @@ -94,18 +87,6 @@ cogl_color_init_from_4f (CoglColor *color, color->alpha = (alpha * 255); } -void -cogl_color_init_from_4fv (CoglColor *color, - const float *color_array) -{ - g_return_if_fail (color != NULL); - - color->red = (color_array[0] * 255); - color->green = (color_array[1] * 255); - color->blue = (color_array[2] * 255); - color->alpha = (color_array[3] * 255); -} - unsigned char cogl_color_get_red_byte (const CoglColor *color) { @@ -178,90 +159,6 @@ cogl_color_get_alpha (const CoglColor *color) return ((float) color->alpha / 255.0); } -void -cogl_color_set_red_byte (CoglColor *color, - unsigned char red) -{ - color->red = red; -} - -void -cogl_color_set_red_float (CoglColor *color, - float red) -{ - color->red = red * 255.0; -} - -void -cogl_color_set_red (CoglColor *color, - float red) -{ - color->red = red * 255.0; -} - -void -cogl_color_set_green_byte (CoglColor *color, - unsigned char green) -{ - color->green = green; -} - -void -cogl_color_set_green_float (CoglColor *color, - float green) -{ - color->green = green * 255.0; -} - -void -cogl_color_set_green (CoglColor *color, - float green) -{ - color->green = green * 255.0; -} - -void -cogl_color_set_blue_byte (CoglColor *color, - unsigned char blue) -{ - color->blue = blue; -} - -void -cogl_color_set_blue_float (CoglColor *color, - float blue) -{ - color->blue = blue * 255.0; -} - -void -cogl_color_set_blue (CoglColor *color, - float blue) -{ - color->blue = blue * 255.0; -} - -void -cogl_color_set_alpha_byte (CoglColor *color, - unsigned char alpha) -{ - color->alpha = alpha; -} - -void -cogl_color_set_alpha_float (CoglColor *color, - float alpha) -{ - color->alpha = alpha * 255.0; -} - -void -cogl_color_set_alpha (CoglColor *color, - float alpha) -{ - color->alpha = alpha * 255.0; -} - void cogl_color_premultiply (CoglColor *color) { @@ -270,17 +167,6 @@ cogl_color_premultiply (CoglColor *color) color->blue = (color->blue * color->alpha + 128) / 255; } -void -cogl_color_unpremultiply (CoglColor *color) -{ - if (color->alpha != 0) - { - color->red = (color->red * 255) / color->alpha; - color->green = (color->green * 255) / color->alpha; - color->blue = (color->blue * 255) / color->alpha; - } -} - gboolean cogl_color_equal (const void *v1, const void *v2) { diff --git a/cogl/cogl/cogl-color.h b/cogl/cogl/cogl-color.h index 153fcd24d..4f1479efd 100644 --- a/cogl/cogl/cogl-color.h +++ b/cogl/cogl/cogl-color.h @@ -60,17 +60,6 @@ G_BEGIN_DECLS COGL_EXPORT GType cogl_color_get_type (void); -/** - * cogl_color_new: - * - * Creates a new (empty) color - * - * Return value: a newly-allocated #CoglColor. Use cogl_color_free() - * to free the allocated resources - */ -COGL_EXPORT CoglColor * -cogl_color_new (void); - /** * cogl_color_copy: * @color: the color to copy @@ -126,17 +115,6 @@ cogl_color_init_from_4f (CoglColor *color, float blue, float alpha); -/** - * cogl_color_init_from_4fv: - * @color: A pointer to a #CoglColor to initialize - * @color_array: a pointer to an array of 4 float color components - * - * Sets the values of the passed channels into a #CoglColor - */ -COGL_EXPORT void -cogl_color_init_from_4fv (CoglColor *color, - const float *color_array); - /** * cogl_color_get_red_byte: * @color: a #CoglColor @@ -281,138 +259,6 @@ cogl_color_get_blue (const CoglColor *color); COGL_EXPORT float cogl_color_get_alpha (const CoglColor *color); -/** - * cogl_color_set_red_byte: - * @color: a #CoglColor - * @red: a byte value between 0 and 255 - * - * Sets the red channel of @color to @red. - */ -COGL_EXPORT void -cogl_color_set_red_byte (CoglColor *color, - unsigned char red); - -/** - * cogl_color_set_green_byte: - * @color: a #CoglColor - * @green: a byte value between 0 and 255 - * - * Sets the green channel of @color to @green. - */ -COGL_EXPORT void -cogl_color_set_green_byte (CoglColor *color, - unsigned char green); - -/** - * cogl_color_set_blue_byte: - * @color: a #CoglColor - * @blue: a byte value between 0 and 255 - * - * Sets the blue channel of @color to @blue. - */ -COGL_EXPORT void -cogl_color_set_blue_byte (CoglColor *color, - unsigned char blue); - -/** - * cogl_color_set_alpha_byte: - * @color: a #CoglColor - * @alpha: a byte value between 0 and 255 - * - * Sets the alpha channel of @color to @alpha. - */ -COGL_EXPORT void -cogl_color_set_alpha_byte (CoglColor *color, - unsigned char alpha); - -/** - * cogl_color_set_red_float: - * @color: a #CoglColor - * @red: a float value between 0.0f and 1.0f - * - * Sets the red channel of @color to @red. - */ -COGL_EXPORT void -cogl_color_set_red_float (CoglColor *color, - float red); - -/** - * cogl_color_set_green_float: - * @color: a #CoglColor - * @green: a float value between 0.0f and 1.0f - * - * Sets the green channel of @color to @green. - */ -COGL_EXPORT void -cogl_color_set_green_float (CoglColor *color, - float green); - -/** - * cogl_color_set_blue_float: - * @color: a #CoglColor - * @blue: a float value between 0.0f and 1.0f - * - * Sets the blue channel of @color to @blue. - */ -COGL_EXPORT void -cogl_color_set_blue_float (CoglColor *color, - float blue); - -/** - * cogl_color_set_alpha_float: - * @color: a #CoglColor - * @alpha: a float value between 0.0f and 1.0f - * - * Sets the alpha channel of @color to @alpha. - */ -COGL_EXPORT void -cogl_color_set_alpha_float (CoglColor *color, - float alpha); - -/** - * cogl_color_set_red: - * @color: a #CoglColor - * @red: a float value between 0.0f and 1.0f - * - * Sets the red channel of @color to @red. - */ -COGL_EXPORT void -cogl_color_set_red (CoglColor *color, - float red); - -/** - * cogl_color_set_green: - * @color: a #CoglColor - * @green: a float value between 0.0f and 1.0f - * - * Sets the green channel of @color to @green. - */ -COGL_EXPORT void -cogl_color_set_green (CoglColor *color, - float green); - -/** - * cogl_color_set_blue: - * @color: a #CoglColor - * @blue: a float value between 0.0f and 1.0f - * - * Sets the blue channel of @color to @blue. - */ -COGL_EXPORT void -cogl_color_set_blue (CoglColor *color, - float blue); - -/** - * cogl_color_set_alpha: - * @color: a #CoglColor - * @alpha: a float value between 0.0f and 1.0f - * - * Sets the alpha channel of @color to @alpha. - */ -COGL_EXPORT void -cogl_color_set_alpha (CoglColor *color, - float alpha); - /** * cogl_color_premultiply: * @color: the color to premultiply @@ -424,17 +270,6 @@ cogl_color_set_alpha (CoglColor *color, COGL_EXPORT void cogl_color_premultiply (CoglColor *color); -/** - * cogl_color_unpremultiply: - * @color: the color to unpremultiply - * - * Converts a pre-multiplied color to a non-premultiplied color. For - * example, semi-transparent red is (0.5, 0, 0, 0.5) when premultiplied - * and (1.0, 0, 0, 0.5) when non-premultiplied. - */ -COGL_EXPORT void -cogl_color_unpremultiply (CoglColor *color); - /** * cogl_color_equal: * @v1: a #CoglColor