2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program 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; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #if defined(__APPLE__) && !defined(SC_IPHONE)
22 #import <Carbon/Carbon.h>
25 #import <UIKit/UIKit.h>
27 #include "SC_BoundsMacros.h"
30 float red
, green
, blue
, alpha
;
32 typedef struct SCColor SCColor
;
34 inline SCColor
SCMakeColor(float red
, float green
, float blue
, float alpha
)
38 sccolor
.green
= green
;
40 sccolor
.alpha
= alpha
;
48 inline SCPoint
SCMakePoint(float x
, float y
)
57 float x
, y
, width
, height
;
60 inline SCRect
SCRectUnion(SCRect a
, SCRect b
)
62 if (a
.height
<= 0. && a
.width
<= 0.) return b
;
63 if (b
.height
<= 0. && b
.width
<= 0.) return a
;
66 u
.x
= sc_min(a
.x
, b
.x
);
67 u
.y
= sc_min(a
.y
, b
.y
);
68 u
.width
= sc_max(a
.x
+ a
.width
, b
.x
+ b
.width
) - u
.x
;
69 u
.height
= sc_max(a
.y
+ a
.height
, b
.y
+ b
.height
) - u
.y
;
73 inline bool SCRectsDoIntersect(SCRect a
, SCRect b
)
75 if ((a
.x
+ a
.width
) <= b
.x
) return false;
76 if ((a
.y
+ a
.height
) <= b
.y
) return false;
77 if (a
.x
>= (b
.x
+ b
.width
)) return false;
78 if (a
.y
>= (b
.y
+ b
.height
)) return false;
82 inline SCRect
SCMakeRect(float x
, float y
, float width
, float height
)
85 r
.x
= x
; r
.y
= y
; r
.width
= width
; r
.height
= height
;
89 inline bool SCPointInRect(SCPoint p
, SCRect r
)
92 p
.x
>= r
.x
&& p
.x
<= r
.x
+ r
.width
93 && p
.y
>= r
.y
&& p
.y
<= r
.y
+ r
.height
;