Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
281:090b52736db2 | 282:c42ec1d1cded |
---|---|
738 { | 738 { |
739 int i; | 739 int i; |
740 | 740 |
741 if (*name == '#') | 741 if (*name == '#') |
742 { | 742 { |
743 /* numeric names look like "#RRGGBB", "#RRRGGGBBB" or "#RRRRGGGGBBBB" */ | 743 /* numeric names look like "#RRGGBB", "#RRRGGGBBB" or "#RRRRGGGGBBBB" |
744 or "rgb:rrrr/gggg/bbbb" */ | |
744 unsigned int r, g, b; | 745 unsigned int r, g, b; |
745 | 746 |
746 for (i=1; i<strlen(name); i++) | 747 for (i=1; i<strlen(name); i++) |
747 { | 748 { |
748 if (!isxdigit ((int)name[i])) | 749 if (!isxdigit ((int)name[i])) |
767 r = hexval (name[1]) * 16 + hexval (name[2]); | 768 r = hexval (name[1]) * 16 + hexval (name[2]); |
768 g = hexval (name[5]) * 16 + hexval (name[6]); | 769 g = hexval (name[5]) * 16 + hexval (name[6]); |
769 b = hexval (name[9]) * 16 + hexval (name[10]); | 770 b = hexval (name[9]) * 16 + hexval (name[10]); |
770 return (PALETTERGB (r, g, b)); | 771 return (PALETTERGB (r, g, b)); |
771 } | 772 } |
773 } | |
774 else if (!strncmp(name, "rgb:", 4)) | |
775 { | |
776 unsigned int r,g,b; | |
777 | |
778 if (sscanf(name, "rgb:%04x/%04x/%04x", &r, &g, &b) <0) | |
779 return -1; | |
780 | |
781 r /= 257; | |
782 g /= 257; | |
783 b /= 257; | |
784 | |
785 return (PALETTERGB (r, g, b)); | |
772 } | 786 } |
773 else if (*name) /* Can't be an empty string */ | 787 else if (*name) /* Can't be an empty string */ |
774 { | 788 { |
775 char *nospaces = alloca (strlen (name)+1); | 789 char *nospaces = alloca (strlen (name)+1); |
776 char *c=nospaces; | 790 char *c=nospaces; |