2008-07-19 11:32:32 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2005-11-10 23:56:10 -08:00
|
|
|
#include "evas_options.h"
|
|
|
|
|
2013-06-20 03:53:29 -07:00
|
|
|
#include "evas_common_private.h"
|
2005-11-10 23:56:10 -08:00
|
|
|
#include "evas_private.h"
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2014-06-12 23:22:26 -07:00
|
|
|
evas_common_save_image_to_file(RGBA_Image *im, const char *file, const char *key,
|
|
|
|
int quality, int compress, const char *encoding)
|
2005-11-10 23:56:10 -08:00
|
|
|
{
|
2006-01-15 02:35:02 -08:00
|
|
|
Evas_Image_Save_Func *evas_image_save_func = NULL;
|
2005-11-10 23:56:10 -08:00
|
|
|
char *p;
|
2006-01-15 02:35:02 -08:00
|
|
|
char *saver = NULL;
|
2008-07-19 10:40:52 -07:00
|
|
|
|
2005-11-10 23:56:10 -08:00
|
|
|
p = strrchr(file, '.');
|
|
|
|
if (p)
|
|
|
|
{
|
2014-07-01 03:57:04 -07:00
|
|
|
p++;
|
2008-07-19 10:40:52 -07:00
|
|
|
|
2014-07-01 03:57:04 -07:00
|
|
|
if (!strcasecmp(p, "png"))
|
2006-01-15 02:35:02 -08:00
|
|
|
saver = "png";
|
2014-07-01 03:57:04 -07:00
|
|
|
if ((!strcasecmp(p, "jpg")) || (!strcasecmp(p, "jpeg")) ||
|
|
|
|
(!strcasecmp(p, "jfif")))
|
2006-01-15 02:35:02 -08:00
|
|
|
saver = "jpeg";
|
2014-07-01 03:57:04 -07:00
|
|
|
if ((!strcasecmp(p, "eet")) || (!strcasecmp(p, "edj")) ||
|
2006-01-15 02:35:02 -08:00
|
|
|
(!strcasecmp(p, "eap")))
|
|
|
|
saver = "eet";
|
2014-07-01 03:57:04 -07:00
|
|
|
if (!strcasecmp(p, "webp"))
|
2013-03-05 15:09:05 -08:00
|
|
|
saver = "webp";
|
2014-03-12 00:32:17 -07:00
|
|
|
if (!strcasecmp(p, "tgv"))
|
|
|
|
saver = "tgv";
|
2006-01-15 02:35:02 -08:00
|
|
|
}
|
2006-01-15 02:44:48 -08:00
|
|
|
|
2006-01-15 02:35:02 -08:00
|
|
|
if (saver)
|
|
|
|
{
|
|
|
|
Evas_Module *em;
|
2008-07-19 10:40:52 -07:00
|
|
|
|
2014-07-01 03:57:04 -07:00
|
|
|
em = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_SAVER, saver);
|
|
|
|
if (em)
|
|
|
|
{
|
|
|
|
evas_module_use(em);
|
|
|
|
if (evas_module_load(em))
|
|
|
|
{
|
|
|
|
evas_image_save_func = em->functions;
|
2014-06-12 23:22:26 -07:00
|
|
|
return evas_image_save_func->image_save(im, file, key, quality,
|
|
|
|
compress, encoding);
|
2014-07-01 03:57:04 -07:00
|
|
|
}
|
|
|
|
}
|
2005-11-10 23:56:10 -08:00
|
|
|
}
|
2006-01-06 15:13:16 -08:00
|
|
|
return 0;
|
2005-11-10 23:56:10 -08:00
|
|
|
}
|