cr-rgb.c File Reference

#include <stdio.h>
#include <string.h>
#include "cr-rgb.h"
#include "cr-term.h"
#include "cr-parser.h"

Go to the source code of this file.

Functions

CRRgbcr_rgb_new (void)
 cr_rgb_new:
CRRgbcr_rgb_new_with_vals (gulong a_red, gulong a_green, gulong a_blue, gboolean a_is_percentage)
 cr_rgb_new_with_vals: : the red component of the color.
guchar * cr_rgb_to_string (CRRgb *a_this)
 cr_rgb_to_string: : the instance of CRRgb to serialize.
void cr_rgb_dump (CRRgb *a_this, FILE *a_fp)
 cr_rgb_dump: : the "this pointer" of the current instance of CRRgb.
enum CRStatus cr_rgb_compute_from_percentage (CRRgb *a_this)
 cr_rgb_compute_from_percentage: : the current instance of CRRgb
enum CRStatus cr_rgb_set (CRRgb *a_this, gulong a_red, gulong a_green, gulong a_blue, gboolean a_is_percentage)
 cr_rgb_set: : the current instance of CRRgb.
enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit)
 cr_rgb_set_to_inherit: : the current instance of CRRgb
gboolean cr_rgb_is_set_to_inherit (CRRgb *a_this)
 cr_rgb_is_set_to_inherit:
gboolean cr_rgb_is_set_to_transparent (CRRgb *a_this)
 cr_rgb_is_set_to_transparent: : the current instance of CRRgb
enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this, gboolean a_is_transparent)
 cr_rgb_set_to_transparent: : the current instance of CRRgb : set to transparent or not.
enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb *a_rgb)
 cr_rgb_set_from_rgb: : the current instance of CRRgb.
enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name)
 cr_rgb_set_from_name: : the current instance of CRRgb : the color name
enum CRStatus cr_rgb_set_from_hex_str (CRRgb *a_this, const guchar *a_hex)
 cr_rgb_set_from_hex_str: : the current instance of CRRgb : the hexadecimal value to set.
enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value)
 cr_rgb_set_from_term: : the instance of CRRgb to set : the terminal from which to set
enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb *a_src)
void cr_rgb_destroy (CRRgb *a_this)
 cr_rgb_destroy: : the "this pointer" of the current instance of CRRgb.
CRRgbcr_rgb_parse_from_buf (const guchar *a_str, enum CREncoding a_enc)
 cr_rgb_parse_from_buf: : a string that contains a color description : the encoding of a_str


Function Documentation

enum CRStatus cr_rgb_compute_from_percentage CRRgb a_this  ) 
 

cr_rgb_compute_from_percentage: : the current instance of CRRgb

If the rgb values are expressed in percentage, compute their real value.

Returns CR_OK upon successful completion, an error code otherwise.

Definition at line 317 of file cr-rgb.c.

References CR_BAD_PARAM_ERROR, and CR_OK.

enum CRStatus cr_rgb_copy CRRgb a_dest,
CRRgb a_src
 

Definition at line 605 of file cr-rgb.c.

References CR_BAD_PARAM_ERROR, and CR_OK.

Referenced by cr_rgb_set_from_rgb().

void cr_rgb_destroy CRRgb a_this  ) 
 

cr_rgb_destroy: : the "this pointer" of the current instance of CRRgb.

Destructor of CRRgb.

Definition at line 622 of file cr-rgb.c.

void cr_rgb_dump CRRgb a_this,
FILE *  a_fp
 

cr_rgb_dump: : the "this pointer" of the current instance of CRRgb.

: the destination file pointer.

Dumps the current instance of CRRgb to a file.

Definition at line 292 of file cr-rgb.c.

References cr_rgb_to_string().

gboolean cr_rgb_is_set_to_inherit CRRgb a_this  ) 
 

cr_rgb_is_set_to_inherit:

: the current instance of CRRgb.

Returns TRUE if the rgb is set to the value "inherit", FALSE otherwise.

Definition at line 391 of file cr-rgb.c.

References CR_BAD_PARAM_ERROR.

gboolean cr_rgb_is_set_to_transparent CRRgb a_this  ) 
 

cr_rgb_is_set_to_transparent: : the current instance of CRRgb

Tests if the the rgb is set to the value "transparent" or not.

Returns TRUE if the rgb has been set to transparent, FALSE otherwise.

Definition at line 410 of file cr-rgb.c.

CRRgb* cr_rgb_new void   ) 
 

cr_rgb_new:

The default constructor of CRRgb.

Returns the newly built instance of CRRgb

Definition at line 190 of file cr-rgb.c.

References cr_utils_trace_info.

Referenced by cr_rgb_new_with_vals(), and cr_rgb_parse_from_buf().

CRRgb* cr_rgb_new_with_vals gulong  a_red,
gulong  a_green,
gulong  a_blue,
gboolean  a_is_percentage
 

