Added some missing getters to ethumb API.

SVN revision: 40730
This commit is contained in:
Rafael Antognolli 2009-05-18 21:26:56 +00:00
parent 0c233cfcf3
commit dfb8599530
5 changed files with 61 additions and 8 deletions

View File

@ -427,6 +427,25 @@ ethumb_frame_set(Ethumb *e, const char *theme_file, const char *group, const cha
return 1;
}
EAPI void
ethumb_frame_get(const Ethumb *e, const char **theme_file, const char **group, const char **swallow)
{
EINA_SAFETY_ON_NULL_RETURN(e);
if (e->frame)
{
if (theme_file) *theme_file = e->frame->file;
if (group) *group = e->frame->group;
if (swallow) *swallow = e->frame->swallow;
}
else
{
if (theme_file) *theme_file = NULL;
if (group) *group = NULL;
if (swallow) *swallow = NULL;
}
}
EAPI void
ethumb_thumb_dir_path_set(Ethumb *e, const char *path)
{
@ -467,6 +486,14 @@ ethumb_video_time_set(Ethumb *e, float time)
e->video.time = time;
}
EAPI float
ethumb_video_time_get(const Ethumb *e)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0);
return e->video.time;
}
EAPI void
ethumb_document_page_set(Ethumb *e, int page)
{
@ -475,6 +502,14 @@ ethumb_document_page_set(Ethumb *e, int page)
e->document.page = page;
}
EAPI int
ethumb_document_page_get(const Ethumb *e)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0);
return e->document.page;
}
EAPI int
ethumb_file_set(Ethumb *e, const char *path, const char *key)
{
@ -955,3 +990,11 @@ ethumb_exists(Ethumb *e)
return r;
}
Evas *
ethumb_evas_get(Ethumb *e)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL);
return e->sub_e;
}

View File

@ -89,6 +89,7 @@ EAPI void ethumb_thumb_crop_align_set(Ethumb *e, float x, float y) EINA_ARG_NONN
EAPI void ethumb_thumb_crop_align_get(Ethumb *e, float *x, float *y) EINA_ARG_NONNULL(1);
EAPI int ethumb_frame_set(Ethumb *e, const char *theme_file, const char *group, const char *swallow) EINA_ARG_NONNULL(1);
EAPI void ethumb_frame_get(const Ethumb *e, const char **theme_file, const char **group, const char **swallow) EINA_ARG_NONNULL(1);
EAPI void ethumb_thumb_dir_path_set(Ethumb *e, const char *path) EINA_ARG_NONNULL(1);
EAPI const char * ethumb_thumb_dir_path_get(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
@ -97,7 +98,10 @@ EAPI void ethumb_thumb_category_set(Ethumb *e, const char *category) EINA_ARG_NO
EAPI const char * ethumb_thumb_category_get(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
EAPI void ethumb_video_time_set(Ethumb *e, float time) EINA_ARG_NONNULL(1);
EAPI float ethumb_video_time_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
EAPI void ethumb_document_page_set(Ethumb *e, int page) EINA_ARG_NONNULL(1);
EAPI int ethumb_document_page_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
EAPI int ethumb_file_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1, 2);
EAPI void ethumb_file_get(Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1);

View File

@ -18,5 +18,6 @@ void ethumb_calculate_fill(Ethumb *e, int iw, int ih, int *fx, int *fy, int *fw,
int ethumb_plugin_image_resize(Ethumb *e, int w, int h);
int ethumb_image_save(Ethumb *e);
void ethumb_finished_callback_call(Ethumb *e);
Evas * ethumb_evas_get(Ethumb *e);
#endif /* _ETHUMB_PLUGIN_H_ */

View File

@ -1,5 +1,4 @@
#include "Ethumb.h"
#include "ethumb_private.h"
#include "Ethumb_Plugin.h"
#include "config.h"
@ -38,8 +37,10 @@ _generate_thumb(Ethumb *e)
{
Evas_Object *o;
int r;
const char *file;
float time;
o = emotion_object_add(e->sub_e);
o = emotion_object_add(ethumb_evas_get(e));
r = emotion_object_init(o, "xine");
if (!r)
{
@ -49,8 +50,11 @@ _generate_thumb(Ethumb *e)
return r;
}
emotion_object_file_set(o, e->src_path);
emotion_object_position_set(o, e->video.time);
ethumb_file_get(e, &file, NULL);
time = ethumb_video_time_get(e);
emotion_object_file_set(o, file);
emotion_object_position_set(o, time);
emotion_object_play_set(o, 1);
evas_object_smart_callback_add(o, "frame_resize", _frame_resized_cb, e);

View File

@ -1,5 +1,4 @@
#include "Ethumb.h"
#include "ethumb_private.h"
#include "Ethumb_Plugin.h"
#include "config.h"
@ -18,6 +17,7 @@ _generate_thumb(Ethumb *e)
int w, h, ww, hh;
int fx, fy, fw, fh;
int npages;
int pagenum;
document = epdf_document_new(e->src_path);
if (!document)
@ -35,13 +35,14 @@ _generate_thumb(Ethumb *e)
}
npages = epdf_document_page_count_get(document);
if (e->document.page < npages)
epdf_page_page_set(page, e->document.page);
pagenum = ethumb_document_page_get(e);
if (pagenum < npages)
epdf_page_page_set(page, pagenum);
epdf_page_size_get(page, &w, &h);
ethumb_calculate_aspect(e, w, h, &ww, &hh);
ethumb_plugin_image_resize(e, ww, hh);
o = evas_object_image_add(e->sub_e);
o = evas_object_image_add(ethumb_evas_get(e));
epdf_page_render(page, o);
evas_object_resize(o, ww, hh);
evas_object_move(o, 0, 0);