struct _Evas_VG_Data
{
- void *engine_data;
- Evas_VG_Node *root;
+ void *engine_data;
+ Evas_VG_Node *root;
+
+ /* Opening an SVG file (could actually be inside an eet section */
+ Eina_File *f;
+ const char *key;
};
static void evas_object_vg_render(Evas_Object *eo_obj,
}
+static Eina_Bool
+_evas_vg_mmap_set(Eo *obj EINA_UNUSED, Evas_VG_Data *pd,
+ const Eina_File *f, const char *key EINA_UNUSED)
+// For now we don't handle eet section filled with SVG, that's for later
+{
+ Eina_File *tmp = f ? eina_file_dup(f) : NULL;
+
+ // Start parsing here.
+
+ // it succeeded.
+ if (pd->f) eina_file_close(pd->f);
+ pd->f = tmp;
+
+ return EINA_TRUE;
+}
+
+static void
+_evas_vg_mmap_get(Eo *obj EINA_UNUSED, Evas_VG_Data *pd,
+ const Eina_File **f, const char **key)
+{
+ if (f) *f = pd->f;
+ if (key) *key = pd->key;
+}
+
Eina_Bool
-_evas_vg_efl_file_file_set(Eo *obj, Evas_VG_Data *pd,
+_evas_vg_efl_file_file_set(Eo *obj, Evas_VG_Data *pd EINA_UNUSED,
const char *file, const char *key)
{
- // FIXME: just load SVG for now
- return EINA_FALSE;
+ Eina_File *f;
+ Eina_Bool r = EINA_FALSE;
+
+ f = eina_file_open(file, EINA_FALSE);
+ if (!f) return EINA_FALSE;
+
+ eo_do(obj, r = evas_obj_vg_mmap_set(f, key));
+
+ eina_file_close(f);
+ return r;
}
void
-_evas_vg_efl_file_file_get(Eo *obj, Evas_VG_Data *pd,
+_evas_vg_efl_file_file_get(Eo *obj, Evas_VG_Data *pd EINA_UNUSED,
const char **file, const char **key)
{
+ const Eina_File *f = NULL;
+
+ eo_do(obj, evas_obj_vg_mmap_get(&f, key));
+
+ if (file) *file = eina_file_filename_get(f);
}
void
uint h;
}
}
+ mmap {
+ set {
+ /*@
+ Set the source mmaped file from where an image object must fetch the real
+ image data (it must be an Eina_File).
+
+ If the file supports multiple data stored in it (as Eet files do),
+ you can specify the key to be used as the index of the image in
+ this file.
+
+ @since 1.14 */
+ return: bool;
+ }
+ get {
+ /*@
+ Get the source mmaped file from where an image object must fetch the real
+ image data (it must be an Eina_File).
+
+ If the file supports multiple data stored in it (as Eet files do),
+ you can get the key to be used as the index of the image in
+ this file.
+
+ @since 1.14 */
+ }
+ values {
+ const(Eina.File)* f; /*@ The mmaped file */
+ const(char)* key; /*@ The image key in @p file (if its an Eet one), or @c
+ NULL, otherwise. */
+ }
+ }
}
implements {
Eo.Base.constructor;