Rename GP_Context -> GP_Pixmap
[gfxprim.git] / include / filters / GP_Sigma.h
blob1def498138ce4f953b9cc23e8c6224a833cf3a34
1 /*****************************************************************************
2 * This file is part of gfxprim library. *
3 * *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
18 * *
19 * Copyright (C) 2009-2012 Cyril Hrubis <metan@ucw.cz> *
20 * *
21 *****************************************************************************/
25 Sigma Lee filter.
27 The xrad and yrad denotes radius the filter works on. The number of neighbor
28 pixels is exactly 2 * rad + 1 for both directions.
30 The sigma denotes maximal symetric difference of pixels scaled to [0,1]
31 interval. Greater sigma causes results to be closer to mean linear filter.
33 The min parameter defines minimial number of pixels that must be in the two
34 sigma iterval, if there is a less pixels in this interval the new pixel
35 value is computed as mean of the surrounding pixels (not including the
36 center one).
40 #ifndef FILTERS_GP_SIGMA_H
41 #define FILTERS_GP_SIGMA_H
43 #include "GP_Filter.h"
45 int GP_FilterSigmaEx(const GP_Pixmap *src,
46 GP_Coord x_src, GP_Coord y_src,
47 GP_Size w_src, GP_Size h_src,
48 GP_Pixmap *dst,
49 GP_Coord x_dst, GP_Coord y_dst,
50 int xrad, int yrad,
51 unsigned int min, float sigma,
52 GP_ProgressCallback *callback);
54 GP_Pixmap *GP_FilterSigmaExAlloc(const GP_Pixmap *src,
55 GP_Coord x_src, GP_Coord y_src,
56 GP_Size w_src, GP_Size h_src,
57 int xrad, int yrad,
58 unsigned int min, float sigma,
59 GP_ProgressCallback *callback);
61 static inline int GP_FilterSigma(const GP_Pixmap *src,
62 GP_Pixmap *dst,
63 int xrad, int yrad,
64 unsigned int min, float sigma,
65 GP_ProgressCallback *callback)
67 return GP_FilterSigmaEx(src, 0, 0, src->w, src->h,
68 dst, 0, 0, xrad, yrad, min, sigma, callback);
71 static inline GP_Pixmap *GP_FilterSigmaAlloc(const GP_Pixmap *src,
72 int xrad, int yrad,
73 unsigned int min, float sigma,
74 GP_ProgressCallback *callback)
76 return GP_FilterSigmaExAlloc(src, 0, 0, src->w, src->h,
77 xrad, yrad, min, sigma, callback);
80 #endif /* FILTERS_GP_SIGMA_H */