|  |  |  | Libcroco Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
struct CRRgb; enum CRStatus cr_rgb_compute_from_percentage (CRRgb *a_this); enum CRStatus cr_rgb_copy (CRRgb *a_dest,CRRgb const *a_src); void cr_rgb_destroy (CRRgb *a_this); void cr_rgb_dump (CRRgb const *a_this,FILE *a_fp); gboolean cr_rgb_is_set_to_inherit (CRRgb const *a_this); gboolean cr_rgb_is_set_to_transparent (CRRgb const *a_this); CRRgb * cr_rgb_new (void); CRRgb * cr_rgb_new_with_vals (gulong a_red,gulong a_green,gulong a_blue,gboolean a_is_percentage); CRRgb * cr_rgb_parse_from_buf (const guchar *a_str,enum CREncoding a_enc); enum CRStatus cr_rgb_set (CRRgb *a_this,gulong a_red,gulong a_green,gulong a_blue,gboolean a_is_percentage); enum CRStatus cr_rgb_set_from_hex_str (CRRgb *a_this,const guchar *a_hex_value); enum CRStatus cr_rgb_set_from_name (CRRgb *a_this,const guchar *a_color_name); enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this,CRRgb const *a_rgb); enum CRStatus cr_rgb_set_from_term (CRRgb *a_this,const struct _CRTerm *a_value); enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this,gboolean a_inherit); enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this,gboolean a_is_transparent); guchar * cr_rgb_to_string (CRRgb const *a_this);
struct CRRgb {
        /*
         *the unit of the rgb.
         *Either NO_UNIT (integer) or 
         *UNIT_PERCENTAGE (percentage).
         */
        const guchar *name ;
        glong red ;
        glong green ;
        glong blue ;
        gboolean is_percentage ;
	gboolean inherit ;
        gboolean is_transparent ;
        CRParsingLocation location ;
};
enum CRStatus       cr_rgb_compute_from_percentage      (CRRgb *a_this);
If the rgb values are expressed in percentage, compute their real value.
| 
 | the current instance of CRRgb | 
| Returns : | CR_OK upon successful completion, an error code otherwise. | 
void                cr_rgb_destroy                      (CRRgb *a_this);
Destructor of CRRgb.
| 
 | the "this pointer" of the current instance of CRRgb. | 
void cr_rgb_dump (CRRgb const *a_this,FILE *a_fp);
Dumps the current instance of CRRgb to a file.
| 
 | the "this pointer" of the current instance of CRRgb. | 
| 
 | the destination file pointer. | 
gboolean            cr_rgb_is_set_to_inherit            (CRRgb const *a_this);
a_this: the current instance of CRRgb.
| Returns : | TRUE if the rgb is set to the value "inherit", FALSE otherwise. | 
gboolean            cr_rgb_is_set_to_transparent        (CRRgb const *a_this);
Tests if the the rgb is set to the value "transparent" or not.
| 
 | the current instance of CRRgb | 
| Returns : | TRUE if the rgb has been set to transparent, FALSE otherwise. | 
CRRgb *             cr_rgb_new                          (void);
The default constructor of CRRgb.
| Returns : | the newly built instance of CRRgb | 
CRRgb * cr_rgb_new_with_vals (gulong a_red,gulong a_green,gulong a_blue,gboolean a_is_percentage);
A constructor of CRRgb.
| 
 | the red component of the color. | 
| 
 | the green component of the color. | 
| 
 | the blue component of the color. | 
| Returns : | the newly built instance of CRRgb. | 
CRRgb * cr_rgb_parse_from_buf (const guchar *a_str,enum CREncoding a_enc);
Parses a text buffer that contains a rgb color
| 
 | a string that contains a color description | 
| 
 | the encoding of a_str | 
| Returns : | the parsed color, or NULL in case of error | 
enum CRStatus cr_rgb_set (CRRgb *a_this,gulong a_red,gulong a_green,gulong a_blue,gboolean a_is_percentage);
Sets rgb values to the RGB.
| 
 | the current instance of CRRgb. | 
| 
 | the red value. | 
| 
 | the green value. | 
| 
 | the blue value. | 
| Returns : | CR_OK upon successful completion, an error code otherwise. | 
enum CRStatus cr_rgb_set_from_hex_str (CRRgb *a_this,const guchar *a_hex_value);
| 
 | the current instance of CRRgb | 
| Returns : | CR_OK upon successful completion. | 
enum CRStatus cr_rgb_set_from_name (CRRgb *a_this,const guchar *a_color_name);
| 
 | the current instance of CRRgb | 
| 
 | the color name | 
| Returns : | CR_OK upon successful completion, an error code otherwise. | 
enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this,CRRgb const *a_rgb);
Sets the rgb from an other one.
| 
 | the current instance of CRRgb. | 
| 
 | the rgb to "copy" | 
| Returns : | CR_OK upon successful completion, an error code otherwise. | 
enum CRStatus cr_rgb_set_from_term (CRRgb *a_this,const struct _CRTerm *a_value);
Set the rgb from a terminal symbol
| 
 | the instance of CRRgb to set | 
| 
 | the terminal from which to set | 
| Returns : | CR_OK upon successful completion, an error code otherwise. | 
enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this,gboolean a_inherit);
sets the value of the rgb to inherit. Look at the css spec from chapter 6.1 to 6.2 to understand the meaning of "inherit".
| 
 | the current instance of CRRgb | 
| Returns : | CR_OK upon succesful completion, an error code otherwise. | 
enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this,gboolean a_is_transparent);
Sets the rgb to the "transparent" value (or not)
| 
 | the current instance of CRRgb | 
| 
 | set to transparent or not. | 
| Returns : | CR_OK upon successfull completion, an error code otherwise. |