summaryrefslogtreecommitdiff
path: root/src/bin/ecore_evas/ecore_evas_svg.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-04-10 14:00:19 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-10 14:04:33 +0200
commitc560979196ab35423a31283a9179dfdc8408088d (patch)
treea70863b9e1848b7cec310d4fbb9c1b34e341d2bc /src/bin/ecore_evas/ecore_evas_svg.c
parent0822485465015aa3ca6abc40fa72417308f2c174 (diff)
ecore_evas: remove unwanted binary.
This binary should have been removed before merging the branch. It did sleep in for no good reason, removing now.
Diffstat (limited to '')
-rw-r--r--src/bin/ecore_evas/ecore_evas_svg.c198
1 files changed, 0 insertions, 198 deletions
diff --git a/src/bin/ecore_evas/ecore_evas_svg.c b/src/bin/ecore_evas/ecore_evas_svg.c
deleted file mode 100644
index bd95a0618a..0000000000
--- a/src/bin/ecore_evas/ecore_evas_svg.c
+++ /dev/null
@@ -1,198 +0,0 @@
1#ifdef HAVE_CONFIG_H
2#include <config.h>
3#endif
4
5#ifdef HAVE_EVIL
6# include <Evil.h>
7#endif
8
9#include <Eina.h>
10#include <Evas.h>
11#include <Ecore.h>
12#include <Ecore_Getopt.h>
13#include <Ecore_Evas.h>
14
15#undef EINA_LOG_DOMAIN_DEFAULT
16#define EINA_LOG_DOMAIN_DEFAULT _log_dom
17static int _log_dom = -1;
18
19static void
20_cb_delete(Ecore_Evas *ee EINA_UNUSED)
21{
22 ecore_main_loop_quit();
23}
24
25static unsigned char
26_parse_color(const Ecore_Getopt *parser EINA_UNUSED,
27 const Ecore_Getopt_Desc *desc EINA_UNUSED,
28 const char *str,
29 void *data EINA_UNUSED, Ecore_Getopt_Value *storage)
30{
31 unsigned char *color = (unsigned char *)storage->ptrp;
32
33 if (sscanf(str, "%hhu,%hhu,%hhu", color, color + 1, color + 2) != 3)
34 {
35 fprintf(stderr, "ERROR: incorrect color value '%s'\n", str);
36 return 0;
37 }
38
39 return 1;
40}
41
42const Ecore_Getopt optdesc = {
43 "ecore_evas_svg",
44 "%prog [options] <filename-source> [<filename-destination>]",
45 PACKAGE_VERSION,
46 "(C) 2014 Enlightenment",
47 "BSD with advertisement clause",
48 "Simple application to display or convert SVG in their vector form.",
49 0,
50 {
51 ECORE_GETOPT_STORE_INT('q', "quality", "define encoding quality in percent."),
52 ECORE_GETOPT_STORE_TRUE('c', "compress", "define if data should be compressed."),
53 ECORE_GETOPT_STORE_STR('c', "codec", "define the codec (for TGV files: etc1, etc2)"),
54 ECORE_GETOPT_CALLBACK_NOARGS('E', "list-engines", "list Ecore-Evas engines",
55 ecore_getopt_callback_ecore_evas_list_engines, NULL),
56 ECORE_GETOPT_STORE_STR('e', "engine", "The Ecore-Evas engine to use (see --list-engines)"),
57 ECORE_GETOPT_CALLBACK_ARGS('c', "bg-color",
58 "Color of the background (if not shaped or alpha)",
59 "RRGGBB", _parse_color, NULL),
60 ECORE_GETOPT_CALLBACK_ARGS('Z', "size", "size to use in wxh form.", "WxH",
61 ecore_getopt_callback_size_parse, NULL),
62 ECORE_GETOPT_STORE_TRUE('a', "alpha", "Display window with alpha channel "
63 " (needs composite manager!)"),
64 ECORE_GETOPT_STORE_STR('t', "title", "Define the window title string"),
65 ECORE_GETOPT_LICENSE('L', "license"),
66 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
67 ECORE_GETOPT_VERSION('V', "version"),
68 ECORE_GETOPT_HELP('h', "help"),
69 ECORE_GETOPT_SENTINEL
70 }
71};
72
73int
74main(int argc, char *argv[])
75{
76 Ecore_Evas *ee;
77 Evas *e;
78 Evas_Object *im = NULL;
79 Evas_Object *vg;
80 Evas_Object *r;
81 char *encoding = NULL;
82 char *engine = NULL;
83 char *title = NULL;
84 Eina_Rectangle size = { 0, 0, 800, 600 };
85 unsigned char color[3] = { 0, 0, 0 };
86
87 int arg_index;
88 int quality = -1;
89
90 Eina_Bool compress = 1;
91 Eina_Bool quit_option = EINA_FALSE;
92 Eina_Bool display = EINA_FALSE;
93 Eina_Bool alpha = EINA_FALSE;
94
95 Ecore_Getopt_Value values[] = {
96 ECORE_GETOPT_VALUE_INT(quality),
97 ECORE_GETOPT_VALUE_BOOL(compress),
98 ECORE_GETOPT_VALUE_STR(encoding),
99 ECORE_GETOPT_VALUE_BOOL(quit_option),
100 ECORE_GETOPT_VALUE_STR(engine),
101 ECORE_GETOPT_VALUE_PTR_CAST(color),
102 ECORE_GETOPT_VALUE_PTR_CAST(size),
103 ECORE_GETOPT_VALUE_BOOL(alpha),
104 ECORE_GETOPT_VALUE_STR(title),
105 ECORE_GETOPT_VALUE_BOOL(quit_option),
106 ECORE_GETOPT_VALUE_BOOL(quit_option),
107 ECORE_GETOPT_VALUE_BOOL(quit_option),
108 ECORE_GETOPT_VALUE_BOOL(quit_option),
109 ECORE_GETOPT_VALUE_NONE
110 };
111
112 eina_init();
113 _log_dom = eina_log_domain_register(argv[0], EINA_COLOR_CYAN);
114
115 ecore_init();
116 ecore_evas_init();
117
118 arg_index = ecore_getopt_parse(&optdesc, values, argc, argv);
119 if (quit_option) goto end;
120
121 if (arg_index < 0)
122 {
123 EINA_LOG_ERR("Could not parse argument.");
124 goto end;
125 }
126 if (arg_index + 1 == argc)
127 {
128 display = EINA_TRUE;
129 }
130 else if (arg_index + 2 != argc)
131 {
132 EINA_LOG_ERR("File not correctly specified.");
133 goto end;
134 }
135
136 if (!display)
137 {
138 Ecore_Evas *sub_ee;
139
140 ee = ecore_evas_buffer_new(1, 1);
141 im = ecore_evas_object_image_new(ee);
142 sub_ee = ecore_evas_object_ecore_evas_get(im);
143 ecore_evas_resize(sub_ee, size.w, size.h);
144
145 e = ecore_evas_object_evas_get(im);
146 }
147 else
148 {
149 ee = ecore_evas_new(engine, 0, 0, size.w, size.h, NULL);
150
151 e = ecore_evas_get(ee);
152 }
153
154 ecore_evas_alpha_set(ee, alpha);
155 ecore_evas_callback_delete_request_set(ee, _cb_delete);
156 ecore_evas_title_set(ee, title ? title : "Ecore Evas SVG");
157
158
159 r = eo_add(EVAS_RECTANGLE_CLASS, e,
160 efl_gfx_color_set(color[0], color[1], color[2], alpha ? 0 : 255),
161 efl_gfx_visible_set(EINA_TRUE));
162 ecore_evas_object_associate(ee, r, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
163
164 vg = eo_add(EVAS_VG_CLASS, e,
165 efl_file_set(argv[arg_index], NULL),
166 efl_gfx_visible_set(EINA_TRUE));
167 ecore_evas_object_associate(ee, vg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
168
169 if (display)
170 {
171 ecore_evas_show(ee);
172
173 ecore_main_loop_begin();
174 }
175 else
176 {
177 Eina_Strbuf *flags = NULL;
178
179 flags = eina_strbuf_new();
180 eina_strbuf_append_printf(flags, "compress=%d", compress);
181 if (quality >= 0)
182 eina_strbuf_append_printf(flags, " quality=%d", quality);
183 if (encoding)
184 eina_strbuf_append_printf(flags, " encoding=%s", encoding);
185
186 evas_object_image_save(im, argv[arg_index + 1],
187 NULL, eina_strbuf_string_get(flags));
188 eina_strbuf_free(flags);
189 }
190
191 ecore_evas_free(ee);
192 end:
193 ecore_evas_shutdown();
194 ecore_shutdown();
195 eina_shutdown();
196
197 return 0;
198}