7bool INIGetARGB8(
char *Key,
byte *Alpha,
byte *Red,
byte *Green,
byte *Blue, dword DefaultValue)
11 char *i = NULL, *j = NULL, *k;
22 strncpy(TempKey, Key,
sizeof(TempKey) - 2);
23 TempKey[
sizeof(TempKey) - 2] =
'\0';
29 if(!i || !j || (j < i + l)) x = DefaultValue;
32 k = strchr(i + l,
',');
37 x = (dword) strtoul(i + l, NULL, 16);
47 if((k =
ParseLine(k, &plen,
',')) && (plen > 0 && k + plen < j))
49 x |= (strtoul(k, NULL, (plen > 2 && tolower(*(k + 1)) ==
'x' ? 16 : 10)) & 0xff) << 24;
53 if((k =
ParseLine(k, &plen,
',')) && (plen > 0 && k + plen < j))
55 x |= (strtoul(k, NULL, (plen > 2 && tolower(*(k + 1)) ==
'x' ? 16 : 10)) & 0xff) << 16;
59 if((k =
ParseLine(k, &plen,
',')) && (plen > 0 && k + plen < j))
61 x |= (strtoul(k, NULL, (plen > 2 && tolower(*(k + 1)) ==
'x' ? 16 : 10)) & 0xff) << 8;
66 x |= strtoul(k, NULL, (j - k > 2 && tolower(*(k + 1)) ==
'x' ? 16 : 10)) & 0xff;
68 else x = DefaultValue;
70 else x = DefaultValue;
72 else x = DefaultValue;
76 if(Alpha) *Alpha =
A8888(x);
77 if(Red) *Red =
R8888(x);
78 if(Green) *Green =
G8888(x);
79 if(Blue) *Blue =
B8888(x);
void INIFindStartEnd(char *, char **, char **, dword)
bool INIGetARGB8(char *Key, byte *Alpha, byte *Red, byte *Green, byte *Blue, dword DefaultValue)
char * ParseLine(const char *zeile, size_t *n, char delim)