2 * Sherlock: Custom Parts of Configuration
4 * (c) 2001--2002 Martin Mares <mj@ucw.cz>
15 custom_create_attrs(struct odes *odes, struct card_attr *ca)
18 uns ox, oy, tw, th, ncolors;
19 uns ifmt, isize, icol;
23 x = obj_find_aval(odes, 'G');
24 ctype = obj_find_aval(odes, 'T');
25 if (!x || !ctype || sscanf(x, "%d%d%s%d%d%d", &ox, &oy, ocspace, &ncolors, &tw, &th) != 6)
31 if (!strcasecmp(ctype, "image/jpeg"))
33 else if (!strcasecmp(ctype, "image/png"))
35 else if (!strcasecmp(ctype, "image/gif"))
39 log(L_ERROR, "Unknown image content-type: %s", ctype);
43 if (ox <= 100 && oy <= 100)
45 else if (ox <= 320 && oy <= 200)
47 else if (ox <= 640 && oy <= 480)
52 if (!strcasecmp(ocspace, "GRAY"))
54 else if (ncolors <= 16)
56 else if (ncolors <= 256)
61 ca->image_flags = ifmt | (isize << 2) | (icol << 4);
65 custom_it_parse(u32 *dest, byte *value, uns intval)
68 return "IMGTYPE: number expected";
70 return "IMGTYPE out of range";
76 custom_is_parse(u32 *dest, byte *value, uns intval)
79 return "IMGSIZE: number expected";
81 return "IMGSIZE out of range";
87 custom_ic_parse(u32 *dest, byte *value, uns intval)
90 return "IMGCOLORS: number expected";
92 return "IMGCOLORS out of range";
101 /* FIXME: The example is wrong */
104 custom_get_lm(struct card_attr *ca, byte *attr)
113 custom_parse_lm(u32 *dest, byte *value, uns intval)
116 return "LM is an integer, not a string";