Mon, 25 Mar 2013 15:20:56 +0200
Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
| 
48
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
1 | /* | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
2 | * LDForge: LDraw parts authoring CAD | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
3 | * Copyright (C) 2013 Santeri `arezey` Piippo | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
4 | * | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
5 | * This program is free software: you can redistribute it and/or modify | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
6 | * it under the terms of the GNU General Public License as published by | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
7 | * the Free Software Foundation, either version 3 of the License, or | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
8 | * (at your option) any later version. | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
9 | * | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
10 | * This program is distributed in the hope that it will be useful, | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
13 | * GNU General Public License for more details. | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
14 | * | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
15 | * You should have received a copy of the GNU General Public License | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
17 | */ | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
18 | |
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
19 | #ifndef __COLORS_H__ | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
20 | #define __COLORS_H__ | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
21 | |
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
22 | #include "common.h" | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
23 | |
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
24 | #define MAX_COLORS 512 | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
25 | |
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
26 | class color { | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
27 | public: | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
28 | str zName; | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
29 | str zColor; | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
30 | float fAlpha; | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
31 | }; | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
32 | |
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
33 | typedef struct { | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
34 | const short dIndex; | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
35 | const char* sName, *sColor; | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
36 | const float fAlpha; | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
37 | } TemporaryColorMeta; | 
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
38 | |
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
39 | void initColors (); | 
| 
68
 
c637b172d565
Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
48 
diff
changeset
 | 
40 | |
| 
 
c637b172d565
Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
48 
diff
changeset
 | 
41 | // Safely gets a color with the given number or nullptr if no such color. | 
| 
 
c637b172d565
Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
48 
diff
changeset
 | 
42 | color* getColor (short dColorNum); | 
| 
48
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
43 | |
| 
 
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
44 | #endif // __COLORS_H__ |