cr_rgb_new_with_vals: : the red component of the color.

: the green component of the color. : the blue component of the color. : the unit of the rgb values. (either percentage or integer values)

A constructor of CRRgb.

Returns the newly built instance of CRRgb.

Definition at line 219 of file cr-rgb.c.

References cr_rgb_new().

CRRgb* cr_rgb_parse_from_buf const guchar *  a_str,
enum CREncoding  a_enc
 

cr_rgb_parse_from_buf: : a string that contains a color description : the encoding of a_str

Parses a text buffer that contains a rgb color

Returns the parsed color, or NULL in case of error

Definition at line 638 of file cr-rgb.c.

References CR_OK, cr_parser_destroy(), cr_parser_new_from_buf(), cr_parser_parse_term(), cr_parser_try_to_skip_spaces_and_comments(), cr_rgb_new(), cr_rgb_set_from_term(), and cr_term_destroy().

enum CRStatus cr_rgb_set CRRgb a_this,
gulong  a_red,
gulong  a_green,
gulong  a_blue,
gboolean  a_is_percentage
 

cr_rgb_set: : the current instance of CRRgb.

: the red value. : the green value. : the blue value.

Sets rgb values to the RGB.

Returns CR_OK upon successful completion, an error code otherwise.

Definition at line 343 of file cr-rgb.c.

References CR_BAD_PARAM_ERROR, and CR_OK.

enum CRStatus cr_rgb_set_from_hex_str CRRgb a_this,
const guchar *  a_hex
 

cr_rgb_set_from_hex_str: : the current instance of CRRgb : the hexadecimal value to set.

Returns CR_OK upon successful completion.

Definition at line 491 of file cr-rgb.c.

References CR_BAD_PARAM_ERROR, and CR_OK.

Referenced by cr_rgb_set_from_term().

enum CRStatus cr_rgb_set_from_name CRRgb a_this,
const guchar *  a_color_name
 

cr_rgb_set_from_name: : the current instance of CRRgb : the color name

Returns CR_OK upon successful completion, an error code otherwise.

Definition at line 461 of file cr-rgb.c.

References CR_BAD_PARAM_ERROR, CR_OK, and cr_rgb_set_from_rgb().

Referenced by cr_rgb_set_from_term().

enum CRStatus cr_rgb_set_from_rgb CRRgb a_this,
CRRgb a_rgb
 

cr_rgb_set_from_rgb: : the current instance of CRRgb.

: the rgb to "copy"

Sets the rgb from an other one.

Returns CR_OK upon successful completion, an error code otherwise.

Definition at line 444 of file cr-rgb.c.

References CR_BAD_PARAM_ERROR, CR_OK, and cr_rgb_copy().

Referenced by cr_rgb_set_from_name(), and cr_rgb_set_from_term().

enum CRStatus cr_rgb_set_from_term CRRgb a_this,
const struct _CRTerm a_value
 

cr_rgb_set_from_term: : the instance of CRRgb to set : the terminal from which to set

Set the rgb from a terminal symbol

Returns CR_OK upon successful completion, an error code otherwise.

Definition at line 554 of file cr-rgb.c.

References _CRTerm::content, CR_BAD_PARAM_ERROR, CR_OK, cr_rgb_set_from_hex_str(), cr_rgb_set_from_name(), cr_rgb_set_from_rgb(), CR_UNKNOWN_TYPE_ERROR, cr_utils_trace_info, _CRTerm::rgb, _CRTerm::str, TERM_HASH, TERM_IDENT, TERM_RGB, and _CRTerm::type.

Referenced by cr_rgb_parse_from_buf().

enum CRStatus cr_rgb_set_to_inherit CRRgb a_this,
gboolean  a_inherit
 

cr_rgb_set_to_inherit: : the current instance of CRRgb

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".

Returns CR_OK upon succesful completion, an error code otherwise.

Definition at line 374 of file cr-rgb.c.

References CR_BAD_PARAM_ERROR, and CR_OK.

enum CRStatus cr_rgb_set_to_transparent CRRgb a_this,
gboolean  a_is_transparent
 

cr_rgb_set_to_transparent: : the current instance of CRRgb : set to transparent or not.

Sets the rgb to the "transparent" value (or not) Returns CR_OK upon successfull completion, an error code otherwise.

Definition at line 426 of file cr-rgb.c.

References CR_BAD_PARAM_ERROR, and CR_OK.

guchar* cr_rgb_to_string CRRgb a_this  ) 
 

cr_rgb_to_string: : the instance of CRRgb to serialize.

Serializes the rgb into a zero terminated string.

Returns the zero terminated string containing the serialized rgb. MUST BE FREED by the caller using g_free().

Definition at line 246 of file cr-rgb.c.

Referenced by cr_rgb_dump(), cr_style_rgb_prop_val_to_string(), and cr_term_one_to_string().


Generated on Thu Mar 9 19:19:09 2006 for Libcroco by  doxygen 1.4.6