1 %% extends "filter.c.t"
3 %% macro filter_point_include()
6 #include "core/GP_Debug.h"
8 #include "filters/GP_ApplyTables.h"
9 #include "filters/GP_Point.h"
12 %% macro filter_point_ex(op_name, filter_op, fopts)
13 int GP_Filter{{ op_name }}Ex(const GP_Context *const src,
14 GP_Coord x_src, GP_Coord y_src,
15 GP_Size w_src, GP_Size h_src,
17 GP_Coord x_dst, GP_Coord y_dst,
18 {{ maybe_opts_r(fopts) }}
19 GP_ProgressCallback *callback)
21 const GP_PixelTypeDescription *desc;
22 GP_FilterTables tables;
27 if (GP_FilterTablesInit(&tables, src))
30 desc = GP_PixelTypeDesc(src->pixel_type);
32 for (i = 0; i < desc->numchannels; i++) {
33 GP_Pixel chan_max = (1 << desc->channels[i].size);
34 GP_Pixel *table = tables.table[i];
36 for (j = 0; j < chan_max; j++)
37 table[j] = {{ filter_op('((signed)j)', '((signed)chan_max - 1)') }};
40 ret = GP_FilterTablesApply(src, x_src, y_src, w_src, h_src,
41 dst, x_dst, y_dst, &tables, callback);
44 GP_FilterTablesFree(&tables);
51 %% macro filter_point_ex_alloc(op_name, fopts, opts)
52 GP_Context *GP_Filter{{ op_name }}ExAlloc(const GP_Context *const src,
53 GP_Coord x_src, GP_Coord y_src,
54 GP_Size w_src, GP_Size h_src,
55 {{ maybe_opts_r(fopts) }}
56 GP_ProgressCallback *callback)
58 GP_Context *new = GP_ContextAlloc(w_src, h_src,
61 if (GP_Filter{{ op_name }}Ex(src, x_src, y_src, w_src, h_src, new, 0, 0,
62 {{ maybe_opts_r(opts) }}callback)) {
73 %% macro filter_point(op_name, filter_op, fopts="", opts="")
74 {{ filter_point_include() }}
75 {{ filter_point_ex(op_name, filter_op, fopts) }}
76 {{ filter_point_ex_alloc(op_name, fopts, opts) }}