From d025547a9e55a03f762f214f481b650bea6651e4 Mon Sep 17 00:00:00 2001 From: ellson Date: Tue, 30 Sep 2008 19:13:50 +0000 Subject: [PATCH] basically working for svg and x11 colors --- lib/inkpot/inkpot_value.c | 19 +++++++++++++------ lib/inkpot/inkpot_value.h | 3 ++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/inkpot/inkpot_value.c b/lib/inkpot/inkpot_value.c index df322b649..b25e4ea68 100644 --- a/lib/inkpot/inkpot_value.c +++ b/lib/inkpot/inkpot_value.c @@ -33,19 +33,26 @@ inkpot_status_t inkpot_value_set ( inkpot_values_t *values, inkpot_value_t *valu inkpot_status_t inkpot_value_get ( inkpot_values_t *values, inkpot_value_t *value ) { - IDX_VALUES index = value->index; + IDX_VALUES_24 i; /* FIXME - this routine must check for 8 bit values and properly scale to 16 for the api */ - if (index < SZT_VALUES) { - value->value = TAB_VALUES[index]; + if (value->index < SZT_VALUES) { + i = 3 * value->index; + + value->value = TAB_VALUES_24[i++] << 16; + value->value |= TAB_VALUES_24[i++] << 16; + value->value |= TAB_VALUES_24[i] << 16; + value->value |= 0xff; + value->value |= value->value << 8; + value->vtype = VTYPE_rgba; /* FIXME */ } - else if (index - SZT_VALUES < SZT_NONAME_VALUES) { - value->value = TAB_NONAME_VALUES[index - SZT_VALUES]; + else if (value->index - SZT_VALUES < SZT_NONAME_VALUES) { + value->value = TAB_NONAME_VALUES[value->index - SZT_VALUES]; value->vtype = VTYPE_rgba; /* FIXME */ } - else if (index == SZT_VALUES + SZT_NONAME_VALUES) { + else if (value->index == SZT_VALUES + SZT_NONAME_VALUES) { value->vtype = VTYPE_rgba; /* FIXME */ return INKPOT_NOPALETTE; } diff --git a/lib/inkpot/inkpot_value.h b/lib/inkpot/inkpot_value.h index 2e5cbe3d7..c70985e7f 100644 --- a/lib/inkpot/inkpot_value.h +++ b/lib/inkpot/inkpot_value.h @@ -22,6 +22,7 @@ extern "C" { #endif typedef int BIT_VTYPE; +typedef unsigned long VALUE; typedef enum { VTYPE_rgba = 0, @@ -55,7 +56,7 @@ typedef struct inkpot_values_s { typedef struct inkpot_value_s { IDX_VALUES index; /* write by set, read by get, write by first, read/write by next */ BIT_VTYPE vtype; /* read by set, write by get, read by first, read by next */ - unsigned long value; /* read by set, write by get, write by first, write by next */ + VALUE value; /* read by set, write by get, write by first, write by next */ } inkpot_value_t; extern inkpot_status_t inkpot_value_set ( inkpot_values_t *values, inkpot_value_t *value ); -- 2.40.0