}
surface.clear();
- if(!newimporter->get_frame(surface,Time(0),trimmed,width,height,top,left))
+ if(!newimporter->get_frame(surface,get_canvas()->rend_desc(),Time(0),trimmed,width,height,top,left))
{
synfig::warning(strprintf("Unable to get frame from \"%s\"",filename_with_path.c_str()));
}
{
if(get_amount() && importer &&
importer->is_animated())
- importer->get_frame(surface,time+time_offset,trimmed,width,height,top,left);
+ importer->get_frame(surface,get_canvas()->rend_desc(),time+time_offset,trimmed,width,height,top,left);
context.set_time(time);
}
{
if(get_amount() && importer &&
importer->is_animated())
- importer->get_frame(surface,time+time_offset,trimmed,width,height,top,left);
+ importer->get_frame(surface,get_canvas()->rend_desc(),time+time_offset,trimmed,width,height,top,left);
context.set_time(time,pos);
}
}
bool
-bmp_mptr::get_frame(synfig::Surface &surface,Time /*time*/, synfig::ProgressCallback *cb)
+bmp_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time /*time*/, synfig::ProgressCallback *cb)
{
FILE *file=fopen(filename.c_str(),"rb");
if(!file)
bmp_mptr(const char *filename);
~bmp_mptr();
- virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback);
+ virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback);
};
/* === E N D =============================================================== */
}
bool
-ffmpeg_mptr::get_frame(synfig::Surface &surface,Time time, synfig::ProgressCallback *)
+ffmpeg_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time time, synfig::ProgressCallback *)
{
int i=(int)(time*fps);
if(i!=cur_frame)
virtual bool is_animated();
- virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback);
+ virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback);
};
/* === E N D =============================================================== */
}
bool
-imagemagick_mptr::get_frame(synfig::Surface &surface,Time /*time*/, synfig::ProgressCallback *cb)
+imagemagick_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time /*time*/, synfig::ProgressCallback *cb)
{
//#define HAS_LIBPNG 1
return false;
}
- if(!importer->get_frame(surface,0,cb))
+ if(!importer->get_frame(surface,renddesc,0,cb))
{
if(cb)cb->error(_("Unable to get frame from ")+temp_file);
else synfig::error(_("Unable to get frame from ")+temp_file);
~imagemagick_mptr();
- virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback);
+ virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback);
};
/* === E N D =============================================================== */
}
bool
-jpeg_mptr::get_frame(synfig::Surface &surface,Time, synfig::ProgressCallback */*cb*/)
+jpeg_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time, synfig::ProgressCallback */*cb*/)
{
surface=surface_buffer;
return true;
jpeg_mptr(const char *filename);
~jpeg_mptr();
- virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback);
+ virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback);
};
/* === E N D =============================================================== */
}
bool
-Importer_LibAVCodec::get_frame(synfig::Surface &/*surface*/,Time, synfig::ProgressCallback */*cb*/)
+Importer_LibAVCodec::get_frame(synfig::Surface &/*surface*/, const synfig::RendDesc &renddesc, Time, synfig::ProgressCallback */*cb*/)
{
return false;
}
Importer_LibAVCodec(const char *filename);
~Importer_LibAVCodec();
- virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback);
+ virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback);
};
/* === E N D =============================================================== */
}
bool
-exr_mptr::get_frame(synfig::Surface &out_surface,Time, synfig::ProgressCallback *cb)
+exr_mptr::get_frame(synfig::Surface &out_surface, const synfig::RendDesc &renddesc, Time, synfig::ProgressCallback *cb)
{
try
{
- virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback);
+ virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback);
};
}
bool
-png_mptr::get_frame(synfig::Surface &surface,Time, synfig::ProgressCallback */*cb*/)
+png_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time, synfig::ProgressCallback */*cb*/)
{
//assert(0); // shouldn't be called?
surface=surface_buffer;
}
bool
-png_mptr::get_frame(synfig::Surface &surface,Time,
+png_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time,
bool &trimmed, unsigned int &width, unsigned int &height, unsigned int &top, unsigned int &left,
synfig::ProgressCallback */*cb*/)
{
png_mptr(const char *filename);
~png_mptr();
- virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback);
- virtual bool get_frame(synfig::Surface &surface,synfig::Time time,
+ virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback);
+ virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time,
bool &trimmed, unsigned int &width, unsigned int &height, unsigned int &top, unsigned int &left,
synfig::ProgressCallback *callback);
};
}
bool
-ppm_mptr::get_frame(synfig::Surface &surface,Time, synfig::ProgressCallback *cb)
+ppm_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time, synfig::ProgressCallback *cb)
{
SmartFILE file(fopen(filename.c_str(),"rb"));
if(!file)
ppm_mptr(const char *filename);
~ppm_mptr();
- virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback);
+ virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback);
}; // END of class ppm_mptr
/* === E N D =============================================================== */
#include "string.h"
#include "time.h"
#include "gamma.h"
+#include "renddesc.h"
/* === M A C R O S ========================================================= */
** \return \c true on success, \c false on error
** \see ProgressCallback, Surface
*/
- virtual bool get_frame(Surface &surface,Time time, ProgressCallback *callback=NULL)=0;
- virtual bool get_frame(Surface &surface,Time time,
+ virtual bool get_frame(Surface &surface, const RendDesc &renddesc, Time time, ProgressCallback *callback=NULL)=0;
+ virtual bool get_frame(Surface &surface, const RendDesc &renddesc,Time time,
bool &trimmed __attribute__ ((unused)),
unsigned int &width __attribute__ ((unused)),
unsigned int &height __attribute__ ((unused)),
unsigned int &left __attribute__ ((unused)),
ProgressCallback *callback=NULL)
{
- return get_frame(surface,time,callback);
+ return get_frame(surface,renddesc,time,callback);
}
//! Returns \c true if the importer pays attention to the \a time parameter of get_frame()
}
bool
-ListImporter::get_frame(Surface &surface,Time time, ProgressCallback *cb)
+ListImporter::get_frame(Surface &surface, const RendDesc &renddesc, Time time, ProgressCallback *cb)
{
- int frame=round_to_int(time*fps);
+ float document_fps=renddesc.get_frame_rate();
+ int document_frame=round_to_int(time*document_fps);
+ int frame=floor_to_int(document_frame*fps/document_fps);
if(!filename_list.size())
{
return false;
}
- if(!importer->get_frame(surface,0,cb))
+ if(!importer->get_frame(surface,renddesc,0,cb))
{
if(cb)cb->error(_("Unable to get frame from ")+filename_list[frame]);
else synfig::error(_("Unable to get frame from ")+filename_list[frame]);
virtual ~ListImporter();
- virtual bool get_frame(Surface &surface,Time time, ProgressCallback *callback=NULL);
+ virtual bool get_frame(Surface &surface, const RendDesc &renddesc, Time time, ProgressCallback *callback=NULL);
virtual bool is_animated();