Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

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 
00030 G_BEGIN_DECLS
00031 
00032 
00033 typedef struct _CRRgb CRRgb ;
00034 struct _CRRgb
00035 {
00036         /*
00037          *the unit of the rgb.
00038          *Either NO_UNIT (integer) or 
00039          *UNIT_PERCENTAGE (percentage).
00040          */
00041         const guchar *name ;
00042         glong red ;
00043         glong green ;
00044         glong blue ;
00045         gboolean is_percentage ;
00046 } ;
00047 
00048 CRRgb * cr_rgb_new (void) ;
00049 
00050 CRRgb * cr_rgb_new_with_vals (gulong a_red, gulong a_green, 
00051                               gulong a_blue, gboolean a_is_percentage) ;
00052 
00053 CRRgb *cr_rgb_parse_from_buf(const guchar *a_str,
00054                              enum CREncoding a_enc);
00055 
00056 enum CRStatus cr_rgb_compute_from_percentage (CRRgb *a_this) ;
00057 
00058 enum CRStatus cr_rgb_set (CRRgb *a_this, gulong a_red,
00059                           gulong a_green, gulong a_blue,
00060                           gboolean a_is_percentage) ;
00061         
00062 enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb *a_rgb) ;
00063 
00064 enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name) ;
00065 
00066 enum CRStatus cr_rgb_set_from_hex_str (CRRgb *a_this, const guchar * a_hex_value) ;
00067 
00068 struct _CRTerm;
00069 
00070 enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value);
00071 
00072 guchar * cr_rgb_to_string (CRRgb *a_this) ;
00073 
00074 void cr_rgb_dump (CRRgb *a_this, FILE *a_fp) ;
00075 
00076 void cr_rgb_destroy (CRRgb *a_this) ;
00077 
00078 G_END_DECLS
00079 
00080 #endif /*__CR_RGB_H__*/

Generated on Sat Mar 20 02:38:43 2004 for Libcroco by doxygen 1.3.5