258 :(
OOColor **)ioColor1 andColor2:(
OOColor **)ioColor2 andColor3:(
OOColor **)ioColor3 andColor4:(
OOColor **)ioColor4 fromDictionary:(NSDictionary *)dictionary
259{
260 NSString *
string =
nil;
261 NSArray *tokens =
nil;
264 BOOL nebulaSet = NO;
265
266 assert(ioColor1 != NULL && ioColor2 != NULL);
267
268 string = [dictionary oo_stringForKey:@"sky_rgb_colors"];
270 {
272
273 if ([tokens
count] == 6)
274 {
275 float r1 = OOClamp_0_1_f([tokens oo_floatAtIndex:0]);
276 float g1 = OOClamp_0_1_f([tokens oo_floatAtIndex:1]);
277 float b1 = OOClamp_0_1_f([tokens oo_floatAtIndex:2]);
278 float r2 = OOClamp_0_1_f([tokens oo_floatAtIndex:3]);
279 float g2 = OOClamp_0_1_f([tokens oo_floatAtIndex:4]);
280 float b2 = OOClamp_0_1_f([tokens oo_floatAtIndex:5]);
283 }
284 else
285 {
286 OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as two RGB colours (must be six numbers).",
string);
287 }
288 }
289 colorDesc = [dictionary objectForKey:@"sky_color_1"];
290 if (colorDesc !=
nil)
291 {
293 if (color !=
nil) *ioColor1 = color;
294 else OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
295 }
296 colorDesc = [dictionary objectForKey:@"sky_color_2"];
297 if (colorDesc !=
nil)
298 {
300 if (color !=
nil) *ioColor2 = color;
301 else OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
302 }
303
304 colorDesc = [dictionary objectForKey:@"nebula_color_1"];
305 if (colorDesc !=
nil)
306 {
309 {
310 *ioColor3 = color;
311 nebulaSet = YES;
312 }
313 else OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
314 }
315 else
316 {
317 colorDesc = [dictionary objectForKey:@"sky_color_1"];
318 if (colorDesc !=
nil)
319 {
321 if (color !=
nil) *ioColor3 = color;
322 else OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
323 }
324 }
325
326 colorDesc = [dictionary objectForKey:@"nebula_color_2"];
327 if (colorDesc !=
nil)
328 {
331 {
332 *ioColor4 = color;
333 nebulaSet = YES;
334 }
335 else OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
336 }
337 else
338 {
339 colorDesc = [dictionary objectForKey:@"sky_color_2"];
340 if (colorDesc !=
nil)
341 {
343 if (color !=
nil) *ioColor4 = color;
344 else OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
345 }
346 }
347 return nebulaSet;
348}
#define OOLogWARN(class, format,...)
NSMutableArray * ScanTokensFromString(NSString *values)
OOColor * colorWithRed:green:blue:alpha:(float red,[green] float green,[blue] float blue,[alpha] float alpha)
OOColor * colorWithDescription:(id description)
OOColor * premultipliedColor()