]> granicus.if.org Git - graphviz/commitdiff
remove unused 'colorCvt'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 18 Dec 2021 04:31:54 +0000 (20:31 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 18 Dec 2021 22:33:18 +0000 (14:33 -0800)
lib/common/colorprocs.h
lib/common/colxlate.c

index 7a375ac3270dc377e6ede25c6e9e7b7be735cefb..598950669bc8cd724a8f87cdcf514b6dabca2500 100644 (file)
@@ -19,7 +19,6 @@ extern "C" {
 extern void setColorScheme (char* s);
 extern int colorxlate(char *str, gvcolor_t * color, color_type_t target_type);
 extern char *canontoken(char *str);
-extern int colorCvt(gvcolor_t *ocolor, gvcolor_t *ncolor);
 
 #ifdef __cplusplus
 }
index fe419ef3a516837c49d731f3f2d249c029f617ea..85aa74f918c5bc9fed6fdd37f89d60ea7c725125 100644 (file)
@@ -465,79 +465,6 @@ int colorxlate(char *str, gvcolor_t * color, color_type_t target_type)
     return rc;
 }
 
-static void rgba_wordToByte (int* rrggbbaa, unsigned char* rgba)
-{
-    int i;
-
-    for (i = 0; i < 4; i++) {
-       rgba[i] = rrggbbaa[i] * 255 / 65535;
-    }
-}
-
-static void rgba_dblToByte (double* RGBA, unsigned char* rgba)
-{
-    int i;
-
-    for (i = 0; i < 4; i++) {
-       rgba[i] = (unsigned char)(RGBA[i] * 255);
-    }
-}
-
-/* colorCvt:
- * Color format converter. 
- * Except for the trivial case, it converts the input color to a string
- * representation and then calls colorxlate.
- * ncolor must point to a gvcolor_t struct with type specifying the desired
- * output type.
- */
-int colorCvt(gvcolor_t *ocolor, gvcolor_t *ncolor)
-{
-    int rc;
-    char buf[BUFSIZ];
-    char* s;
-    unsigned char rgba[4];
-
-    if (ocolor->type == ncolor->type) {
-       memcpy (&ncolor->u, &ocolor->u, sizeof(ocolor->u));    
-       return COLOR_OK; 
-    }
-    s = buf;
-    switch (ocolor->type) {
-    case HSVA_DOUBLE :
-       snprintf(buf, sizeof(buf), "%.03f %.03f %.03f %.03f",
-           ocolor->u.HSVA[0], ocolor->u.HSVA[1], ocolor->u.HSVA[2], ocolor->u.HSVA[3]);
-       break;
-    case RGBA_BYTE :
-       snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x",
-           ocolor->u.rgba[0], ocolor->u.rgba[1], ocolor->u.rgba[2], ocolor->u.rgba[3]);
-       break;
-    case RGBA_WORD:
-       rgba_wordToByte (ocolor->u.rrggbbaa, rgba);
-       snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x", rgba[0], rgba[1], rgba[2],
-                rgba[3]);
-       break;
-    case RGBA_DOUBLE:
-       rgba_dblToByte (ocolor->u.RGBA, rgba);
-       snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x", rgba[0], rgba[1], rgba[2],
-                rgba[3]);
-       break;
-    case COLOR_STRING:
-       s = ocolor->u.string;
-       break;
-    case CMYK_BYTE :
-       return COLOR_UNKNOWN;
-       break;
-    case COLOR_INDEX:
-       return COLOR_UNKNOWN;
-       break;
-    default:
-       return COLOR_UNKNOWN;
-       break;
-    }
-    rc = colorxlate (s, ncolor, ncolor->type);
-    return rc;
-}
-
 /* setColorScheme:
  * Set current color scheme for resolving names.
  */