2009-10-20 Chris Toshok <toshok@ximian.com>
[moon.git] / src / cornerradius.h
blob9d1118483a34b6f6490f2461b1e23a60edfbc25a
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * cornerradius.h
5 * Copyright 2008 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
8 *
9 */
11 #ifndef __MOON_CORNERRADIUS_H__
12 #define __MOON_CORNERRADIUS_H__
14 #include <math.h>
16 /* @IncludeInKinds */
17 struct CornerRadius {
18 double topLeft;
19 double topRight;
20 double bottomRight;
21 double bottomLeft;
23 CornerRadius ()
24 : topLeft (0), topRight (0),
25 bottomRight (0), bottomLeft (0)
29 CornerRadius (double uniformRadius)
30 : topLeft (uniformRadius), topRight (uniformRadius),
31 bottomRight (uniformRadius), bottomLeft (uniformRadius)
35 CornerRadius (double topLeft, double topRight,
36 double bottomRight, double bottomLeft)
37 : topLeft (topLeft), topRight (topRight),
38 bottomRight (bottomRight), bottomLeft (bottomLeft)
42 bool operator == (const CornerRadius &corner)
44 return fabs (topLeft-corner.topLeft) < DBL_EPSILON && fabs (bottomLeft-corner.bottomLeft) < DBL_EPSILON && fabs(topRight-corner.topRight) < DBL_EPSILON && fabs(bottomRight-corner.bottomRight) < DBL_EPSILON;
47 bool operator != (const CornerRadius &corner)
49 return !(*this == corner);
53 // FromStr
54 // Parses @s and return a new CornerRadius in @p. Returns
55 // true if this was successful, false otherwise.
57 static bool FromStr (const char *s, CornerRadius *p);
60 #endif /* __MOON_POINT_H__ */