NetSurf
css.h
Go to the documentation of this file.
1/*
2 * Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf 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, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 * Netsurf core css API
22 */
23
24#ifndef _NETSURF_CSS_H_
25#define _NETSURF_CSS_H_
26
27/**
28 * Convert a CSS color to a NetSurf colour primitive
29 *
30 * ARGB -> (1-A)BGR
31 *
32 * \param c The CSS color to convert
33 * \return Corresponding NetSurf colour primitive
34 */
35#define nscss_color_to_ns(c) \
36 ( ((~c) & 0xff000000) | \
37 ((( c) & 0xff0000 ) >> 16) | \
38 (( c) & 0xff00 ) | \
39 ((( c) & 0xff ) << 16))
40
41
42/**
43 * Convert a NetSurf color to a CSS colour primitive
44 *
45 * (1-A)BGR -> ARGB
46 *
47 * \param c The NetSurf color to convert
48 * \return Corresponding CSS colour primitive
49 */
50#define ns_color_to_nscss(c) \
51 ( ((~c) & 0xff000000) | \
52 ((( c) & 0xff0000 ) >> 16) | \
53 (( c) & 0xff00 ) | \
54 ((( c) & 0xff ) << 16))
55
56/**
57 * Determine if a CSS color primitive is transparent
58 *
59 * \param color The CSS color to consider
60 * \return True if the color is transparent, false otherwise
61 */
62#define nscss_color_is_transparent(color) \
63 (((color) >> 24) == 0)
64
65#endif