Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
cr-rgb.h
Go to the documentation of this file.
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 Lesser 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 Lesser 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 ;
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
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 const *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 const *a_this) ;
71
72gboolean cr_rgb_is_set_to_transparent (CRRgb const *a_this) ;
73
75 gboolean a_is_transparent) ;
76enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb const *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 const *a_this) ;
87
88void cr_rgb_dump (CRRgb const *a_this, FILE *a_fp) ;
89
90void cr_rgb_destroy (CRRgb *a_this) ;
91
92G_END_DECLS
93
94#endif /*__CR_RGB_H__*/
The declaration of the CRParsingLocation object.
CRRgb * cr_rgb_new_with_vals(gulong a_red, gulong a_green, gulong a_blue, gboolean a_is_percentage)
enum CRStatus cr_rgb_set_to_inherit(CRRgb *a_this, gboolean a_inherit)
void cr_rgb_destroy(CRRgb *a_this)
gboolean cr_rgb_is_set_to_inherit(CRRgb const *a_this)
enum CRStatus cr_rgb_copy(CRRgb *a_dest, CRRgb const *a_src)
enum CRStatus cr_rgb_set_to_transparent(CRRgb *a_this, gboolean a_is_transparent)
typedefG_BEGIN_DECLS struct _CRRgb CRRgb
Definition cr-rgb.h:34
CRRgb * cr_rgb_new(void)
enum CRStatus cr_rgb_set_from_rgb(CRRgb *a_this, CRRgb const *a_rgb)
guchar * cr_rgb_to_string(CRRgb const *a_this)
enum CRStatus cr_rgb_set(CRRgb *a_this, gulong a_red, gulong a_green, gulong a_blue, gboolean a_is_percentage)
enum CRStatus cr_rgb_set_from_hex_str(CRRgb *a_this, const guchar *a_hex_value)
gboolean cr_rgb_is_set_to_transparent(CRRgb const *a_this)
void cr_rgb_dump(CRRgb const *a_this, FILE *a_fp)
enum CRStatus cr_rgb_compute_from_percentage(CRRgb *a_this)
enum CRStatus cr_rgb_set_from_term(CRRgb *a_this, const struct _CRTerm *a_value)
enum CRStatus cr_rgb_set_from_name(CRRgb *a_this, const guchar *a_color_name)
CRRgb * cr_rgb_parse_from_buf(const guchar *a_str, enum CREncoding a_enc)
The Croco library basic types definitions And global definitions.
CRStatus
The status type returned by the methods of the croco library.
Definition cr-utils.h:42
CREncoding
Encoding values.
Definition cr-utils.h:84
gboolean is_percentage
Definition cr-rgb.h:46
glong green
Definition cr-rgb.h:44
gboolean inherit
Definition cr-rgb.h:47
gboolean is_transparent
Definition cr-rgb.h:48
const guchar * name
Definition cr-rgb.h:42
glong blue
Definition cr-rgb.h:45
glong red
Definition cr-rgb.h:43
CRParsingLocation location
Definition cr-rgb.h:49
An abstraction of a css2 term as defined in the CSS2 spec in appendix D.1: term ::= [ NUMBER S* | PER...
Definition cr-term.h:83