1 /* This file is part of GEGL
2  *
3  * GEGL is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 3 of the License, or (at your option) any later version.
7  *
8  * GEGL is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
15  *
16  * Copyright 2006 Øyvind Kolås
17  */
18 
19 /* GeglOperationPointFilter
20  * The point-filter base class is for filters where an output pixel only depends on the color and alpha values
21  * of the corresponding input pixel. This allows you to do the processing on linear buffers, in the future
22  * versions of GEGL operations implemented using the point-filter will get speed increases due to more
23  * intelligent processing possible in the point filter class
24  */
25 
26 #ifndef __GEGL_OPERATION_POINT_FILTER_H__
27 #define __GEGL_OPERATION_POINT_FILTER_H__
28 
29 #include "gegl-operation-filter.h"
30 
31 #include "opencl/gegl-cl.h"
32 
33 G_BEGIN_DECLS
34 
35 #define GEGL_TYPE_OPERATION_POINT_FILTER            (gegl_operation_point_filter_get_type ())
36 #define GEGL_OPERATION_POINT_FILTER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_POINT_FILTER, GeglOperationPointFilter))
37 #define GEGL_OPERATION_POINT_FILTER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GEGL_TYPE_OPERATION_POINT_FILTER, GeglOperationPointFilterClass))
38 #define GEGL_IS_OPERATION_POINT_FILTER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_POINT_FILTER))
39 #define GEGL_IS_OPERATION_POINT_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GEGL_TYPE_OPERATION_POINT_FILTER))
40 #define GEGL_OPERATION_POINT_FILTER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GEGL_TYPE_OPERATION_POINT_FILTER, GeglOperationPointFilterClass))
41 
42 typedef struct _GeglOperationPointFilter  GeglOperationPointFilter;
43 struct _GeglOperationPointFilter
44 {
45   GeglOperationFilter parent_instance;
46 };
47 
48 typedef struct _GeglOperationPointFilterClass GeglOperationPointFilterClass;
49 struct _GeglOperationPointFilterClass
50 {
51   GeglOperationFilterClass parent_class;
52 
53   gboolean (* process) (GeglOperation      *self,    /* for parameters    */
54                         void               *in_buf,  /* input buffer      */
55                         void               *out_buf, /* output buffer     */
56                         glong               samples, /* number of samples */
57                         const GeglRectangle *roi,    /* rectangle out_buf spans
58                                                         in in buffer, see the
59                                                         checkerboard op for
60                                                         semantics */
61                         gint                 level);
62   gboolean (* cl_process) (GeglOperation       *self,
63                            cl_mem               in_tex,
64                            cl_mem               out_tex,
65                            size_t               global_worksize,
66                            const GeglRectangle *roi,
67                            gint                 level);
68   gpointer                 pad[4];
69 };
70 
71 GType gegl_operation_point_filter_get_type (void) G_GNUC_CONST;
72 
73 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeglOperationPointFilter, g_object_unref)
74 
75 G_END_DECLS
76 
77 #endif
78