1/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ 2 3/* 4 * This file is part of The Croco Library 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of version 2.1 of the GNU General Public 8 * License as published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 18 * USA 19 * 20 * see COPYRIGHTS file for copyright information. 21 */ 22 23#ifndef __CR_RGB_H__ 24#define __CR_RGB_H__ 25 26#include <stdio.h> 27#include <glib.h> 28#include "cr-utils.h" 29#include "cr-parsing-location.h" 30 31G_BEGIN_DECLS 32 33 34typedef struct _CRRgb CRRgb ; 35struct _CRRgb 36{ 37 /* 38 *the unit of the rgb. 39 *Either NO_UNIT (integer) or 40 *UNIT_PERCENTAGE (percentage). 41 */ 42 const guchar *name ; 43 glong red ; 44 glong green ; 45 glong blue ; 46 gboolean is_percentage ; 47 gboolean inherit ; 48 gboolean is_transparent ; 49 CRParsingLocation location ; 50} ; 51 52CRRgb * cr_rgb_new (void) ; 53 54CRRgb * cr_rgb_new_with_vals (gulong a_red, gulong a_green, 55 gulong a_blue, gboolean a_is_percentage) ; 56 57CRRgb *cr_rgb_parse_from_buf(const guchar *a_str, 58 enum CREncoding a_enc); 59 60enum CRStatus cr_rgb_compute_from_percentage (CRRgb *a_this) ; 61 62enum CRStatus cr_rgb_set (CRRgb *a_this, gulong a_red, 63 gulong a_green, gulong a_blue, 64 gboolean a_is_percentage) ; 65 66enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src) ; 67 68enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) ; 69 70gboolean cr_rgb_is_set_to_inherit (CRRgb *a_this) ; 71 72gboolean cr_rgb_is_set_to_transparent (CRRgb *a_this) ; 73 74enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this, 75 gboolean a_is_transparent) ; 76enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb *a_rgb) ; 77 78enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name) ; 79 80enum CRStatus cr_rgb_set_from_hex_str (CRRgb *a_this, const guchar * a_hex_value) ; 81 82struct _CRTerm; 83 84enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value); 85 86guchar * cr_rgb_to_string (CRRgb *a_this) ; 87 88void cr_rgb_dump (CRRgb *a_this, FILE *a_fp) ; 89 90void cr_rgb_destroy (CRRgb *a_this) ; 91 92G_END_DECLS 93 94#endif /*__CR_RGB_H__*/ 95