Mercurial > sdl-ios-xcode
annotate include/SDL_ellipse.h @ 4772:37e9f8154ac4
Stubbed out the new drawing, filling, and geometry functions for ellipses and polygons.
author | Eli Gottlieb <eligottlieb@gmail.com> |
---|---|
date | Thu, 03 Jun 2010 16:21:04 -0400 |
parents | c500594c4246 |
children |
rev | line source |
---|---|
4771
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
1 /* |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
3 Copyright (C) 2010 Eli Gottlieb |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
4 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
9 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
14 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
18 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
19 Eli Gottlieb |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
20 eligottlieb@gmail.com |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
21 */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
22 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
23 /** |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
24 * \file SDL_ellipse.h |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
25 * |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
26 * Header file for SDL_ellipse definition and management functions. |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
27 */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
28 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
29 #ifndef _SDL_ellipse_h |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
30 #define _SDL_ellipse_h |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
31 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
32 #include "SDL_stdinc.h" |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
33 #include "SDL_error.h" |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
34 #include "SDL_pixels.h" |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
35 #include "SDL_rwops.h" |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
36 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
37 #include "begin_code.h" |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
38 /* Set up for C function definitions, even when using C++ */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
39 #ifdef __cplusplus |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
40 /* *INDENT-OFF* */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
41 extern "C" { |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
42 /* *INDENT-ON* */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
43 #endif |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
44 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
45 /** |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
46 * \brief The structure that defines an ellipse. |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
47 * |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
48 * \sa SDL_EllipseEmpty |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
49 * \sa SDL_EllipseEquals |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
50 * \sa SDL_EllipsesIntersect |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
51 * \sa SDL_IntersectEllipseAndLine |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
52 */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
53 typedef struct SDL_Ellipse { |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
54 int x,y; |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
55 int a,b; |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
56 int r; |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
57 } SDL_Ellipse; |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
58 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
59 /** |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
60 * \brief Returns true if the ellipse has no area. |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
61 */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
62 #define SDL_EllipseEmpty(X) ((X)->r <= 0) |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
63 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
64 /** |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
65 * \brief Returns true if the two ellipses are equal. |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
66 */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
67 #define SDL_EllipseEquals(A, B) (((A)->x == (B)->x) && ((A)->y == (B)->y) && \ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
68 ((A)->a == (B)->a) && ((A)->b == (B)->b) && ((A)->r == (B)->r)) |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
69 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
70 /** |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
71 * \brief Determine whether two ellipses intersect. |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
72 * |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
73 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
74 */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
75 extern DECLSPEC SDL_bool SDLCALL SDL_EllipsesIntersect(const SDL_Ellipse * A,const SDL_Ellipse * B); |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
76 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
77 /** |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
78 * \brief Calculate the intersection of an ellipse and line segment. |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
79 * |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
80 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
81 */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
82 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectEllipseAndLine(const SDL_Ellipse *ellipse,int *X1,int *Y1,int *X2,int *Y2); |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
83 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
84 /* Ends C function definitions when using C++ */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
85 #ifdef __cplusplus |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
86 /* *INDENT-OFF* */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
87 } |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
88 /* *INDENT-ON* */ |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
89 #endif |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
90 #include "close_code.h" |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
91 |
c500594c4246
Added management and drawing functions for ellipses and polygons.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
92 #endif /* _SDL_ellipse_h */ |