aboutsummaryrefslogtreecommitdiff
path: root/Gem/develop/include/Gem/plugins/imageloader.h
blob: 22bc5a7d860bb44e0b51acdb72adcda56c4d2f7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* -----------------------------------------------------------------

GEM - Graphics Environment for Multimedia

Load an image and return the frame(OS independent interface)

Copyright (c) 2011-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.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__GEM_PLUGINS_IMAGELOADER_H_
#define _INCLUDE__GEM_PLUGINS_IMAGELOADER_H_

#include "Gem/Image.h"
#include "Gem/Properties.h"

#include <string>

/*-----------------------------------------------------------------
  -------------------------------------------------------------------
  CLASS
  imageloader

  interface for the system- and library-dependent imageloader classes

  KEYWORDS
  pix load an image

  DESCRIPTION

  -----------------------------------------------------------------*/
namespace gem
{
namespace plugins
{
class GEM_EXTERN imageloader
{
public:

  //////////
  // 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
   *
   * props can be filled by the loader with additional information on the image
   * e.g. EXIF tags,...
   */
  /* returns TRUE if loading was successful, FALSE otherwise */
  virtual bool load(std::string filename,
                    imageStruct&result,
                    gem::Properties&props) = 0;

  /* returns TRUE if this object can be used from within a thread */
  virtual bool isThreadable(void) = 0;
};

};
}; // namespace gem


/**
 * \fn REGISTER_IMAGELOADERFACTORY(const char *id, Class imageloaderClass)
 * registers a new class "imageloaderClass" with the imageloader-factory
 *
 * \param id a symbolic (const char*) ID for the given class
 * \param imageloaderClass a class derived from "imageloader"
 */
#define REGISTER_IMAGELOADERFACTORY(id, TYP) static gem::PluginFactoryRegistrar::registrar<TYP, gem::plugins::imageloader> fac_imageloader_ ## TYP (id)

#endif  // for header file