00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __CR_RGB_H__
00024 #define __CR_RGB_H__
00025
00026 #include <stdio.h>
00027 #include <glib.h>
00028 #include "cr-utils.h"
00029 #include "cr-parsing-location.h"
00030
00031 G_BEGIN_DECLS
00032
00033
00034 typedef struct _CRRgb CRRgb ;
00035 struct _CRRgb
00036 {
00037
00038
00039
00040
00041
00042 const guchar *name ;
00043 glong red ;
00044 glong green ;
00045 glong blue ;
00046 gboolean is_percentage ;
00047 gboolean inherit ;
00048 gboolean is_transparent ;
00049 CRParsingLocation location ;
00050 } ;
00051
00052 CRRgb * cr_rgb_new (void) ;
00053
00054 CRRgb * cr_rgb_new_with_vals (gulong a_red, gulong a_green,
00055 gulong a_blue, gboolean a_is_percentage) ;
00056
00057 CRRgb *cr_rgb_parse_from_buf(const guchar *a_str,
00058 enum CREncoding a_enc);
00059
00060 enum CRStatus cr_rgb_compute_from_percentage (CRRgb *a_this) ;
00061
00062 enum CRStatus cr_rgb_set (CRRgb *a_this, gulong a_red,
00063 gulong a_green, gulong a_blue,
00064 gboolean a_is_percentage) ;
00065
00066 enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src) ;
00067
00068 enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) ;
00069
00070 gboolean cr_rgb_is_set_to_inherit (CRRgb const *a_this) ;
00071
00072 gboolean cr_rgb_is_set_to_transparent (CRRgb const *a_this) ;
00073
00074 enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this,
00075 gboolean a_is_transparent) ;
00076 enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb const *a_rgb) ;
00077
00078 enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name) ;
00079
00080 enum CRStatus cr_rgb_set_from_hex_str (CRRgb *a_this, const guchar * a_hex_value) ;
00081
00082 struct _CRTerm;
00083
00084 enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value);
00085
00086 guchar * cr_rgb_to_string (CRRgb const *a_this) ;
00087
00088 void cr_rgb_dump (CRRgb const *a_this, FILE *a_fp) ;
00089
00090 void cr_rgb_destroy (CRRgb *a_this) ;
00091
00092 G_END_DECLS
00093
00094 #endif