cr-rgb.h

Go to the documentation of this file.
00001 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
00002 
00003 /*
00004  * This file is part of The Croco Library
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of version 2.1 of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00018  * USA
00019  * 
00020  * see COPYRIGHTS file for copyright information.
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          *the unit of the rgb.
00039          *Either NO_UNIT (integer) or 
00040          *UNIT_PERCENTAGE (percentage).
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*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 *a_this) ;
00071 
00072 gboolean cr_rgb_is_set_to_transparent (CRRgb *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 *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 *a_this) ;
00087 
00088 void cr_rgb_dump (CRRgb *a_this, FILE *a_fp) ;
00089 
00090 void cr_rgb_destroy (CRRgb *a_this) ;
00091 
00092 G_END_DECLS
00093 
00094 #endif /*__CR_RGB_H__*/

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