| #pragma once |
| |
| #ifndef _IMG_H_ |
| #define _IMG_H_ |
| |
| #include "tcm.h" |
| #include "machine.h" |
| #include "pixel.h" |
| #include "tnzmovie.h" |
| |
| #undef TNZAPI |
| #ifdef TNZ_IS_IMAGELIB |
| #define TNZAPI TNZ_EXPORT_API |
| #else |
| #define TNZAPI TNZ_IMPORT_API |
| #endif |
| |
| #define IMG_ICON_WIDTH 100 |
| #define IMG_ICON_HEIGHT 90 |
| |
| typedef void *(*MALLOC_TYPE)(int size); |
| typedef void *(*REALLOC_TYPE)(void *ptr, int size); |
| typedef void (*FREE_TYPE)(void *ptr); |
| |
| |
| enum img_type { |
| IMG_NONE, |
| CMAPPED, |
| CMAPPED24, |
| RGB, |
| RGB64, |
| GR8, |
| CMAP |
| }; |
| |
| |
| struct s_pixmap { |
| USHORT *buffer; |
| UCHAR *extra; |
| UCHAR extra_mask; |
| int xsize, ysize; |
| int xSBsize, ySBsize, xD, yD; |
| double x_dpi, y_dpi; |
| double h_pos; |
| }; |
| |
| |
| struct s_cmap { |
| char *name; |
| LPIXEL *buffer; |
| LPIXEL *penbuffer; |
| LPIXEL *colbuffer; |
| LPIXEL *pencil; |
| LPIXEL *color; |
| TCM_INFO info; |
| void *names; |
| |
| |
| int offset; |
| int pencil_n, color_n; |
| }; |
| |
| |
| |
| typedef enum { CM_NONEB = -1, CM_STANDARD, CM_CUSTOM } IMG_CM_ALGORITHM; |
| |
| |
| |
| typedef struct { |
| char rgb_is_compressed; |
| char rgb_write_matte; |
| char rgb_64_bits; |
| char rgb_colorstyle; |
| char tga_bytes_per_pixel; |
| char tga_is_colormap; |
| char tga_is_compressed; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| unsigned short bmp_compression; |
| unsigned short bmp_colorstyle; |
| unsigned short bmp_numcolors; |
| |
| |
| |
| unsigned int jpg_quality; |
| unsigned int jpg_smoothing; |
| unsigned int jpg_components; |
| |
| |
| |
| unsigned short tif_compression; |
| unsigned short tif_orientation; |
| unsigned short tif_photometric; |
| unsigned short tif_bits_per_sample; |
| unsigned short tif_samples_per_pixel; |
| |
| |
| |
| IMG_CM_ALGORITHM cm_algorithm; |
| |
| |
| |
| TNZMOVIE_QUALITY pct_quality; |
| TNZMOVIE_COMPRESSION pct_compression; |
| |
| |
| |
| TNZMOVIE_QUALITY mov_quality; |
| TNZMOVIE_COMPRESSION mov_compression; |
| |
| int avi_bpp; |
| char *avi_compression; |
| } IMG_IO_SETTINGS; |
| |
| |
| typedef struct { |
| enum img_type type; |
| char *filename; |
| char *history; |
| struct s_pixmap icon; |
| struct s_cmap cmap; |
| struct s_pixmap pixmap; |
| IMG_IO_SETTINGS io_settings; |
| } IMAGE; |
| |
| TNZAPI void img_set_mem_functions(MALLOC_TYPE new_malloc_func, |
| REALLOC_TYPE new_realloc_func, |
| FREE_TYPE new_free_func); |
| TNZAPI void img_get_mem_functions(MALLOC_TYPE *new_malloc_func, |
| REALLOC_TYPE *new_realloc_func, |
| FREE_TYPE *new_free_func); |
| TNZAPI IMAGE *new_img(void); |
| TNZAPI IMAGE *new_img_f(char *filename); |
| TNZAPI int allocate_pixmap(IMAGE *img, int xsize, int ysize); |
| TNZAPI int free_img(IMAGE *img); |
| |
| TNZAPI int control_image(IMAGE *ctrl_img); |
| TNZAPI int make_icon(IMAGE *img, int rxsize, int rysize); |
| TNZAPI int make_icon_and_update_sb(IMAGE *img, int rxsize, int rysize); |
| TNZAPI int clear_cmap(IMAGE *img); |
| TNZAPI int attach_cmap(IMAGE *img, char *filename); |
| TNZAPI int force_to_rgb(IMAGE *img, char *path); |
| TNZAPI int rgb_to_grey(IMAGE *img, int cmap_size, int cmap_offset); |
| TNZAPI int apply_cmap(IMAGE *img); |
| |
| TNZAPI void add_white(struct s_cmap *cmap); |
| TNZAPI void remove_white(struct s_cmap *cmap); |
| TNZAPI LPIXEL premult(LPIXEL color); |
| TNZAPI LPIXEL unpremult(LPIXEL color); |
| TNZAPI void check_premultiplied(struct s_cmap *cmap); |
| TNZAPI void fill_cmap_ramp(LPIXEL *buffer, TCM_INFO info, LPIXEL color, |
| LPIXEL pencil, int color_index, int pencil_index, |
| int already_premultiplied); |
| TNZAPI void fill_cmap_colramp(LPIXEL *colbuffer, TCM_INFO info, LPIXEL color, |
| int color_index, int already_premultiplied); |
| TNZAPI void fill_cmap_penramp(LPIXEL *penbuffer, TCM_INFO info, LPIXEL pencil, |
| int pencil_index, int already_premultiplied); |
| TNZAPI void fill_cmap_buffer(LPIXEL *buffer, TCM_INFO info, LPIXEL *color, |
| LPIXEL *pencil, int already_premultiplied); |
| TNZAPI void fill_cmap_colbuffer(LPIXEL *colbuffer, TCM_INFO info, LPIXEL *color, |
| int already_premultiplied); |
| TNZAPI void fill_cmap_penbuffer(LPIXEL *penbuffer, TCM_INFO info, |
| LPIXEL *pencil, int already_premultiplied); |
| TNZAPI void convert_cmap(struct s_cmap *cmap, TCM_INFO new_tcm); |
| |
| |
| TNZAPI void to_new_cmap(struct s_cmap *cmap); |
| TNZAPI void set_colors_and_pencils(struct s_cmap *cmap); |
| |
| TNZAPI void apply_transparency_color(IMAGE *img, TBOOL according_setup_value); |
| TNZAPI void do_apply_transparency_color(IMAGE *img); |
| |
| #endif |