1 /* icotool.h - Common definitions for icotool 2 * 3 * Copyright (C) 1998 Oskar Liljeblad 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef ICOTOOL_H 20 #define ICOTOOL_H 21 22 #include <stdbool.h> /* POSIX/Gnulib */ 23 #include <stdint.h> /* POSIX/Gnulib */ 24 #include <stdio.h> /* C89 */ 25 #include "common/common.h" 26 27 typedef struct _Palette Palette; 28 29 /* palette.c */ 30 Palette *palette_new(void); 31 void palette_free(Palette *palette); 32 void palette_add(Palette *palette, uint8_t r, uint8_t g, uint8_t b); 33 bool palette_next(Palette *palette, uint8_t *r, uint8_t *g, uint8_t *b); 34 void palette_assign_indices(Palette *palette); 35 uint32_t palette_lookup(Palette *palette, uint8_t r, uint8_t g, uint8_t b); 36 uint32_t palette_count(Palette *palette); 37 38 /* extract.c */ 39 typedef FILE *(*ExtractNameGen)(const char *inname, char **outname, int width, int height, int bitcount, int index); 40 typedef bool (*ExtractFilter)(int index, int width, int height, int bitdepth, int palettesize, bool icon, int hotspot_x, int hotspot_y); 41 int extract_icons(FILE *in, const char *inname, bool listmode, ExtractNameGen outfile_gen, ExtractFilter filter); 42 43 /* create.c */ 44 typedef FILE *(*CreateNameGen)(char **outname); 45 typedef struct InputFile_s { 46 char *name; 47 bool is_raw; 48 int32_t bit_count; 49 int32_t hotspot_x; 50 int32_t hotspot_y; 51 } InputFile; 52 typedef struct InputFiles_s { 53 size_t count; 54 InputFile *files; 55 } InputFiles; 56 bool create_icon(InputFiles *files, CreateNameGen outfile_gen, bool icon_mode, int32_t alpha_threshold); 57 #endif 58