summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitalii Vorobiov <vi.vorobiov@samsung.com>2017-01-27 13:54:47 +0200
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-07 11:54:09 +0900
commit7d9c1256a30bdbe3680c14da77d5fadf3382b6ef (patch)
treeaae39980a119e1f21d0210d5dbea9ab8206f623f
parent3f75c92ca9e559204c20228444810e8d482986d0 (diff)
vg_savers/svg: empty (for now) module that will save svg in original file
Just as a starter to make a working background that, later on, will go through Svg_Node's and build a certain source code to be saved in SVG picture as a file
-rw-r--r--src/Makefile_Evas.am25
-rw-r--r--src/lib/evas/file/evas_module.c4
-rw-r--r--src/lib/evas/vg/evas_vg_cache.c3
-rw-r--r--src/modules/evas/vg_savers/svg/evas_vg_save_svg.c72
4 files changed, 102 insertions, 2 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index d80e1c2015..e5c3dba46b 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -1607,7 +1607,7 @@ endif
1607 1607
1608if BUILD_VG_LOADER_SVG 1608if BUILD_VG_LOADER_SVG
1609if EVAS_STATIC_BUILD_VG_SVG 1609if EVAS_STATIC_BUILD_VG_SVG
1610lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/svg/evas_vg_load_svg.c \ 1610lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/svg/evas_vg_load_svg.c modules/evas/vg_savers/svg/evas_vg_save_svg.c \
1611static_libs/vg_common/vg_common.c \ 1611static_libs/vg_common/vg_common.c \
1612static_libs/vg_common/vg_common.h 1612static_libs/vg_common/vg_common.h
1613lib_evas_libevas_la_CPPFLAGS += -I$(top_srcdir)/src/static_libs/vg_common \ 1613lib_evas_libevas_la_CPPFLAGS += -I$(top_srcdir)/src/static_libs/vg_common \
@@ -1636,6 +1636,29 @@ modules_evas_vg_loaders_svg_module_la_LIBADD = \
1636modules_evas_vg_loaders_svg_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@ 1636modules_evas_vg_loaders_svg_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
1637modules_evas_vg_loaders_svg_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ 1637modules_evas_vg_loaders_svg_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
1638modules_evas_vg_loaders_svg_module_la_LIBTOOLFLAGS = --tag=disable-static 1638modules_evas_vg_loaders_svg_module_la_LIBTOOLFLAGS = --tag=disable-static
1639
1640vgsaversvgpkgdir = $(libdir)/evas/modules/vg_savers/svg/$(MODULE_ARCH)
1641vgsaversvgpkg_LTLIBRARIES = modules/evas/vg_savers/svg/module.la
1642
1643# Workaround for broken parallel install support in automake (relink issue)
1644# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328
1645install_vgsaversvgpkgLTLIBRARIES = install-vgloadersvgpkgLTLIBRARIES
1646$(install_vgsaversvgpkgLTLIBRARIES): install-libLTLIBRARIES
1647
1648modules_evas_vg_savers_svg_module_la_SOURCES = modules/evas/vg_savers/svg/evas_vg_save_svg.c \
1649static_libs/vg_common/vg_common.c \
1650static_libs/vg_common/vg_common.h
1651modules_evas_vg_savers_svg_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
1652-I$(top_srcdir)/src/lib/evas/include \
1653-I$(top_srcdir)/src/static_libs/vg_common \
1654@EVAS_CFLAGS@ \
1655@evas_vg_saver_svg_cflags@
1656modules_evas_vg_savers_svg_module_la_LIBADD = \
1657@USE_EVAS_LIBS@ \
1658@evas_vg_saver_svg_libs@
1659modules_evas_vg_savers_svg_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
1660modules_evas_vg_savers_svg_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
1661modules_evas_vg_savers_svg_module_la_LIBTOOLFLAGS = --tag=disable-static
1639endif 1662endif
1640endif 1663endif
1641 1664
diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c
index 151b5b9a13..bdcd5e8500 100644
--- a/src/lib/evas/file/evas_module.c
+++ b/src/lib/evas/file/evas_module.c
@@ -207,6 +207,7 @@ EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, tgv);
207 207
208#if !EVAS_MODULE_NO_VG_SAVERS 208#if !EVAS_MODULE_NO_VG_SAVERS
209EVAS_EINA_STATIC_MODULE_DEFINE(vg_saver, eet); 209EVAS_EINA_STATIC_MODULE_DEFINE(vg_saver, eet);
210EVAS_EINA_STATIC_MODULE_DEFINE(vg_saver, svg);
210#endif 211#endif
211 212
212#if !EVAS_MODULE_NO_IMAGE_SAVERS 213#if !EVAS_MODULE_NO_IMAGE_SAVERS
@@ -319,6 +320,9 @@ static const struct {
319#ifdef EVAS_STATIC_BUILD_VG_EET 320#ifdef EVAS_STATIC_BUILD_VG_EET
320 EVAS_EINA_STATIC_MODULE_USE(vg_saver, eet), 321 EVAS_EINA_STATIC_MODULE_USE(vg_saver, eet),
321#endif 322#endif
323#ifdef EVAS_STATIC_BUILD_VG_SVG
324 EVAS_EINA_STATIC_MODULE_USE(vg_saver, svg),
325#endif
322#endif 326#endif
323#if !EVAS_MODULE_NO_IMAGE_SAVERS 327#if !EVAS_MODULE_NO_IMAGE_SAVERS
324#ifdef EVAS_STATIC_BUILD_EET 328#ifdef EVAS_STATIC_BUILD_EET
diff --git a/src/lib/evas/vg/evas_vg_cache.c b/src/lib/evas/vg/evas_vg_cache.c
index 57f3cefc56..f3e8f77289 100644
--- a/src/lib/evas/vg/evas_vg_cache.c
+++ b/src/lib/evas/vg/evas_vg_cache.c
@@ -102,7 +102,8 @@ struct ext_saver_s
102static const struct ext_saver_s savers[] = 102static const struct ext_saver_s savers[] =
103{ /* map extensions to savers to use for good first-guess tries */ 103{ /* map extensions to savers to use for good first-guess tries */
104 MATCHING(".eet", "eet"), 104 MATCHING(".eet", "eet"),
105 MATCHING(".edj", "eet") 105 MATCHING(".edj", "eet"),
106 MATCHING(".svg", "svg")
106}; 107};
107 108
108static Evas_Module * 109static Evas_Module *
diff --git a/src/modules/evas/vg_savers/svg/evas_vg_save_svg.c b/src/modules/evas/vg_savers/svg/evas_vg_save_svg.c
new file mode 100644
index 0000000000..8c11fb3d69
--- /dev/null
+++ b/src/modules/evas/vg_savers/svg/evas_vg_save_svg.c
@@ -0,0 +1,72 @@
1#include "vg_common.h"
2
3static int _evas_vg_saver_svg_log_dom = -1;
4
5#ifdef ERR
6# undef ERR
7#endif
8#define ERR(...) EINA_LOG_DOM_ERR(_evas_vg_saver_eet_log_dom, __VA_ARGS__)
9
10#ifdef INF
11# undef INF
12#endif
13#define INF(...) EINA_LOG_DOM_INFO(_evas_vg_saver_eet_log_dom, __VA_ARGS__)
14
15int
16evas_vg_save_file_svg(Vg_File_Data *evg_data, const char *file, const char *key EINA_UNUSED, int compress EINA_UNUSED)
17{
18 Svg_Node *root EINA_UNUSED;
19 Eet_File *ef;
20
21 ef = eet_open(file, EET_FILE_MODE_WRITE);
22 if (!ef)
23 return EVAS_LOAD_ERROR_GENERIC;
24
25 root = vg_common_create_svg_node(evg_data);
26 //TODO: parse root into SVG source code and save into file as text file
27 eet_close(ef);
28
29 return EVAS_LOAD_ERROR_NONE;
30}
31
32static Evas_Vg_Save_Func evas_vg_save_svg_func =
33{
34 evas_vg_save_file_svg
35};
36
37static int
38module_open(Evas_Module *em)
39{
40 if (!em) return 0;
41 em->functions = (void *)(&evas_vg_save_svg_func);
42 _evas_vg_saver_svg_log_dom = eina_log_domain_register
43 ("vg-save-svg", EVAS_DEFAULT_LOG_COLOR);
44 if (_evas_vg_saver_svg_log_dom < 0)
45 {
46 EINA_LOG_ERR("Can not create a module log domain.");
47 return 0;
48 }
49 return 1;
50}
51
52static void
53module_close(Evas_Module *em EINA_UNUSED)
54{
55}
56
57static Evas_Module_Api evas_modapi =
58{
59 EVAS_MODULE_API_VERSION,
60 "svg",
61 "none",
62 {
63 module_open,
64 module_close
65 }
66};
67
68EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_VG_SAVER, vg_saver, svg);
69
70#ifndef EVAS_STATIC_BUILD_VG_SVG
71EVAS_EINA_MODULE_DEFINE(vg_saver, svg);
72#endif