1 /*****************************************************************************
2 * This file is part of gfxprim library. *
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. *
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. *
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 *
19 * Copyright (C) 2009-2012 Cyril Hrubis <metan@ucw.cz> *
21 *****************************************************************************/
29 #ifndef FILTERS_GP_LINEAR_H
30 #define FILTERS_GP_LINEAR_H
32 #include "GP_Filter.h"
37 * The sigma parameters defines the blur radii in horizontal and vertical
40 * Internaly this is implemented as separable linear filter (calls vertical and
41 * horizontal convolution with generated gaussian kernel).
43 * This variant could work in-place so it's perectly okay to call
45 * GP_FilterGaussianBlur_Raw(context, context, ...);
47 int GP_FilterGaussianBlur_Raw(const GP_Context
*src
, GP_Context
*dst
,
48 float sigma_x
, float sigma_y
,
49 GP_ProgressCallback
*callback
);
53 * If dst is NULL, new bitmap is allocated.
55 * This variant could work in-place.
57 * Returns pointer to destination bitmap or NULL if allocation failed.
59 GP_Context
*GP_FilterGaussianBlur(const GP_Context
*src
, GP_Context
*dst
,
60 float sigma_x
, float sigma_y
,
61 GP_ProgressCallback
*callback
);
66 * The kernel is array of kw * kh floats and is indexed as two directional
69 * To define 3x3 average filter
81 * This function works also in-place.
83 int GP_FilterLinearConvolution_Raw(const GP_Context
*src
, GP_Context
*dst
,
84 float kernel
[], uint32_t kw
, uint32_t kh
,
85 float kern_div
, GP_ProgressCallback
*callback
);
88 * Special cases for convolution only in horizontal/vertical direction.
90 * These are about 10-30% faster than the generic implementation (depending on
91 * the kernel size, bigger kernel == more savings).
93 * These are two are a base for bilinear filters.
95 * Both works also in-place.
97 int GP_FilterHLinearConvolution_Raw(const GP_Context
*src
, GP_Context
*dst
,
98 float kernel
[], uint32_t kw
, float kern_div
,
99 GP_ProgressCallback
*callback
);
101 int GP_FilterVLinearConvolution_Raw(const GP_Context
*src
, GP_Context
*dst
,
102 float kernel
[], uint32_t kh
, float kern_div
,
103 GP_ProgressCallback
*callback
);
106 * Applies both horizontal and vertical convolution and takes care of the
107 * correct progress callback (both horizontal and vertical kernels are expected
108 * to be similar in size).
110 int GP_FilterVHLinearConvolution_Raw(const GP_Context
*src
, GP_Context
*dst
,
111 float hkernel
[], uint32_t kw
, float hkern_div
,
112 float vkernel
[], uint32_t kh
, float vkern_div
,
113 GP_ProgressCallback
*callback
);
115 #endif /* FILTERS_GP_LINEAR_H */