diff --git a/.gitattributes b/.gitattributes index adcf3d11479c7e3a7e43ed8aa255a4db9c788a58..d27c86aae2e715013bd04da4b99de0f317010ed2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -40,6 +40,7 @@ testfont binary /src/modules/Gz/zlibmod.c foreign_ident /src/modules/Image/blit.c foreign_ident /src/modules/Image/blit_layer_include.h foreign_ident +/src/modules/Image/colortable.c foreign_ident /src/modules/Image/dct.c foreign_ident /src/modules/Image/font.c foreign_ident /src/modules/Image/image.c foreign_ident diff --git a/src/modules/Image/colortable.c b/src/modules/Image/colortable.c new file mode 100644 index 0000000000000000000000000000000000000000..89bdf2a924a342c2c2ed3a4b3967b9fefc4da485 --- /dev/null +++ b/src/modules/Image/colortable.c @@ -0,0 +1,104 @@ +#include <config.h> + +/* $Id: colortable.c,v 1.1 1997/05/01 12:38:41 mirar Exp $ */ + +/* +**! module Image +**! class colortable +**! +**! This object keeps colortable information, +**! mostly for image re-coloring (quantization). +**! +**! see also: Image, Image.image, Image.font +*/ + + +#include "global.h" + +#include <sys/types.h> +#include <sys/stat.h> + +#include <netinet/in.h> +#include <errno.h> + +#include "config.h" + +#include "stralloc.h" +#include "types.h" +#include "pike_macros.h" +#include "object.h" +#include "constants.h" +#include "interpret.h" +#include "svalue.h" +#include "array.h" +#include "threads.h" +#include "builtin_functions.h" + +#include "image.h" + + +struct program *colortable_program; + +#define THIS (*(struct colortable **)(fp->current_storage)) +#define THISOBJ (fp->current_object) + +#if 0 + +/***************** init & exit *********************************/ + +static inline void free_colortable_struct(struct colortable *colortable) +{ + if (colortable) + { + if (colortable->mem) + { +#ifdef HAVE_MMAP + munmap(colortable->mem,colortable->mmaped_size); +#else + free(colortable->mem); +#endif + } + free(colortable); + } +} + +static void init_colortable_struct(struct object *o) +{ + THIS=NULL; +} + +static void exit_colortable_struct(struct object *obj) +{ + free_colortable_struct(THIS); + THIS=NULL; +} + +/***************** global init etc *****************************/ + +/* + +*/ + +void init_colortable_programs(void) +{ + start_new_program(); + add_storage(sizeof(struct colortable*)); + + set_init_callback(init_colortable_struct); + set_exit_callback(exit_colortable_struct); + + colortable_program=end_program(); + add_program_constant("colortable",colortable_program, 0); +} + +void exit_colortable(void) +{ + if(colortable_program) + { + free_program(colortable_program); + colortable_program=0; + } +} + + +#endif