| Top |
| ToolColor * | tool_color_new () |
| const ToolColor * | tool_color_new_bright () |
| gboolean | tool_color_equal () |
| void | tool_color_copy () |
| ToolPool * | tool_color_getStorage () |
| ToolColor * | tool_color_getByValues () |
| ToolColor * | tool_color_addFloatRGBA () |
| ToolColor * | tool_color_addIntRGBA () |
| const ToolColor * | tool_color_fromStr () |
| const gchar * | tool_color_asStr () |
| const ToolColor * | tool_color_fromName () |
| void | tool_color_invertRGBA () |
| void | tool_color_convertHSVtoRGB () |
| void | tool_color_convertHSLtoRGB () |
| void | tool_color_convertRGBtoHSL () |
| #define | TOOL_COLOR_MASK_R |
| #define | TOOL_COLOR_MASK_G |
| #define | TOOL_COLOR_MASK_B |
| #define | TOOL_COLOR_MASK_A |
| #define | TOOL_COLOR_MASK_RGBA |
| struct | ToolColor |
| enum | ToolMaterialIds |
This file defines a basic structure to store colours (not
using the GDK one beca use V_Sim core should not rely on GDK and
GTK): ToolColor. Several transformations are possible on a colour,
going from and to RGB encoding. Use tool_color_convertHSVtoRGB() and
tool_color_convertHSLtoRGB() to do that.
This file gives also the capability to store known colours in
a list. Use methods such as tool_color_addColor() or
tool_color_addFloatRGBA(). Them, one can access to stored colours, using
tool_color_getByValues() or tool_color_getByColor().
ToolColor *
tool_color_new (const float rgba[4]);
Create a new color with initial values given as arguments.
const ToolColor *
tool_color_new_bright (guint id);
V_Sim has a list of 20 bright colors. One can get one by calling
this routine. The id
is taken modulo the number of available colors.
Since: 3.7
gboolean tool_color_equal (const ToolColor *color1,const ToolColor *color2);
Test if the two colours are the same.
void tool_color_copy (ToolColor *color,const ToolColor *color_old);
This method copies all values from color_old
to color
.
ToolPool * tool_color_getStorage ();
Give access to the ToolPool instance storing all the colors.
Since: 3.8
ToolColor * tool_color_getByValues (int *pos,float red,float green,float blue,float alpha);
This method is used to look for a specific color in the stored list. The argument pos
is -1 if nothing is found or stores the position (beginning at 0) of the found color.
ToolColor * tool_color_addFloatRGBA (const float rgba[4],int *position);
This method adds a new color in the list of stored colors with the given values. If it already exits it returns the pointer of that color.
ToolColor *
tool_color_addIntRGBA (int rgba[4]);
This method adds a new color in the list of stored colors with the given values.
const ToolColor * tool_color_fromStr (const gchar *str,int *pos);
This method parse str
with the format RRGGBB or RRGGBBAA to
create a ToolColor. This color is added to the pool, see
tool_color_getStorage().
Since: 3.8
const gchar *
tool_color_asStr (ToolColor *color);
Gives a string representation of color
. The string is computed at
each call.
Since: 3.8
const ToolColor * tool_color_fromName (const gchar *name,int *pos);
Parse a name like 'black' and generate a colour. This color is
added to the pool, see tool_color_getStorage().
Since: 3.8
void tool_color_invertRGBA (float inv[4],const float rgba[4]);
Invert the colour on the stack.
Since: 3.8
void tool_color_convertHSVtoRGB (float *rgb,const float *hsv);
This methods convert a HSV color to a RGB one.
void tool_color_convertHSLtoRGB (float *rgb,const float *hsl);
This methods convert a HSL color to a RGB one.
#define TOOL_COLOR_MASK_R (1 << 0)
This value can be used to create a mask for methods that require one for reading rgb color array. This value actually correspond to red.
#define TOOL_COLOR_MASK_G (1 << 1)
This value can be used to create a mask for methods that require one for reading rgb color array. This value actually correspond to green.
#define TOOL_COLOR_MASK_B (1 << 2)
This value can be used to create a mask for methods that require one for reading rgb color array. This value actually correspond to blue.
#define TOOL_COLOR_MASK_A (1 << 3)
This value can be used to create a mask for methods that require one for reading rgb color array. This value actually correspond to the alpha channel.
#define TOOL_COLOR_MASK_RGBA (15)
This value can be used to create a mask for methods that require one for reading rgb color array. This value is a shortcut for TOOL_COLOR_MASK_R | TOOL_COLOR_MASK_G | TOOL_COLOR_MASK_B.
struct ToolColor {
float rgba[4];
gchar repr[10];
gpointer userData;
};
A structure to store colors. repr
is not set before
tool_color_asStr() is called. Any changes in rgba
are not
transfered to repr
and tool_color_asStr() should be called again.