Rename GP_Context -> GP_Pixmap
[gfxprim.git] / include / filters / GP_WeightedMedian.h
blob9ae61b8408a8f72d741b66c14534ebfa2ffc4188
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 *****************************************************************************/
28 #ifndef FILTERS_GP_WEIGHTED_MEDIAN_H
29 #define FILTERS_GP_WEIGHTED_MEDIAN_H
31 #include "GP_Filter.h"
33 typedef struct GP_MedianWeights {
34 unsigned int w;
35 unsigned int h;
36 unsigned int *weights;
37 } GP_MedianWeights;
39 int GP_FilterWeightedMedianEx(const GP_Pixmap *src,
40 GP_Coord x_src, GP_Coord y_src,
41 GP_Size w_src, GP_Size h_src,
42 GP_Pixmap *dst,
43 GP_Coord x_dst, GP_Coord y_dst,
44 GP_MedianWeights *weights,
45 GP_ProgressCallback *callback);
47 GP_Pixmap *GP_FilterWeightedMedianExAlloc(const GP_Pixmap *src,
48 GP_Coord x_src, GP_Coord y_src,
49 GP_Size w_src, GP_Size h_src,
50 GP_MedianWeights *weights,
51 GP_ProgressCallback *callback);
53 static inline int GP_FilterWeightedMedian(const GP_Pixmap *src,
54 GP_Pixmap *dst,
55 GP_MedianWeights *weights,
56 GP_ProgressCallback *callback)
58 return GP_FilterWeightedMedianEx(src, 0, 0, src->w, src->h,
59 dst, 0, 0, weights, callback);
62 static inline GP_Pixmap *GP_FilterWeightedMedianAlloc(const GP_Pixmap *src,
63 GP_MedianWeights *weights,
64 GP_ProgressCallback *callback)
66 return GP_FilterWeightedMedianExAlloc(src, 0, 0, src->w, src->h,
67 weights, callback);
70 #endif /* FILTERS_GP_WEIGHTED_MEDIAN_H */