Commit | Line | Data |
---|---|---|
faa9b3e7 TC |
1 | /* Declares utility functions useful across various files which |
2 | aren't meant to be available externally | |
3 | */ | |
4 | ||
5 | #ifndef IMAGEI_H_ | |
6 | #define IMAGEI_H_ | |
7 | ||
8 | #include "image.h" | |
9 | ||
10 | /* wrapper functions that implement the floating point sample version of a | |
11 | function in terms of the 8-bit sample version | |
12 | */ | |
13 | extern int i_ppixf_fp(i_img *im, int x, int y, i_fcolor *pix); | |
14 | extern int i_gpixf_fp(i_img *im, int x, int y, i_fcolor *pix); | |
15 | extern int i_plinf_fp(i_img *im, int l, int r, int y, i_fcolor *pix); | |
16 | extern int i_glinf_fp(i_img *im, int l, int r, int y, i_fcolor *pix); | |
17 | extern int i_gsampf_fp(i_img *im, int l, int r, int y, i_fsample_t *samp, | |
18accb2a | 18 | int const *chans, int chan_count); |
faa9b3e7 TC |
19 | |
20 | /* wrapper functions that forward palette calls to the underlying image, | |
21 | assuming the underlying image is the first pointer in whatever | |
22 | ext_data points at | |
23 | */ | |
24 | extern int i_addcolors_forward(i_img *im, i_color *, int count); | |
25 | extern int i_getcolors_forward(i_img *im, int i, i_color *, int count); | |
26 | extern int i_colorcount_forward(i_img *im); | |
27 | extern int i_maxcolors_forward(i_img *im); | |
28 | extern int i_findcolor_forward(i_img *im, i_color *color, i_palidx *entry); | |
29 | extern int i_setcolors_forward(i_img *im, int index, i_color *colors, | |
30 | int count); | |
31 | ||
32 | #define SampleFTo16(num) ((int)((num) * 65535.0 + 0.01)) | |
33 | /* we add that little bit to avoid rounding issues */ | |
34 | #define Sample16ToF(num) ((num) / 65535.0) | |
35 | ||
36 | #define SampleFTo8(num) ((int)((num) * 255.0 + 0.01)) | |
37 | #define Sample8ToF(num) ((num) / 255.0) | |
38 | ||
39 | #define Sample16To8(num) ((num) / 257) | |
40 | #define Sample8To16(num) ((num) * 257) | |
41 | ||
efdc2568 TC |
42 | extern void i_get_combine(int combine, i_fill_combine_f *, i_fill_combinef_f *); |
43 | ||
77157728 TC |
44 | extern int |
45 | i_int_check_image_file_limits(int width, int height, int channels, int sample_size); | |
46 | ||
b33c08f8 TC |
47 | #include "ext.h" |
48 | ||
49 | extern UTIL_table_t i_UTIL_table; | |
50 | ||
ffeb4a67 TC |
51 | /* Ideally this will move into imconfig.h if we ever probe */ |
52 | #if defined(_GNU_SOURCE) || __STDC_VERSION__ >= 199901L | |
53 | /* snprintf() is part of C99 and provided by Glibc */ | |
54 | #define HAVE_SNPRINTF | |
55 | #endif | |
56 | ||
faa9b3e7 | 57 | #endif |