From fb641d684f106ce60b98181b38d5d167156287f3 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Thu, 20 Aug 2009 09:44:25 +0000 Subject: [PATCH] (ns_get_color): Remove incompatible color formats again. --- src/ChangeLog | 6 +++++ src/nsterm.m | 71 ++--------------------------------------------------------- 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 @@ +2009-08-20 YAMAMOTO Mitsuharu + + * nsfns.m (Fxw_color_values): Return 3-element list. Doc fix. + + * nsterm.m (ns_get_color): Remove incompatible color formats again. + 2009-08-20 Glenn Morris * 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) /* -------------------------------------------------------------------------- /* On *Step, we recognize several color formats, in addition to a catalog of colors found in the file Emacs.clr. Color formats include: - - #rrggbb or RGBrrggbb where rr, gg, bb specify red, green and blue in hex - - ARGBaarrggbb is similar, with aa being the alpha channel (FF = opaque) - - HSVhhssvv and AHSVaahhssvv (or HSB/AHSB) are similar for hue, saturation, - value; - - CMYKccmmyykk is similar for cyan, magenta, yellow, black. */ + - #rrggbb where rr, gg, bb specify red, green and blue in hex. */ { NSColor * new = nil; const char *hex = NULL; - enum { rgb, argb, hsv, ahsv, cmyk, gray } color_space; + enum { rgb } color_space; NSString *nsname = [NSString stringWithUTF8String: name]; /*fprintf (stderr, "ns_get_color: '%s'\n", name); */ @@ -1381,46 +1377,11 @@ ns_get_color (const char *name, NSColor **col) return 0; } - /* FIXME: emacs seems to downcase everything before passing it here, - which we can work around, except for GRAY, since gray##, where ## is - decimal between 0 and 99, is also an X11 colorname. */ if (name[0] == '#') /* X11 format */ { hex = name + 1; color_space = rgb; } - else if (!memcmp (name, "RGB", 3) || !memcmp (name, "rgb", 3)) - { - hex = name + 3; - color_space = rgb; - } - else if (!memcmp (name, "ARGB", 4) || !memcmp (name, "argb", 4)) - { - hex = name + 4; - color_space = argb; - } - else if (!memcmp (name, "HSV", 3) || !memcmp (name, "hsv", 3) || - !memcmp (name, "HSB", 3) || !memcmp (name, "hsb", 3)) - { - hex = name + 3; - color_space = hsv; - } - else if (!memcmp (name, "AHSV", 4) || !memcmp (name, "ahsv", 4) || - !memcmp (name, "AHSB", 4) || !memcmp (name, "ahsb", 4)) - { - hex = name + 4; - color_space = ahsv; - } - else if (!memcmp (name, "CMYK", 4) || !memcmp (name, "cmyk", 4)) - { - hex = name + 4; - color_space = cmyk; - } - else if (!memcmp (name, "GRAY", 4) /*|| !memcmp (name, "gray", 4)*/) - { - hex = name + 4; - color_space = gray; - } /* Direct colors (hex values) */ if (hex) @@ -1450,34 +1411,6 @@ ns_get_color (const char *name, NSColor **col) blue: f4 alpha: 1.0]; break; - case argb: - *col = [NSColor colorWithCalibratedRed: f2 - green: f3 - blue: f4 - alpha: f1]; - break; - case hsv: - *col = [NSColor colorWithCalibratedHue: f2 - saturation: f3 - brightness: f4 - alpha: 1.0]; - break; - case ahsv: - *col = [NSColor colorWithCalibratedHue: f2 - saturation: f3 - brightness: f4 - alpha: f1]; - break; - case gray: - *col = [NSColor colorWithCalibratedWhite: f3 alpha: f4]; - break; - case cmyk: - *col = [NSColor colorWithDeviceCyan: f1 - magenta: f2 - yellow: f3 - black: f4 - alpha: 1.0]; - break; } *col = [*col colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; UNBLOCK_INPUT; -- 2.11.4.GIT