]> granicus.if.org Git - graphviz/commitdiff
basically working for svg and x11 colors
authorellson <devnull@localhost>
Tue, 30 Sep 2008 19:13:50 +0000 (19:13 +0000)
committerellson <devnull@localhost>
Tue, 30 Sep 2008 19:13:50 +0000 (19:13 +0000)
lib/inkpot/inkpot_value.c
lib/inkpot/inkpot_value.h

index df322b6495c26774af10c3237351a8ebcc8772db..b25e4ea6887b8023172b3141689d13bf58e5605b 100644 (file)
@@ -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;
     }
index 2e5cbe3d71cf3629d8940d7a1119ab8c7183800c..c70985e7faa9bbb2d418ee3d968e8fbd752668eb 100644 (file)
@@ -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 );