cogl: Drop unused Color APIs

Simplifies the overall API as preparation of merging both
CoglColor and ClutterColor

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3594>
This commit is contained in:
Bilal Elmoussaoui 2024-02-16 22:08:29 +01:00 committed by Marge Bot
parent f94e72097d
commit 77f95d2203
2 changed files with 0 additions and 279 deletions

View File

@ -41,13 +41,6 @@ G_DEFINE_BOXED_TYPE (CoglColor,
cogl_color_copy, cogl_color_copy,
cogl_color_free) cogl_color_free)
CoglColor *
cogl_color_new (void)
{
return g_new0 (CoglColor, 1);
}
CoglColor * CoglColor *
cogl_color_copy (const CoglColor *color) cogl_color_copy (const CoglColor *color)
{ {
@ -94,18 +87,6 @@ cogl_color_init_from_4f (CoglColor *color,
color->alpha = (alpha * 255); 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 unsigned char
cogl_color_get_red_byte (const CoglColor *color) 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); 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 void
cogl_color_premultiply (CoglColor *color) cogl_color_premultiply (CoglColor *color)
{ {
@ -270,17 +167,6 @@ cogl_color_premultiply (CoglColor *color)
color->blue = (color->blue * color->alpha + 128) / 255; 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 gboolean
cogl_color_equal (const void *v1, const void *v2) cogl_color_equal (const void *v1, const void *v2)
{ {

View File

@ -60,17 +60,6 @@ G_BEGIN_DECLS
COGL_EXPORT COGL_EXPORT
GType cogl_color_get_type (void); 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: * cogl_color_copy:
* @color: the color to copy * @color: the color to copy
@ -126,17 +115,6 @@ cogl_color_init_from_4f (CoglColor *color,
float blue, float blue,
float alpha); 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: * cogl_color_get_red_byte:
* @color: a #CoglColor * @color: a #CoglColor
@ -281,138 +259,6 @@ cogl_color_get_blue (const CoglColor *color);
COGL_EXPORT float COGL_EXPORT float
cogl_color_get_alpha (const CoglColor *color); 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: * cogl_color_premultiply:
* @color: the color to premultiply * @color: the color to premultiply
@ -424,17 +270,6 @@ cogl_color_set_alpha (CoglColor *color,
COGL_EXPORT void COGL_EXPORT void
cogl_color_premultiply (CoglColor *color); 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: * cogl_color_equal:
* @v1: a #CoglColor * @v1: a #CoglColor