comparison mac/dw.m @ 734:668a88a0b930

Fixed a minor 64/32 bit issue and fixed my having blue and red values reversed in the color table.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 15 Mar 2011 06:40:37 +0000
parents 8d5e5b89725f
children b75be4860279
comparison
equal deleted inserted replaced
733:8d5e5b89725f 734:668a88a0b930
41 _locked_by_me = FALSE; } } 41 _locked_by_me = FALSE; } }
42 42
43 unsigned long _colors[] = 43 unsigned long _colors[] =
44 { 44 {
45 0x00000000, /* 0 black */ 45 0x00000000, /* 0 black */
46 0x00bb0000, /* 1 red */ 46 0x000000bb, /* 1 red */
47 0x0000bb00, /* 2 green */ 47 0x0000bb00, /* 2 green */
48 0x00aaaa00, /* 3 yellow */ 48 0x0000aaaa, /* 3 yellow */
49 0x000000cc, /* 4 blue */ 49 0x00cc0000, /* 4 blue */
50 0x00bb00bb, /* 5 magenta */ 50 0x00bb00bb, /* 5 magenta */
51 0x0000bbbb, /* 6 cyan */ 51 0x00bbbb00, /* 6 cyan */
52 0x00bbbbbb, /* 7 white */ 52 0x00bbbbbb, /* 7 white */
53 0x00777777, /* 8 grey */ 53 0x00777777, /* 8 grey */
54 0x00ff0000, /* 9 bright red */ 54 0x000000ff, /* 9 bright red */
55 0x0000ff00, /* 10 bright green */ 55 0x0000ff00, /* 10 bright green */
56 0x00eeee00, /* 11 bright yellow */ 56 0x0000eeee, /* 11 bright yellow */
57 0x000000ff, /* 12 bright blue */ 57 0x00ff0000, /* 12 bright blue */
58 0x00ff00ff, /* 13 bright magenta */ 58 0x00ff00ff, /* 13 bright magenta */
59 0x0000eeee, /* 14 bright cyan */ 59 0x00eeee00, /* 14 bright cyan */
60 0x00ffffff, /* 15 bright white */ 60 0x00ffffff, /* 15 bright white */
61 0xff000000 /* 16 default color */ 61 0xff000000 /* 16 default color */
62 }; 62 };
63 63
64 unsigned long _get_color(unsigned long thiscolor) 64 unsigned long _get_color(unsigned long thiscolor)
493 { 493 {
494 bgcolor = nil; 494 bgcolor = nil;
495 } 495 }
496 else 496 else
497 { 497 {
498 NSLog(@"R: %d G: %d B: %d", (int)DW_RED_VALUE(input), (int)DW_GREEN_VALUE(input), (int)DW_BLUE_VALUE(input));
498 bgcolor = [NSColor colorWithDeviceRed: DW_RED_VALUE(input)/255.0 green: DW_GREEN_VALUE(input)/255.0 blue: DW_BLUE_VALUE(input)/255.0 alpha: 1]; 499 bgcolor = [NSColor colorWithDeviceRed: DW_RED_VALUE(input)/255.0 green: DW_GREEN_VALUE(input)/255.0 blue: DW_BLUE_VALUE(input)/255.0 alpha: 1];
499 } 500 }
500 } 501 }
501 @end 502 @end
502 503
3695 3696
3696 /* Wait for them to pick a color */ 3697 /* Wait for them to pick a color */
3697 color = (NSColor *)dw_dialog_wait(dialog); 3698 color = (NSColor *)dw_dialog_wait(dialog);
3698 3699
3699 /* Figure out the value of what they returned */ 3700 /* Figure out the value of what they returned */
3700 double red, green, blue; 3701 CGFloat red, green, blue;
3701 [color getRed:&red green:&green blue:&blue alpha:NULL]; 3702 [color getRed:&red green:&green blue:&blue alpha:NULL];
3702 value = DW_RGB((int)(red * 255), (int)(green *255), (int)(blue *255)); 3703 value = DW_RGB((int)(red * 255), (int)(green *255), (int)(blue *255));
3703 return value; 3704 return value;
3704 } 3705 }
3705 3706