1Imager::Preprocess(3) User Contributed Perl DocumentationImager::Preprocess(3)
2
3
4

NAME

6       Imager::Preprocess - simple preprocessor for handling multiple sample
7       sizes
8

SYNOPSIS

10         /* in the source: */
11         #code condition true to work with 8-bit samples
12         ... code using preprocessor types/values ...
13         #/code
14
15         perl -MImager -epreprocess foo.im foo.c
16

DESCRIPTION

18       This is a simple preprocessor that aims to reduce duplication of source
19       code when implementing an algorithm both for 8-bit samples and double
20       samples in Imager.
21
22       Imager's Makefile.PL currently scans the MANIFEST for .im files and
23       adds Makefile files to convert these to .c files.
24
25       The beginning of a sample-independent section of code is preceded by:
26
27         #code expression
28
29       where expression should return true if processing should be done at
30       8-bits/sample.
31
32       You can also use a #code block around a function definition to produce
33       8-bit and double sample versions of a function.  In this case #code has
34       no expression and you will need to use IM_SUFFIX() to produce different
35       function names.
36
37       The end of a sample-independent section of code is terminated by:
38
39         #/code
40
41       #code sections cannot be nested.
42
43       #/code without a starting #code is an error.
44
45       The following types and values are defined in a #code section:
46
47       ·   IM_GPIX(im, x, y, &col)
48
49       ·   IM_GLIN(im, l, r, y, colors)
50
51       ·   IM_PPIX(im, x, y, &col)
52
53       ·   IM_PLIN(im, x, y, colors)
54
55       ·   IM_GSAMP(im, l, r, y, samples, chans, chan_count)
56
57           These correspond to the appropriate image function, eg. IM_GPIX()
58           becomes i_gpix() or i_gpixf() as appropriate.
59
60       ·   IM_ADAPT_COLORS(dest_channes, src_channels, colors, count)
61
62           Call i_adapt_colors() or i_adapt_fcolors().
63
64       ·   IM_FILL_COMBINE(fill) - retrieve the combine function from a fill
65           object.
66
67       ·   IM_FILL_FILLER(fill) - retrieve the fill_with_* function from a
68           fill object.
69
70       ·   IM_SAMPLE_MAX - maximum value for a sample
71
72       ·   IM_SAMPLE_MAX2 - maximum value for a sample, squared
73
74       ·   IM_SAMPLE_T - type of a sample (i_sample_t or i_fsample_t)
75
76       ·   IM_COLOR - color type, either i_color or i_fcolor.
77
78       ·   IM_WORK_T - working sample type, either int or double.
79
80       ·   IM_Sf - format string for the sample type, "%d" or "%f".
81
82       ·   IM_Wf - format string for the work type, "%d" or "%f".
83
84       ·   IM_SUFFIX(identifier) - adds _8 or _double onto the end of identi‐
85           fier.
86
87       ·   IM_EIGHT_BIT - this is a macro defined only in 8-bit/sample code.
88
89       Other types, functions and values may be added in the future.
90

AUTHOR

92       Tony Cook <tony@imager.perl.org>
93
94
95
96perl v5.8.8                       2008-03-28             Imager::Preprocess(3)
Impressum