diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2014-06-13 15:22:26 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2014-06-13 16:05:48 +0900 |
commit | d0d9dbfdbad7f7c31518b38242188ec007cb3756 (patch) | |
tree | 6aa709d750ef04b7539a04a081c3926794ee157e /src/bin/ecore_evas/ecore_evas_convert.c | |
parent | c79a8b43b66916ea32dac06db4c17ef1048806a5 (diff) |
Evas: Add encoding parameter to the savers
ecore_evas_convert: Add -e/--encoding option
This uses directly the encoding parameter.
For now, used only by the TGV saver, but there is no other way
to specify between ETC1 and ETC2. And we don't have a mixed ETC1+2
mode (yet).
@feature
Diffstat (limited to '')
-rw-r--r-- | src/bin/ecore_evas/ecore_evas_convert.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/bin/ecore_evas/ecore_evas_convert.c b/src/bin/ecore_evas/ecore_evas_convert.c index 8ba05fac2f..8cf613e211 100644 --- a/src/bin/ecore_evas/ecore_evas_convert.c +++ b/src/bin/ecore_evas/ecore_evas_convert.c | |||
@@ -27,6 +27,7 @@ const Ecore_Getopt optdesc = { | |||
27 | { | 27 | { |
28 | ECORE_GETOPT_STORE_INT('q', "quality", "define encoding quality in percent."), | 28 | ECORE_GETOPT_STORE_INT('q', "quality", "define encoding quality in percent."), |
29 | ECORE_GETOPT_STORE_TRUE('c', "compress", "define if data should be compressed."), | 29 | ECORE_GETOPT_STORE_TRUE('c', "compress", "define if data should be compressed."), |
30 | ECORE_GETOPT_STORE_STR('e', "encoding", "define the codec (for TGV files: etc1, etc2)"), | ||
30 | ECORE_GETOPT_LICENSE('L', "license"), | 31 | ECORE_GETOPT_LICENSE('L', "license"), |
31 | ECORE_GETOPT_COPYRIGHT('C', "copyright"), | 32 | ECORE_GETOPT_COPYRIGHT('C', "copyright"), |
32 | ECORE_GETOPT_VERSION('V', "version"), | 33 | ECORE_GETOPT_VERSION('V', "version"), |
@@ -38,19 +39,21 @@ const Ecore_Getopt optdesc = { | |||
38 | int | 39 | int |
39 | main(int argc, char *argv[]) | 40 | main(int argc, char *argv[]) |
40 | { | 41 | { |
41 | char flags[128]; | ||
42 | Ecore_Evas *ee; | 42 | Ecore_Evas *ee; |
43 | Evas *e; | 43 | Evas *e; |
44 | Evas_Object *im; | 44 | Evas_Object *im; |
45 | int arg_index; | 45 | int arg_index; |
46 | int quality = -1; | 46 | int quality = -1; |
47 | int r = -1; | 47 | int r = -1; |
48 | char *encoding = NULL; | ||
48 | Eina_Bool compress = 1; | 49 | Eina_Bool compress = 1; |
49 | Eina_Bool quit_option = EINA_FALSE; | 50 | Eina_Bool quit_option = EINA_FALSE; |
51 | Eina_Strbuf *flags = NULL; | ||
50 | 52 | ||
51 | Ecore_Getopt_Value values[] = { | 53 | Ecore_Getopt_Value values[] = { |
52 | ECORE_GETOPT_VALUE_INT(quality), | 54 | ECORE_GETOPT_VALUE_INT(quality), |
53 | ECORE_GETOPT_VALUE_BOOL(compress), | 55 | ECORE_GETOPT_VALUE_BOOL(compress), |
56 | ECORE_GETOPT_VALUE_STR(encoding), | ||
54 | ECORE_GETOPT_VALUE_BOOL(quit_option), | 57 | ECORE_GETOPT_VALUE_BOOL(quit_option), |
55 | ECORE_GETOPT_VALUE_BOOL(quit_option), | 58 | ECORE_GETOPT_VALUE_BOOL(quit_option), |
56 | ECORE_GETOPT_VALUE_BOOL(quit_option), | 59 | ECORE_GETOPT_VALUE_BOOL(quit_option), |
@@ -86,10 +89,12 @@ main(int argc, char *argv[]) | |||
86 | goto end; | 89 | goto end; |
87 | } | 90 | } |
88 | 91 | ||
92 | flags = eina_strbuf_new(); | ||
93 | eina_strbuf_append_printf(flags, "compress=%d", compress); | ||
89 | if (quality >= 0) | 94 | if (quality >= 0) |
90 | snprintf(flags, sizeof (flags), "compress=%i quality=%i", compress, quality); | 95 | eina_strbuf_append_printf(flags, " quality=%d", quality); |
91 | else | 96 | if (encoding) |
92 | snprintf(flags, sizeof (flags), "compress=%i", compress); | 97 | eina_strbuf_append_printf(flags, " encoding=%s", encoding); |
93 | 98 | ||
94 | im = evas_object_image_add(e); | 99 | im = evas_object_image_add(e); |
95 | evas_object_image_file_set(im, argv[arg_index], NULL); | 100 | evas_object_image_file_set(im, argv[arg_index], NULL); |
@@ -102,7 +107,8 @@ main(int argc, char *argv[]) | |||
102 | goto end; | 107 | goto end; |
103 | } | 108 | } |
104 | 109 | ||
105 | if (!evas_object_image_save(im, argv[arg_index + 1], NULL, flags)) | 110 | if (!evas_object_image_save(im, argv[arg_index + 1], NULL, |
111 | eina_strbuf_string_get(flags))) | ||
106 | { | 112 | { |
107 | EINA_LOG_ERR("Could not convert file to '%s'.", argv[arg_index + 1]); | 113 | EINA_LOG_ERR("Could not convert file to '%s'.", argv[arg_index + 1]); |
108 | goto end; | 114 | goto end; |
@@ -111,6 +117,7 @@ main(int argc, char *argv[]) | |||
111 | r = 0; | 117 | r = 0; |
112 | 118 | ||
113 | end: | 119 | end: |
120 | if (flags) eina_strbuf_free(flags); | ||
114 | ecore_evas_shutdown(); | 121 | ecore_evas_shutdown(); |
115 | ecore_shutdown(); | 122 | ecore_shutdown(); |
116 | 123 | ||