-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.c
59 lines (46 loc) · 1.29 KB
/
example.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* This file is an image processing operation for GEGL
*/
#ifdef GEGL_PROPERTIES
/* no properties */
#else
#define GEGL_OP_POINT_FILTER
#ifndef IMGFLO_OP_NAME
#define IMGFLO_OP_NAME(orig) orig
#endif
#define GEGL_OP_NAME imgflo_example
#include "gegl-op.h"
static void prepare (GeglOperation *operation)
{
const Babl *format = babl_format ("YA float");
gegl_operation_set_format (operation, "input", format);
gegl_operation_set_format (operation, "output", format);
}
gboolean
process(GeglOperation *op,
void *in_buf, void *out_buf, glong samples,
const GeglRectangle *roi, gint level)
{
float *in = in_buf;
float *out = out_buf;
while (samples--)
{
*out++ = *in++;
*out++ = *in++;
}
return TRUE;
}
static void
gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
GeglOperationPointFilterClass *point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
point_filter_class->process = process;
operation_class->prepare = prepare;
gegl_operation_class_set_keys (operation_class,
"name", IMGFLO_OP_NAME("imgflo:example"),
"title", "imgflo: Make Grey",
"categories" , "grayscale:color",
"description", "Turns the image grayscale",
NULL);
}
#endif