Revision: 4438 http://pd-gem.svn.sourceforge.net/pd-gem/?rev=4438&view=rev Author: zmoelnig Date: 2011-08-08 14:29:40 +0000 (Mon, 08 Aug 2011)
Log Message: ----------- split imageloader/imagesaver into interface/baseclass Modified Paths: -------------- trunk/Gem/src/plugins/imageloader.cpp trunk/Gem/src/plugins/imageloader.h trunk/Gem/src/plugins/imagesaver.cpp trunk/Gem/src/plugins/imagesaver.h Added Paths: ----------- trunk/Gem/src/plugins/imageBase.cpp trunk/Gem/src/plugins/imageBase.h trunk/Gem/src/plugins/imageloaderBase.cpp trunk/Gem/src/plugins/imageloaderBase.h trunk/Gem/src/plugins/imagesaverBase.cpp trunk/Gem/src/plugins/imagesaverBase.h Removed Paths: ------------- trunk/Gem/src/plugins/image.cpp trunk/Gem/src/plugins/image.h Deleted: trunk/Gem/src/plugins/image.cpp =================================================================== --- trunk/Gem/src/plugins/image.cpp 2011-08-08 14:28:35 UTC (rev 4437) +++ trunk/Gem/src/plugins/image.cpp 2011-08-08 14:29:40 UTC (rev 4438) @@ -1,83 +0,0 @@ -//////////////////////////////////////////////////////// -// -// GEM - Graphics Environment for Multimedia -// -// zmoel...@iem.kug.ac.at -// -// Implementation file -// -// Copyright (c) 2011 IOhannes m zmoelnig. forum::für::umläute. IEM -// For information on usage and redistribution, and for a DISCLAIMER OF ALL -// WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. -// -///////////////////////////////////////////////////////// - -#include "plugins/image.h" - -using namespace gem::plugins; - -///////////////////////////////////////////////////////// -// -// image -// -///////////////////////////////////////////////////////// -// Constructor -// -///////////////////////////////////////////////////////// -image :: image(bool threadable) - : imageloader(threadable), imagesaver(threadable) { -} - -///////////////////////////////////////////////////////// -// Destructor -// -///////////////////////////////////////////////////////// -image :: ~image() -{ -} - -bool image :: enumProperties(gem::Properties&readable, - gem::Properties&writeable) -{ - readable.clear(); - writeable.clear(); - return false; -} - -void image :: setProperties(gem::Properties&props) { - // nada - m_properties=props; -#if 0 - std::vector<std::string> keys=props.keys(); - int i=0; - for(i=0; i<keys.size(); i++) { - enum gem::Properties::PropertyType typ=props.type(keys[i]); - std::cerr << "key["<<keys[i]<<"]: "<<typ<<" :: "; - switch(typ) { - case (gem::Properties::NONE): - props.erase(keys[i]); - break; - case (gem::Properties::DOUBLE): - std::cerr << gem::any_cast<double>(props.get(keys[i])); - break; - case (gem::Properties::STRING): - std::cerr << "'" << gem::any_cast<std::string>(props.get(keys[i])) << "'"; - break; - default: - std::cerr << "<unkown:" << props.get(keys[i]).get_type().name() << ">"; - break; - } - } - std::cerr << std::endl; -#endif -} - -void image :: getProperties(gem::Properties&props) { - // nada - std::vector<std::string>keys=props.keys(); - unsigned int i=0; - for(i=0; i<keys.size(); i++) { - gem::any unset; - props.set(keys[i], unset); - } -} Deleted: trunk/Gem/src/plugins/image.h =================================================================== --- trunk/Gem/src/plugins/image.h 2011-08-08 14:28:35 UTC (rev 4437) +++ trunk/Gem/src/plugins/image.h 2011-08-08 14:29:40 UTC (rev 4438) @@ -1,93 +0,0 @@ -/* ----------------------------------------------------------------- - -GEM - Graphics Environment for Multimedia - -Load an image and return the frame(OS independant parent-class) - -Copyright (c) 2011 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoel...@iem.kug.ac.at -For information on usage and redistribution, and for a DISCLAIMER OF ALL -WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. - ------------------------------------------------------------------*/ - -#ifndef INCLUDE_IMAGE_H_ -#define INCLUDE_IMAGE_H_ - -#include "plugins/imageloader.h" -#include "plugins/imagesaver.h" - - /*----------------------------------------------------------------- - ------------------------------------------------------------------- - CLASS - image - - parent class for the system- and library-dependent image-loader classes - this class should only be used for plugin implementations - the plugin-host should use the imageloader/imagesaver classes resp. - - KEYWORDS - pix load an image - - DESCRIPTION - - -----------------------------------------------------------------*/ -namespace gem { namespace plugins { -class GEM_EXTERN image : public imageloader, public imagesaver - { - public: - - ////////// - // Constructor - - /* initialize the image class (set 'threadable' to FALSE if this object must - * NOT be used within a threaded context - */ - image(bool threadable=true); - - //////// - // Destructor - /* free what is apropriate */ - virtual ~image(void); - - /** - * list all properties this backend supports - * after calling, "readable" will hold a list of all properties that can be read - * and "writeable" will hold a list of all properties that can be set - * if the enumeration fails, this returns <code>false</code> - */ - virtual bool enumProperties(gem::Properties&readable, - gem::Properties&writeable); - - /** - * set a number of properties (as defined by "props") - * the "props" may hold properties not supported by the currently opened device, - * which is legal; in this case the superfluous properties are simply ignored - * this function MAY modify the props; - */ - virtual void setProperties(gem::Properties&props); - - /** - * get the current value of the given properties from the device - * if props holds properties that can not be read from the device, they are set to UNSET - */ - virtual void getProperties(gem::Properties&props); - - protected: - /* used to store the "set" properties */ - gem::Properties m_properties; - }; - -};}; // namespace gem - - -/** - * \fn REGISTER_IMAGEFACTORY(const char *id, Class imageClass) - * registers a new class "imageClass" with the image-factory - * - * \param id a symbolic (const char*) ID for the given class - * \param imageClass a class derived from "image" - */ -#define REGISTER_IMAGEFACTORY(id, TYP) REGISTER_IMAGELOADERFACTORY(id, TYP); REGISTER_IMAGESAVERFACTORY(id, TYP) - - -#endif // for header file Copied: trunk/Gem/src/plugins/imageBase.cpp (from rev 4437, trunk/Gem/src/plugins/image.cpp) =================================================================== --- trunk/Gem/src/plugins/imageBase.cpp (rev 0) +++ trunk/Gem/src/plugins/imageBase.cpp 2011-08-08 14:29:40 UTC (rev 4438) @@ -0,0 +1,95 @@ +//////////////////////////////////////////////////////// +// +// GEM - Graphics Environment for Multimedia +// +// zmoel...@iem.kug.ac.at +// +// Implementation file +// +// Copyright (c) 2011 IOhannes m zmoelnig. forum::für::umläute. IEM +// For information on usage and redistribution, and for a DISCLAIMER OF ALL +// WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. +// +///////////////////////////////////////////////////////// + +#include "plugins/imageBase.h" + +using namespace gem::plugins; + +///////////////////////////////////////////////////////// +// +// imageBase +// +///////////////////////////////////////////////////////// +// Constructor +// +///////////////////////////////////////////////////////// +imageBase :: imageBase(bool threadable) + : m_threadable(threadable) +{} + +///////////////////////////////////////////////////////// +// Destructor +// +///////////////////////////////////////////////////////// +imageBase :: ~imageBase() +{} + +bool imageBase :: enumProperties(gem::Properties&readable, + gem::Properties&writeable) +{ + readable.clear(); + writeable.clear(); + return false; +} + +void imageBase :: setProperties(gem::Properties&props) { + // nada + m_properties=props; +#if 0 + std::vector<std::string> keys=props.keys(); + int i=0; + for(i=0; i<keys.size(); i++) { + enum gem::Properties::PropertyType typ=props.type(keys[i]); + std::cerr << "key["<<keys[i]<<"]: "<<typ<<" :: "; + switch(typ) { + case (gem::Properties::NONE): + props.erase(keys[i]); + break; + case (gem::Properties::DOUBLE): + std::cerr << gem::any_cast<double>(props.get(keys[i])); + break; + case (gem::Properties::STRING): + std::cerr << "'" << gem::any_cast<std::string>(props.get(keys[i])) << "'"; + break; + default: + std::cerr << "<unkown:" << props.get(keys[i]).get_type().name() << ">"; + break; + } + } + std::cerr << std::endl; +#endif +} + +void imageBase :: getProperties(gem::Properties&props) { + // nada + std::vector<std::string>keys=props.keys(); + unsigned int i=0; + for(i=0; i<keys.size(); i++) { + gem::any unset; + props.set(keys[i], unset); + } +} + + +bool imageBase :: isThreadable(void) { + return m_threadable; +} +float imageBase::estimateSave( const imageStruct&img, const std::string&filename, const std::string&mimetype, const gem::Properties&props) { + return 0.; +} +void imageBase::getWriteCapabilities(std::vector<std::string>&mimetypes, gem::Properties&props) { + mimetypes.clear(); + props.clear(); +} + Copied: trunk/Gem/src/plugins/imageBase.h (from rev 4437, trunk/Gem/src/plugins/image.h) =================================================================== --- trunk/Gem/src/plugins/imageBase.h (rev 0) +++ trunk/Gem/src/plugins/imageBase.h 2011-08-08 14:29:40 UTC (rev 4438) @@ -0,0 +1,104 @@ +/* ----------------------------------------------------------------- + +GEM - Graphics Environment for Multimedia + +Load an image and return the frame(OS independant parent-class) + +Copyright (c) 2011 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoel...@iem.kug.ac.at +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + +-----------------------------------------------------------------*/ + +#ifndef INCLUDE_IMAGEBASE_H_ +#define INCLUDE_IMAGEBASE_H_ + +#include "plugins/imageloader.h" +#include "plugins/imagesaver.h" + + /*----------------------------------------------------------------- + ------------------------------------------------------------------- + CLASS + imageBase + + parent class for the system- and library-dependent imageBase-loader classes + this class should only be used for plugin implementations + the plugin-host should use the imageBaseloader/imageBasesaver classes resp. + + KEYWORDS + pix load an image + + DESCRIPTION + + -----------------------------------------------------------------*/ +namespace gem { namespace plugins { +class GEM_EXTERN imageBase : public imageloader, public imagesaver + { + public: + + ////////// + // Constructor + + /* initialize the image class (set 'threadable' to FALSE if this object must + * NOT be used within a threaded context + */ + imageBase(bool threadable=true); + + //////// + // Destructor + /* free what is apropriate */ + virtual ~imageBase(void); + + + virtual bool isThreadable(void); + virtual void getWriteCapabilities(std::vector<std::string>&mimetypes, gem::Properties&props); + + virtual float estimateSave( const imageStruct&img, + const std::string&filename, + const std::string&mimetype, + const gem::Properties&props); + + /** + * list all properties this backend supports + * after calling, "readable" will hold a list of all properties that can be read + * and "writeable" will hold a list of all properties that can be set + * if the enumeration fails, this returns <code>false</code> + */ + virtual bool enumProperties(gem::Properties&readable, + gem::Properties&writeable); + + /** + * set a number of properties (as defined by "props") + * the "props" may hold properties not supported by the currently opened device, + * which is legal; in this case the superfluous properties are simply ignored + * this function MAY modify the props; + */ + virtual void setProperties(gem::Properties&props); + + /** + * get the current value of the given properties from the device + * if props holds properties that can not be read from the device, they are set to UNSET + */ + virtual void getProperties(gem::Properties&props); + + protected: + /* used to store the "set" properties */ + gem::Properties m_properties; + private: + bool m_threadable; + }; + +};}; // namespace gem + + +/** + * \fn REGISTER_IMAGEFACTORY(const char *id, Class imageClass) + * registers a new class "imageClass" with the image-factory + * + * \param id a symbolic (const char*) ID for the given class + * \param imageClass a class derived from "image" + */ +#define REGISTER_IMAGEFACTORY(id, TYP) REGISTER_IMAGELOADERFACTORY(id, TYP); REGISTER_IMAGESAVERFACTORY(id, TYP) + + +#endif // for header file Modified: trunk/Gem/src/plugins/imageloader.cpp =================================================================== --- trunk/Gem/src/plugins/imageloader.cpp 2011-08-08 14:28:35 UTC (rev 4437) +++ trunk/Gem/src/plugins/imageloader.cpp 2011-08-08 14:29:40 UTC (rev 4438) @@ -12,27 +12,13 @@ // ///////////////////////////////////////////////////////// -#include "plugins/imageloader.h" +#include "imageloader.h" +#include "plugins/PluginFactory.h" -using namespace gem::plugins; +gem::plugins::imageloader :: ~imageloader(void) {} -///////////////////////////////////////////////////////// -// -// imageloader -// -///////////////////////////////////////////////////////// -// Constructor -// -///////////////////////////////////////////////////////// -imageloader :: imageloader(bool threadable) : m_threadable(threadable) { +gem::plugins::imageloader*gem::plugins::imageloader::getInstance(void) { + return NULL; } -///////////////////////////////////////////////////////// -// Destructor -// -///////////////////////////////////////////////////////// -imageloader :: ~imageloader(void) -{ -} - INIT_IMAGELOADERFACTORY(); Modified: trunk/Gem/src/plugins/imageloader.h =================================================================== --- trunk/Gem/src/plugins/imageloader.h 2011-08-08 14:28:35 UTC (rev 4437) +++ trunk/Gem/src/plugins/imageloader.h 2011-08-08 14:29:40 UTC (rev 4438) @@ -2,7 +2,7 @@ GEM - Graphics Environment for Multimedia -Load an image and return the frame(OS independant parent-class) +Load an image and return the frame(OS independant interface) Copyright (c) 2011 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoel...@iem.kug.ac.at For information on usage and redistribution, and for a DISCLAIMER OF ALL @@ -14,19 +14,16 @@ #define INCLUDE_IMAGELOADER_H_ #include "Gem/Image.h" +#include "Gem/Properties.h" #include <string> -#include "plugins/PluginFactory.h" -#include "Gem/Properties.h" - - /*----------------------------------------------------------------- ------------------------------------------------------------------- CLASS imageloader - parent class for the system- and library-dependent imageloader classes + interface for the system- and library-dependent imageloader classes KEYWORDS pix load an image @@ -38,21 +35,16 @@ class GEM_EXTERN imageloader { public: - - ////////// - // Constructor - - /* initialize the imageloader - * set 'threadable' to FALSE if your implementation must NOT be used within - * threads - */ - imageloader(bool threadable=true); - //////// - // Destructor - /* free what is apropriate */ - virtual ~imageloader(); + ////////// + // returns an instance wrapping all plugins or NULL + // if NULL is returned, you might still try your luck with manually accessing the + // PluginFactory + static imageloader*getInstance(void); + ///////// + // dtor must be virtual + virtual ~imageloader(void); /* read a image * @@ -60,16 +52,13 @@ * e.g. EXIF tags,... */ /* returns TRUE if loading was successfull, FALSE otherwise */ - virtual bool load(std::string filename, imageStruct&result, gem::Properties&props) = 0; + virtual bool load(std::string filename, + imageStruct&result, + gem::Properties&props) = 0; - virtual bool isThreadable(void) { return m_threadable; } - protected: - /* used to store the "set" properties */ - gem::Properties m_properties; - - private: - bool m_threadable; + /* returns TRUE if this object can be used from within a thread */ + virtual bool isThreadable(void) = 0; }; };}; // namespace gem Copied: trunk/Gem/src/plugins/imageloaderBase.cpp (from rev 4437, trunk/Gem/src/plugins/imageloader.cpp) =================================================================== --- trunk/Gem/src/plugins/imageloaderBase.cpp (rev 0) +++ trunk/Gem/src/plugins/imageloaderBase.cpp 2011-08-08 14:29:40 UTC (rev 4438) @@ -0,0 +1,36 @@ +//////////////////////////////////////////////////////// +// +// GEM - Graphics Environment for Multimedia +// +// zmoel...@iem.kug.ac.at +// +// Implementation file +// +// Copyright (c) 2011 IOhannes m zmoelnig. forum::für::umläute. IEM +// For information on usage and redistribution, and for a DISCLAIMER OF ALL +// WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. +// +///////////////////////////////////////////////////////// + +#include "plugins/imageloaderBase.h" + +using namespace gem::plugins; + +///////////////////////////////////////////////////////// +// +// imageloaderBase +// +///////////////////////////////////////////////////////// +// Constructor +// +///////////////////////////////////////////////////////// +imageloaderBase :: imageloaderBase(bool threadable) : m_threadable(threadable) { +} + +///////////////////////////////////////////////////////// +// Destructor +// +///////////////////////////////////////////////////////// +imageloaderBase :: ~imageloaderBase(void) +{ +} Copied: trunk/Gem/src/plugins/imageloaderBase.h (from rev 4437, trunk/Gem/src/plugins/imageloader.h) =================================================================== --- trunk/Gem/src/plugins/imageloaderBase.h (rev 0) +++ trunk/Gem/src/plugins/imageloaderBase.h 2011-08-08 14:29:40 UTC (rev 4438) @@ -0,0 +1,64 @@ +/* ----------------------------------------------------------------- + +GEM - Graphics Environment for Multimedia + +Load an image and return the frame(OS independant parent-class) + +Copyright (c) 2011 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoel...@iem.kug.ac.at +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + +-----------------------------------------------------------------*/ + +#ifndef INCLUDE_IMAGELOADERBASE_H_ +#define INCLUDE_IMAGELOADERBASE_H_ + +#include "plugins/imageloader.h" + + + /*----------------------------------------------------------------- + ------------------------------------------------------------------- + CLASS + imageloader + + parent class for the system- and library-dependent imageloader classes + + KEYWORDS + pix load an image + + DESCRIPTION + + -----------------------------------------------------------------*/ + namespace gem { namespace plugins { + class GEM_EXTERN imageloaderBase : public imageloader + { + public: + + ////////// + // Constructor + + /* initialize the imageloader + * set 'threadable' to FALSE if your implementation must NOT be used within + * threads + */ + imageloaderBase(bool threadable=true); + + //////// + // Destructor + /* free what is apropriate */ + virtual ~imageloaderBase(void); + + + virtual bool isThreadable(void) { return m_threadable; } + + protected: + /* used to store the "set" properties */ + gem::Properties m_properties; + + private: + bool m_threadable; + }; + +};}; // namespace gem + +#endif // for header file Modified: trunk/Gem/src/plugins/imagesaver.cpp =================================================================== --- trunk/Gem/src/plugins/imagesaver.cpp 2011-08-08 14:28:35 UTC (rev 4437) +++ trunk/Gem/src/plugins/imagesaver.cpp 2011-08-08 14:29:40 UTC (rev 4438) @@ -13,36 +13,13 @@ ///////////////////////////////////////////////////////// #include "plugins/imagesaver.h" +#include "plugins/PluginFactory.h" -using namespace gem::plugins; +gem::plugins::imagesaver :: ~imagesaver(void) {} -///////////////////////////////////////////////////////// -// -// imagesaver -// -///////////////////////////////////////////////////////// -// Constructor -// -///////////////////////////////////////////////////////// -imagesaver :: imagesaver(bool threadable) : m_threadable(m_threadable) { +gem::plugins::imagesaver*gem::plugins::imagesaver::getInstance(void) { + return NULL; } -///////////////////////////////////////////////////////// -// Destructor -// -///////////////////////////////////////////////////////// -imagesaver :: ~imagesaver() -{ -} -float imagesaver ::estimateSave( const imageStruct&img, const std::string&filename, const std::string&mimetype, const gem::Properties&props) { - /* the default is rather bad */ - return 0.; -} -void imagesaver ::getWriteCapabilities(std::vector<std::string>&mimetypes, gem::Properties&props) { - mimetypes.clear(); - props.clear(); -} - - INIT_IMAGESAVERFACTORY(); Modified: trunk/Gem/src/plugins/imagesaver.h =================================================================== --- trunk/Gem/src/plugins/imagesaver.h 2011-08-08 14:28:35 UTC (rev 4437) +++ trunk/Gem/src/plugins/imagesaver.h 2011-08-08 14:29:40 UTC (rev 4438) @@ -2,7 +2,7 @@ GEM - Graphics Environment for Multimedia -Load an image and return the frame(OS independant parent-class) +Load an image and return the frame(OS independant interface) Copyright (c) 2011 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoel...@iem.kug.ac.at For information on usage and redistribution, and for a DISCLAIMER OF ALL @@ -14,19 +14,17 @@ #define INCLUDE_IMAGESAVER_H_ #include "Gem/Image.h" +#include "Gem/Properties.h" #include <string> -#include "plugins/PluginFactory.h" -#include "Gem/Properties.h" - /*----------------------------------------------------------------- ------------------------------------------------------------------- CLASS imagesaver - parent class for the system- and library-dependent imagesaver classes + interface for the system- and library-dependent imagesaver classes KEYWORDS save a pix to disk @@ -38,21 +36,16 @@ class GEM_EXTERN imagesaver { public: - - ////////// - // Constructor - - /* initialize the imagesaver - * set 'threadable' to FALSE if your implementation must NOT be used within - * threads - */ - imagesaver(bool threadable=true); - //////// - // Destructor - /* free what is apropriate */ - virtual ~imagesaver(); + ////////// + // returns an instance wrapping all plugins or NULL + // if NULL is returned, you might still try your luck with manually accessing the + // PluginFactory + static imagesaver*getInstance(void); + ///////// + // dtor must be virtual + virtual ~imagesaver(void); /* save the image 'img' under the filename 'filename', respecting as many 'props' as possible * @@ -101,7 +94,7 @@ * JPG knows how to handle the 'quality' property, but not the 'mimetype', so it scores 1 point * TIFF knows how to handle the 'mimetype' but not the 'quality', so it scores 100 points */ - virtual float estimateSave( const imageStruct&img, const std::string&filename, const std::string&mimetype, const gem::Properties&props); + virtual float estimateSave( const imageStruct&img, const std::string&filename, const std::string&mimetype, const gem::Properties&props) = 0; /** * get writing capabilities of this backend (informative) @@ -111,14 +104,11 @@ * if only some properties/mimetypes are explicitely known (but it is likely that more are supported), * it is generally better, to list the few rather than nothing */ - virtual void getWriteCapabilities(std::vector<std::string>&mimetypes, gem::Properties&props); + virtual void getWriteCapabilities(std::vector<std::string>&mimetypes, gem::Properties&props) = 0; /* returns TRUE, if it is save to use this backend from multple threads */ - virtual bool isThreadable(void) { return m_threadable; } - - private: - bool m_threadable; + virtual bool isThreadable(void) = 0; }; }; }; // namespace gem Copied: trunk/Gem/src/plugins/imagesaverBase.cpp (from rev 4437, trunk/Gem/src/plugins/imagesaver.cpp) =================================================================== --- trunk/Gem/src/plugins/imagesaverBase.cpp (rev 0) +++ trunk/Gem/src/plugins/imagesaverBase.cpp 2011-08-08 14:29:40 UTC (rev 4438) @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////// +// +// GEM - Graphics Environment for Multimedia +// +// zmoel...@iem.kug.ac.at +// +// Implementation file +// +// Copyright (c) 2011 IOhannes m zmoelnig. forum::für::umläute. IEM +// For information on usage and redistribution, and for a DISCLAIMER OF ALL +// WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. +// +///////////////////////////////////////////////////////// + +#include "plugins/imagesaverBase.h" + +using namespace gem::plugins; + +///////////////////////////////////////////////////////// +// +// imagesaverBase +// +///////////////////////////////////////////////////////// +// Constructor +// +///////////////////////////////////////////////////////// +imagesaverBase :: imagesaverBase(bool threadable) : m_threadable(m_threadable) { +} + +///////////////////////////////////////////////////////// +// Destructor +// +///////////////////////////////////////////////////////// +imagesaverBase :: ~imagesaverBase() +{ +} + +float imagesaverBase ::estimateSave( const imageStruct&img, const std::string&filename, const std::string&mimetype, const gem::Properties&props) { + /* the default is rather bad */ + return 0.; +} +void imagesaverBase ::getWriteCapabilities(std::vector<std::string>&mimetypes, gem::Properties&props) { + mimetypes.clear(); + props.clear(); +} Added: trunk/Gem/src/plugins/imagesaverBase.h =================================================================== --- trunk/Gem/src/plugins/imagesaverBase.h (rev 0) +++ trunk/Gem/src/plugins/imagesaverBase.h 2011-08-08 14:29:40 UTC (rev 4438) @@ -0,0 +1,75 @@ +/* ----------------------------------------------------------------- + +GEM - Graphics Environment for Multimedia + +Load an image and return the frame(OS independant parent-class) + +Copyright (c) 2011 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoel...@iem.kug.ac.at +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + +-----------------------------------------------------------------*/ + +#ifndef INCLUDE_IMAGESAVERBASE_H_ +#define INCLUDE_IMAGESAVERBASE_H_ + + +#include "plugins/imagesaver.h" + + + /*----------------------------------------------------------------- + ------------------------------------------------------------------- + CLASS + imagesaver + + parent class for the system- and library-dependent imagesaver classes + + KEYWORDS + save a pix to disk + + DESCRIPTION + + -----------------------------------------------------------------*/ + namespace gem { namespace plugins { + class GEM_EXTERN imagesaverBase : public imagesaver + { + public: + + ////////// + // Constructor + + /* initialize the imagesaver + * set 'threadable' to FALSE if your implementation must NOT be used within + * threads + */ + imagesaverBase(bool threadable=true); + + //////// + // Destructor + /* free what is apropriate */ + virtual ~imagesaverBase(void); + + + virtual float estimateSave( const imageStruct&img, const std::string&filename, const std::string&mimetype, const gem::Properties&props); + + /** + * get writing capabilities of this backend (informative) + * + * list all (known) mimetypes and properties this backend supports for writing + * both can be empty, if they are not known when requested + * if only some properties/mimetypes are explicitely known (but it is likely that more are supported), + * it is generally better, to list the few rather than nothing + */ + virtual void getWriteCapabilities(std::vector<std::string>&mimetypes, gem::Properties&props); + + /* returns TRUE, if it is save to use this backend from multple threads + */ + virtual bool isThreadable(void) { return m_threadable; } + + private: + bool m_threadable; + }; + +}; }; // namespace gem + +#endif // for header file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ pd-gem-CVS mailing list pd-gem-CVS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pd-gem-cvs