extern inkpot_status_t inkpot_translate ( inkpot_t *inkpot, const char *scheme );
extern inkpot_status_t inkpot_set ( inkpot_t *inkpot, const char *color );
-extern inkpot_status_t inkpot_set_default ( inkpot_t *inkpot );
extern inkpot_status_t inkpot_set_rgba ( inkpot_t *inkpot, double rgba[4] );
extern inkpot_status_t inkpot_set_hsva ( inkpot_t *inkpot, double hsva[4] );
inkpot_scheme_name = inkpot_find_scheme_name(scheme);
if (inkpot_scheme_name) {
idx = inkpot_scheme_name - TAB_SCHEMES_NAME;
- if (! inkpot->scheme_bits) {
- inkpot->default_scheme_name_idx = idx; /* first scheme is default */
- inkpot->default_value_idx = TAB_NAMES[inkpot_scheme_name->default_name_idx].value_idx;
- }
inkpot->scheme_bits |= 1 << idx;
return ((inkpot->status = INKPOT_SUCCESS));
}
inkpot_scheme_index = inkpot_find_scheme_index(scheme);
if (! inkpot_scheme_index)
return ((inkpot->status = INKPOT_SCHEME_UNKNOWN));
- if (inkpot->scheme_index != inkpot_scheme_index) {
+ if (inkpot->scheme_index != inkpot_scheme_index)
inkpot->scheme_index = inkpot_scheme_index;
- if (! inkpot->scheme_bits ) {
- /* Set a default color from an index scheme only if no
- * named schemes are currently active */
- inkpot->default_value_idx = TAB_IXVALUES[inkpot_scheme_index->first_value_idx];
- }
- }
return ((inkpot->status = INKPOT_SUCCESS));
}
return inkpot_set_out_value(inkpot, value_idx);
}
-inkpot_status_t inkpot_set_default( inkpot_t *inkpot )
-{
- return inkpot_set_out_value(inkpot, inkpot->default_value_idx);
-}
-
static int inkpot_rgba_cmpf ( const void *key, const void *base)
{
RGBA rgba_key = *(RGBA*)key;
if ((1<<i) & inkpot->scheme_bits) {
errputs(inkpot, &TAB_STRINGS[TAB_SCHEMES_NAME[i].string_idx]);
errputs(inkpot, " (in)");
- if (i == inkpot->default_scheme_name_idx)
- errputs(inkpot, " (default)");
found++;
}
if ((1<<i) & inkpot->out_scheme_bit) {
inkpot_debug_scheme_names(inkpot, scheme_bits);
errputs(inkpot, " ");
inkpot_debug_rgba(inkpot, TAB_VALUES[name->value_idx].rgba);
- if (name->value_idx == inkpot->default_value_idx)
- errputs(inkpot, " (default)");
errputs(inkpot, "\n");
}
}
typedef struct inkpot_scheme_name_s {
IDX_STRINGS
string_idx; /* The scheme name in TAB_STRINGS. (e.g. "x11") */
-
- IDX_NAMES
- default_name_idx; /* The index of the name of the default color
- * for this scheme. (Each scheme can have
- * a different default. The default must
- * be a member of the scheme */
} inkpot_scheme_name_t;
typedef struct inkpot_scheme_index_s {
* first_value_idx of the next
* inkpot_scheme_index_t in TAB_SCHEMES_INDEX
* or by SZT_SCHEMES_INDEX */
-
- /* (The default value for indexed schemes is
- * always the color indexed by "0" */
} inkpot_scheme_index_t;
typedef struct inkpot_name_s { /* Color_name used by one or more
scheme_bits, /* One bit per inkpot_scheme_name_t */
out_scheme_bit; /* One scheme only for output. */
- IDX_SCHEMES_NAME
- default_scheme_name_idx; /* The index of the scheme which provides
- * the default color. It was the first
- * scheme added. */
-
IDX_VALUES
- default_value_idx, /* The default color */
value_idx; /* The current color */
IDX_IXVALUES
#define SZT_STRINGS sizeof(TAB_STRINGS)/sizeof(TAB_STRINGS[0])
inkpot_scheme_name_t TAB_SCHEMES_NAME[] = { /* schemes of named colors */
- { 0, 1, }, /* french */
- { 7, 0, }, /* svg */
- { 11, 0, }, /* x11 */
+ { 0, }, /* french */
+ { 7, }, /* svg */
+ { 11, }, /* x11 */
};
#define SZT_SCHEMES_NAME (sizeof(TAB_SCHEMES_NAME)/sizeof(TAB_SCHEMES_NAME[0]))
}
}
-#if 0
-
+#if 1
inkpot_debug_schemes(inkpot);
inkpot_debug_names(inkpot);
inkpot_debug_out_names(inkpot);
inkpot_debug_values(inkpot);
-
#endif
fprintf(stdout, "%s ", color); /* ' ' after %s so it doesn't crash on NULL */
rc = inkpot_set(inkpot, color);
- if (rc == INKPOT_COLOR_UNKNOWN) {
+ if (rc == INKPOT_COLOR_UNKNOWN)
fprintf(stdout, "(unknown)");
- rc = inkpot_set_default(inkpot);
- assert (rc == INKPOT_SUCCESS);
- }
fprintf(stdout, "\n text: ");
rc = inkpot_write(inkpot);