color_free.c

Go to the documentation of this file.
00001 #include <stdlib.h>
00002 #include "gis.h"
00003 
00004 
00017 int G_free_colors (
00018     struct Colors *colors)
00019 {
00020     G__color_reset (colors);
00021     G_init_colors (colors);
00022 
00023     return 0;
00024 }
00025 
00026 /*******************************************
00027  * G__color* routines only to be used by other routines in this
00028  * library
00029  *******************************************/
00030 
00031 int G__color_free_rules (
00032     struct _Color_Info_ *cp)
00033 {
00034     struct _Color_Rule_ *rule, *next;
00035 
00036     for (rule = cp->rules; rule; rule = next)
00037     {
00038         next = rule->next;
00039         free (rule);
00040     }
00041     cp->rules = NULL;
00042 
00043     return 0;
00044 }
00045 
00046 int G__color_free_lookup (
00047     struct _Color_Info_ *cp)
00048 {
00049     if (cp->lookup.active)
00050     {
00051         free (cp->lookup.red);
00052         free (cp->lookup.blu);
00053         free (cp->lookup.grn);
00054         free (cp->lookup.set);
00055         cp->lookup.active = 0;
00056     }
00057 
00058     return 0;
00059 }
00060 
00061 int G__color_free_fp_lookup ( struct _Color_Info_ *cp)
00062 {
00063     if (cp->fp_lookup.active)
00064     {
00065         free (cp->fp_lookup.vals);
00066         free (cp->fp_lookup.rules);
00067         cp->fp_lookup.active = 0;
00068         cp->fp_lookup.nalloc = 0;
00069     }
00070 
00071     return 0;
00072 }
00073 
00074 int G__color_reset (
00075     struct Colors *colors)
00076 {
00077     G__color_free_lookup(&colors->fixed);
00078     G__color_free_lookup(&colors->modular);
00079     G__color_free_rules(&colors->fixed);
00080     G__color_free_rules(&colors->modular);
00081     colors->version = 0;
00082         /* this routine should NOT init the colors */
00083 
00084     return 0;
00085 }

Generated on Mon Jan 1 19:49:25 2007 for GRASS by  doxygen 1.5.1