forked from OpenCL/GEGL-OpenCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
geglbuffer-clock.c
93 lines (76 loc) · 2.7 KB
/
geglbuffer-clock.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include <stdlib.h>
#include <gegl.h>
#include <glib/gprintf.h>
#include <sys/time.h>
#include <time.h>
gint
main (gint argc,
gchar **argv)
{
GeglNode *gegl; /* the gegl graph we're using as a node factor */
GeglBuffer *buffer;
GeglNode *display,
*text,
*layer,
*crop,
*shift,
*blank;
if (argv[1]==NULL)
{
g_print ("\nUsage: %s <GeglBuffer>\n"
"\n"
"Continously writes a timestamp to 0,0 in the buffer\n", argv[0]);
exit (-1);
}
gegl_init (&argc, &argv); /* initialize the GEGL library */
gegl = gegl_node_new ();
buffer = gegl_buffer_open (argv[1]);
blank = gegl_node_new_child (gegl,
"operation", "gegl:color",
"value", gegl_color_new ("rgba(0.0,0.0,0.0,0.4)"),
NULL);
crop = gegl_node_new_child (gegl,
"operation", "gegl:crop",
"x", 0.0,
"y", 0.0,
"width", 260.0,
"height", 22.0,
NULL);
layer = gegl_node_new_child (gegl,
"operation", "gegl:layer",
NULL);
shift = gegl_node_new_child (gegl,
"operation", "gegl:translate",
"x", 0.0,
"y", 0.0,
NULL);
text = gegl_node_new_child (gegl,
"operation", "gegl:text",
"size", 20.0,
"color", gegl_color_new ("rgb(1.0,1.0,1.0)"),
NULL);
display = gegl_node_new_child (gegl,
"operation", "gegl:write-buffer",
"buffer", buffer,
NULL);
gegl_node_link_many (blank, crop, layer, shift, display, NULL);
gegl_node_connect_to (text, "output", layer, "aux");
/* request that the save node is processed, all dependencies will
* be processed as well
*/
{
gint frame;
gint frames = 1024;
for (frame=0; frame<frames; frame++)
{
struct timeval tv;
gettimeofday(&tv, NULL);
gegl_node_set (text, "string", ctime((void*)&tv), NULL);
gegl_node_process (display);
g_usleep (1000000);
}
}
/* free resources globally used by GEGL */
gegl_exit ();
return 0;
}