]> git.eshelyaron.com Git - emacs.git/commitdiff
* nsfont.m (nsfont_draw): Revert 2009-07-15 change.
authorChong Yidong <cyd@stupidchicken.com>
Sun, 26 Jul 2009 12:50:06 +0000 (12:50 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 26 Jul 2009 12:50:06 +0000 (12:50 +0000)
* nsterm.m (ns_maybe_dumpglyphs_background): Revert 2009-07-15 change.
(ns_get_color): Revert 2009-07-16 change.

src/ChangeLog
src/nsfont.m
src/nsterm.m

index 0d13f9ad9734c2a9647d0fbde11a60b6d00efc10..9d7a149b2104ff7e3122a442cbe939979956c894 100644 (file)
@@ -1,3 +1,11 @@
+2009-07-26  Chong Yidong  <cyd@stupidchicken.com>
+
+       * nsfont.m (nsfont_draw): Revert 2009-07-15 change.
+
+       * nsterm.m (ns_maybe_dumpglyphs_background): Revert 2009-07-15
+       change.
+       (ns_get_color): Revert 2009-07-16 change.
+
 2009-07-24  Adrian Robert  <Adrian.B.Robert@gmail.com>
 
        * nsfont.m (ns_findfonts): Correctly return fallback in match case.
index 8f90e7a3eba29d3b0e2cc8bf5627bb56c7d2ed4f..78f4f1a6a6c0dede8aef6a771b66d0291eb915c5 100644 (file)
@@ -1099,19 +1099,15 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
           br.size.width -= 2*correction;
         }
 
-#if 0
       if (!s->face->stipple)
-#endif
         [(NS_FACE_BACKGROUND (face) != 0
           ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f)
           : FRAME_BACKGROUND_COLOR (s->f)) set];
-#if 0                          /* This is tiling, not stippling.  */
       else
         {
           struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (s->f);
           [[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set];
         }
-#endif
       NSRectFill (br);
     }
 
index 3831b5cf959941564d91d89dccac19dbfd8f4729..6b5da82a5112f8f7bade22e638a84a10db6c2a8b 100644 (file)
@@ -1348,11 +1348,15 @@ 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 where rr, gg, bb specify red, green and blue in hex. */
+   - #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. */
 {
   NSColor * new = nil;
   const char *hex = NULL;
-  enum { rgb } color_space;
+  enum { rgb, argb, hsv, ahsv, cmyk, gray } color_space;
   NSString *nsname = [NSString stringWithUTF8String: name];
 
 /*fprintf (stderr, "ns_get_color: '%s'\n", name); */
@@ -1377,11 +1381,46 @@ 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)
@@ -1411,6 +1450,34 @@ 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;
@@ -2693,19 +2760,15 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p)
             }
           else
             face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
-#if 0
           if (!face->stipple)
-#endif
             [(NS_FACE_BACKGROUND (face) != 0
               ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f)
               : FRAME_BACKGROUND_COLOR (s->f)) set];
-#if 0                          /* This is tiling, not stippling.  */
           else
             {
               struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (s->f);
               [[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set];
             }
-#endif
 
           if (s->hl != DRAW_CURSOR)
             {