filters: GP_Linear.h remove the forgotten blur functions.
[gfxprim.git] / include / filters / GP_Linear.h
blobae96e340ece193fc99c5981cf3f24096743ebf97
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 Linear Convolution _Raw filters.
29 #ifndef FILTERS_GP_LINEAR_H
30 #define FILTERS_GP_LINEAR_H
32 #include "GP_Filter.h"
35 * Linear convolution.
37 * The kernel is array of kw * kh floats and is indexed as two directional
38 * array.
40 * The src coordinates and size defines rectangle in the source on which the
41 * filter operates.
43 * The dst coodinates defines start pixel of in the destination context.
45 * To define 3x3 average filter
47 * kernel[] = {
48 * 1, 1, 1,
49 * 1, 1, 1,
50 * 1, 1, 1,
51 * };
53 * kw = kh = 3
55 * kern_div = 9
57 * This function works also in-place.
59 int GP_FilterLinearConvolution_Raw(const GP_Context *src,
60 GP_Coord x_src, GP_Coord y_src,
61 GP_Size w_src, GP_Size h_src,
62 GP_Context *dst,
63 GP_Coord x_dst, GP_Coord y_dst,
64 float kernel[], uint32_t kw, uint32_t kh,
65 float kern_div, GP_ProgressCallback *callback);
68 * Special cases for convolution only in horizontal/vertical direction.
70 * These are about 10-30% faster than the generic implementation (depending on
71 * the kernel size, bigger kernel == more savings).
73 * These are two are a base for bilinear filters.
75 * Both works also in-place.
77 int GP_FilterHLinearConvolution_Raw(const GP_Context *src,
78 GP_Coord x_src, GP_Coord y_src,
79 GP_Size w_src, GP_Size h_src,
80 GP_Context *dst,
81 GP_Coord x_dst, GP_Coord y_dst,
82 float kernel[], uint32_t kw, float kern_div,
83 GP_ProgressCallback *callback);
85 int GP_FilterVLinearConvolution_Raw(const GP_Context *src,
86 GP_Coord x_src, GP_Coord y_src,
87 GP_Size w_src, GP_Size h_src,
88 GP_Context *dst,
89 GP_Coord x_dst, GP_Coord y_dst,
90 float kernel[], uint32_t kh, float kern_div,
91 GP_ProgressCallback *callback);
94 * Applies both horizontal and vertical convolution and takes care of the
95 * correct progress callback (both horizontal and vertical kernels are expected
96 * to be similar in size).
98 int GP_FilterVHLinearConvolution_Raw(const GP_Context *src,
99 GP_Coord x_src, GP_Coord y_src,
100 GP_Size w_src, GP_Size h_src,
101 GP_Context *dst,
102 GP_Coord x_dst, GP_Coord y_dst,
103 float hkernel[], uint32_t kw, float hkern_div,
104 float vkernel[], uint32_t kh, float vkern_div,
105 GP_ProgressCallback *callback);
108 * Prints a kernel into the stdout.
110 void GP_FilterKernelPrint_Raw(float kernel[], int kw, int kh, float kern_div);
112 #endif /* FILTERS_GP_LINEAR_H */