diff options
Diffstat (limited to 'generic/Attrs.c')
-rw-r--r-- | generic/Attrs.c | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/generic/Attrs.c b/generic/Attrs.c index bfd155c..45d7dc8 100644 --- a/generic/Attrs.c +++ b/generic/Attrs.c @@ -502,115 +502,3 @@ LineEndDuplicate(ZnLineEnd le) le->ref_count++; return le; } - - -/* - **************************************************************** - * - * Code for gradient geometry. - * - **************************************************************** - */ -static Tcl_HashTable gradient_geom_cache; -static ZnBool gradient_inited = False; - -ZnGradientGeom -GradientGeomCreate(Tcl_Interp *interp, - char *grad_geom_str) -{ - Tcl_HashEntry *entry; - ZnGradientGeom gg; - int new; - char *next_ptr, *ptr; - int d1, d2, angle; - - if (!gradient_inited) { - Tcl_InitHashTable(&gradient_geom_cache, TCL_STRING_KEYS); - gradient_inited = True; - } - - entry = Tcl_CreateHashEntry(&gradient_geom_cache, grad_geom_str, &new); - if (!new) { - gg = (ZnGradientGeom) Tcl_GetHashValue(entry); - gg->ref_count++; - return gg; - } - - d1 = d2 = 50; - angle = 0; - ptr = grad_geom_str; - if (!*ptr) { - error_gg: - Tcl_AppendResult(interp, "incorrect gradient geometry spec: \"", - grad_geom_str, - "\", should be: [threshold1][-threshold2][/angle]", NULL); - return NULL; - } - if (*ptr != '/') { - d1 = strtol(ptr, &next_ptr, 10); - if (next_ptr == ptr) { - goto error_gg; - } - ptr = next_ptr; - if (*next_ptr == '-') { - ptr++; - d2 = strtol(ptr, &next_ptr, 10); - if (next_ptr == ptr) { - goto error_gg; - } - ptr = next_ptr; - } - } - if (*ptr == '/') { - ptr++; - angle = strtol(ptr, &next_ptr, 10); - if (*next_ptr != 0) { - goto error_gg; - } - ptr = next_ptr; - while (angle < 0) { - angle += 360; - } - while (angle >= 360) { - angle -= 360; - } - } - else if (*next_ptr != 0) { - goto error_gg; - } - gg = (ZnGradientGeom) ZnMalloc(sizeof(ZnGradientGeomStruct)); - gg->d1 = d1; - gg->d2 = d2; - gg->angle = angle; - gg->entry = entry; - gg->ref_count = 1; - Tcl_SetHashValue(entry, (ClientData) gg); - - return gg; -} - - -char * -GradientGeomGetString(ZnGradientGeom gg) -{ - return Tcl_GetHashKey(&gradient_geom_cache, gg->entry); -} - - -void -GradientGeomDelete(ZnGradientGeom gg) -{ - gg->ref_count--; - if (gg->ref_count == 0) { - Tcl_DeleteHashEntry(gg->entry); - ZnFree(gg); - } -} - - -ZnGradientGeom -GradientGeomDuplicate(ZnGradientGeom gg) -{ - gg->ref_count++; - return gg; -} |