1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com>
*
* This file is part of poppler-glibmm.
*
* poppler-glibmm is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 2.1 of the License,
* or (at your option) any later version.
*
* poppler-glibmm is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
_DEFS(poppler-glibmm,poppler-glib)
_CC_INCLUDE(poppler.h)
namespace Poppler
{
/** A Poppler::Color describes a RGB color. Color components are values between 0 and 65535
*/
class Color
{
_CLASS_BOXEDTYPE(Color, PopplerColor, poppler_color_new, poppler_color_copy, poppler_color_free)
public:
/** Creates a new color instance with the given red, green, and blue color components.
*/
Color(guint16 red, guint16 green, guint16 blue);
_MEMBER_GET(red, red, guint16, guint16)
_MEMBER_SET(red, red, guint16, guint16)
_MEMBER_GET(green, green, guint16, guint16)
_MEMBER_SET(green, green, guint16, guint16)
_MEMBER_GET(blue, blue, guint16, guint16)
_MEMBER_SET(blue, blue, guint16, guint16)
/** This typedef is just to make it more obvious that
* our operator const void* should be used like operator bool().
*/
typedef const void* BoolExpr;
/** Tests whether the Color is valid.
* For instance,
* @code
* if (color) do_something()
* @endcode
*/
inline operator BoolExpr() const { return gobj() ? GINT_TO_POINTER(1) : 0; }
};
} // namespace Poppler
|