Mercurial > hg > xemacs-beta
diff src/objects-msw.c @ 282:c42ec1d1cded r21-0b39
Import from CVS: tag r21-0b39
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:33:18 +0200 |
parents | 7df0dd720c89 |
children | 57709be46d1b |
line wrap: on
line diff
--- a/src/objects-msw.c Mon Aug 13 10:32:23 2007 +0200 +++ b/src/objects-msw.c Mon Aug 13 10:33:18 2007 +0200 @@ -740,7 +740,8 @@ if (*name == '#') { - /* numeric names look like "#RRGGBB", "#RRRGGGBBB" or "#RRRRGGGGBBBB" */ + /* numeric names look like "#RRGGBB", "#RRRGGGBBB" or "#RRRRGGGGBBBB" + or "rgb:rrrr/gggg/bbbb" */ unsigned int r, g, b; for (i=1; i<strlen(name); i++) @@ -770,6 +771,19 @@ return (PALETTERGB (r, g, b)); } } + else if (!strncmp(name, "rgb:", 4)) + { + unsigned int r,g,b; + + if (sscanf(name, "rgb:%04x/%04x/%04x", &r, &g, &b) <0) + return -1; + + r /= 257; + g /= 257; + b /= 257; + + return (PALETTERGB (r, g, b)); + } else if (*name) /* Can't be an empty string */ { char *nospaces = alloca (strlen (name)+1);