d07c171f |
1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
2 | * Mupen64plus - COLOR.h * |
3 | * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * |
4 | * Copyright (C) 2002 Rice1964 * |
5 | * * |
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. * |
10 | * * |
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. * |
15 | * * |
16 | * You should have received a copy of the GNU General Public License * |
17 | * along with this program; if not, write to the * |
18 | * Free Software Foundation, Inc., * |
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
21 | |
22 | #ifndef XCOLOR_H |
23 | #define XCOLOR_H |
24 | |
25 | typedef struct _COLORVALUE |
26 | { |
27 | float r; |
28 | float g; |
29 | float b; |
30 | float a; |
31 | } COLORVALUE; |
32 | |
33 | |
34 | typedef struct XCOLOR { |
35 | float r, g, b, a; |
36 | #ifdef __cplusplus |
37 | public: |
38 | XCOLOR() |
39 | { |
40 | } |
41 | |
42 | XCOLOR( unsigned int argb ); |
43 | XCOLOR( const float * ); |
44 | XCOLOR( const COLORVALUE& ); |
45 | XCOLOR( float r, float g, float b, float a ); |
46 | |
47 | // casting |
48 | operator unsigned int () const; |
49 | |
50 | operator float* (); |
51 | operator const float* () const; |
52 | |
53 | operator COLORVALUE* (); |
54 | operator const COLORVALUE* () const; |
55 | |
56 | operator COLORVALUE& (); |
57 | operator const COLORVALUE& () const; |
58 | |
59 | // assignment operators |
60 | XCOLOR& operator += ( const XCOLOR& ); |
61 | XCOLOR& operator -= ( const XCOLOR& ); |
62 | XCOLOR& operator *= ( float ); |
63 | XCOLOR& operator /= ( float ); |
64 | |
65 | // unary operators |
66 | XCOLOR operator + () const; |
67 | XCOLOR operator - () const; |
68 | |
69 | // binary operators |
70 | XCOLOR operator + ( const XCOLOR& ) const; |
71 | XCOLOR operator - ( const XCOLOR& ) const; |
72 | XCOLOR operator * ( float ) const; |
73 | XCOLOR operator / ( float ) const; |
74 | |
75 | friend XCOLOR operator * (float, const XCOLOR& ); |
76 | |
77 | bool operator == ( const XCOLOR& ) const; |
78 | bool operator != ( const XCOLOR& ) const; |
79 | |
80 | #endif //__cplusplus |
81 | } XCOLOR; |
82 | |
83 | #endif |
84 | |