1 /* === S I N F G =========================================================== */
5 ** $Id: importer.h,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SINFG_IMPORTER_H
25 #define __SINFG_IMPORTER_H
27 /* === H E A D E R S ======================================================= */
33 //#include "surface.h"
34 //#include "general.h"
39 /* === M A C R O S ========================================================= */
42 #define SINFG_IMPORTER_MODULE_EXT public: static const char name__[], version__[], ext__[],cvs_id__[]; static Importer *create(const char *filename);
44 //! Sets the name of the importer
45 #define SINFG_IMPORTER_SET_NAME(class,x) const char class::name__[]=x
48 #define SINFG_IMPORTER_SET_EXT(class,x) const char class::ext__[]=x
50 //! Sets the version of the importer
51 #define SINFG_IMPORTER_SET_VERSION(class,x) const char class::version__[]=x
53 //! Sets the CVS ID of the importer
54 #define SINFG_IMPORTER_SET_CVS_ID(class,x) const char class::cvs_id__[]=x
57 #define SINFG_IMPORTER_INIT(class) sinfg::Importer* class::create(const char *filename) { return new class(filename); }
59 /* === T Y P E D E F S ===================================================== */
61 /* === C L A S S E S & S T R U C T S ======================================= */
66 class ProgressCallback;
69 ** \brief Used for importing bitmaps of various formats, including animations
70 ** \todo Write more detailed description
72 class Importer : public etl::shared_object
75 typedef Importer* (*Factory)(const char *filename);
76 typedef std::map<String,Factory> Book;
81 static bool subsys_init();
82 static bool subsys_stop();
84 typedef etl::handle<Importer> Handle;
85 typedef etl::loose_handle<Importer> LooseHandle;
86 typedef etl::handle<const Importer> ConstHandle;
96 Gamma& gamma() { return gamma_; }
97 const Gamma& gamma()const { return gamma_; }
101 //! Gets a frame and puts it into \a surface
102 /*! \param surface Reference to surface to put frame into
103 ** \param time For animated importers, determines which frame to get.
104 ** For static importers, this parameter is unused.
105 ** \param callback Pointer to callback class for progress, errors, etc.
106 ** \return \c true on success, \c false on error
107 ** \see ProgressCallback, Surface
109 virtual bool get_frame(Surface &surface,Time time, ProgressCallback *callback=NULL)=0;
111 //! Returns \c true if the importer pays attention to the \a time parameter of get_frame()
112 virtual bool is_animated() { return false; }
114 //! Attempts to open \a filename, and returns a handle to the associated Importer
115 static Handle open(const String &filename);
118 }; // END of namespace sinfg
120 /* === E N D =============================================================== */