aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2009-08-20 09:44:25 +0000
committerYAMAMOTO Mitsuharu2009-08-20 09:44:25 +0000
commitfb641d684f106ce60b98181b38d5d167156287f3 (patch)
tree787bff99269ce39276ad097fed31bcf1263f83cd
parentfb67c21b69ec4f4f34d5d6d1627bc1eaef208c8f (diff)
downloademacs-fb641d684f106ce60b98181b38d5d167156287f3.tar.gz
emacs-fb641d684f106ce60b98181b38d5d167156287f3.zip
(ns_get_color): Remove incompatible color formats again.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/nsterm.m71
2 files changed, 8 insertions, 69 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ce75491e6fc..e04d71b921d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12009-08-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * nsfns.m (Fxw_color_values): Return 3-element list. Doc fix.
4
5 * nsterm.m (ns_get_color): Remove incompatible color formats again.
6
12009-08-20 Glenn Morris <rgm@gnu.org> 72009-08-20 Glenn Morris <rgm@gnu.org>
2 8
3 * emacs.c (system-type): Doc fix. 9 * emacs.c (system-type): Doc fix.
diff --git a/src/nsterm.m b/src/nsterm.m
index 6b5da82a511..4400dc728db 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1348,15 +1348,11 @@ ns_get_color (const char *name, NSColor **col)
1348/* -------------------------------------------------------------------------- 1348/* --------------------------------------------------------------------------
1349/* On *Step, we recognize several color formats, in addition to a catalog 1349/* On *Step, we recognize several color formats, in addition to a catalog
1350 of colors found in the file Emacs.clr. Color formats include: 1350 of colors found in the file Emacs.clr. Color formats include:
1351 - #rrggbb or RGBrrggbb where rr, gg, bb specify red, green and blue in hex 1351 - #rrggbb where rr, gg, bb specify red, green and blue in hex. */
1352 - ARGBaarrggbb is similar, with aa being the alpha channel (FF = opaque)
1353 - HSVhhssvv and AHSVaahhssvv (or HSB/AHSB) are similar for hue, saturation,
1354 value;
1355 - CMYKccmmyykk is similar for cyan, magenta, yellow, black. */
1356{ 1352{
1357 NSColor * new = nil; 1353 NSColor * new = nil;
1358 const char *hex = NULL; 1354 const char *hex = NULL;
1359 enum { rgb, argb, hsv, ahsv, cmyk, gray } color_space; 1355 enum { rgb } color_space;
1360 NSString *nsname = [NSString stringWithUTF8String: name]; 1356 NSString *nsname = [NSString stringWithUTF8String: name];
1361 1357
1362/*fprintf (stderr, "ns_get_color: '%s'\n", name); */ 1358/*fprintf (stderr, "ns_get_color: '%s'\n", name); */
@@ -1381,46 +1377,11 @@ ns_get_color (const char *name, NSColor **col)
1381 return 0; 1377 return 0;
1382 } 1378 }
1383 1379
1384 /* FIXME: emacs seems to downcase everything before passing it here,
1385 which we can work around, except for GRAY, since gray##, where ## is
1386 decimal between 0 and 99, is also an X11 colorname. */
1387 if (name[0] == '#') /* X11 format */ 1380 if (name[0] == '#') /* X11 format */
1388 { 1381 {
1389 hex = name + 1; 1382 hex = name + 1;
1390 color_space = rgb; 1383 color_space = rgb;
1391 } 1384 }
1392 else if (!memcmp (name, "RGB", 3) || !memcmp (name, "rgb", 3))
1393 {
1394 hex = name + 3;
1395 color_space = rgb;
1396 }
1397 else if (!memcmp (name, "ARGB", 4) || !memcmp (name, "argb", 4))
1398 {
1399 hex = name + 4;
1400 color_space = argb;
1401 }
1402 else if (!memcmp (name, "HSV", 3) || !memcmp (name, "hsv", 3) ||
1403 !memcmp (name, "HSB", 3) || !memcmp (name, "hsb", 3))
1404 {
1405 hex = name + 3;
1406 color_space = hsv;
1407 }
1408 else if (!memcmp (name, "AHSV", 4) || !memcmp (name, "ahsv", 4) ||
1409 !memcmp (name, "AHSB", 4) || !memcmp (name, "ahsb", 4))
1410 {
1411 hex = name + 4;
1412 color_space = ahsv;
1413 }
1414 else if (!memcmp (name, "CMYK", 4) || !memcmp (name, "cmyk", 4))
1415 {
1416 hex = name + 4;
1417 color_space = cmyk;
1418 }
1419 else if (!memcmp (name, "GRAY", 4) /*|| !memcmp (name, "gray", 4)*/)
1420 {
1421 hex = name + 4;
1422 color_space = gray;
1423 }
1424 1385
1425 /* Direct colors (hex values) */ 1386 /* Direct colors (hex values) */
1426 if (hex) 1387 if (hex)
@@ -1450,34 +1411,6 @@ ns_get_color (const char *name, NSColor **col)
1450 blue: f4 1411 blue: f4
1451 alpha: 1.0]; 1412 alpha: 1.0];
1452 break; 1413 break;
1453 case argb:
1454 *col = [NSColor colorWithCalibratedRed: f2
1455 green: f3
1456 blue: f4
1457 alpha: f1];
1458 break;
1459 case hsv:
1460 *col = [NSColor colorWithCalibratedHue: f2
1461 saturation: f3
1462 brightness: f4
1463 alpha: 1.0];
1464 break;
1465 case ahsv:
1466 *col = [NSColor colorWithCalibratedHue: f2
1467 saturation: f3
1468 brightness: f4
1469 alpha: f1];
1470 break;
1471 case gray:
1472 *col = [NSColor colorWithCalibratedWhite: f3 alpha: f4];
1473 break;
1474 case cmyk:
1475 *col = [NSColor colorWithDeviceCyan: f1
1476 magenta: f2
1477 yellow: f3
1478 black: f4
1479 alpha: 1.0];
1480 break;
1481 } 1414 }
1482 *col = [*col colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; 1415 *col = [*col colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
1483 UNBLOCK_INPUT; 1416 UNBLOCK_INPUT;