IImageLoader.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef IRR_I_SURFACE_LOADER_H_INCLUDED
  5. #define IRR_I_SURFACE_LOADER_H_INCLUDED
  6. #include "IReferenceCounted.h"
  7. #include "IImage.h"
  8. #include "ITexture.h"
  9. #include "path.h"
  10. #include "irrArray.h"
  11. namespace irr
  12. {
  13. namespace io
  14. {
  15. class IReadFile;
  16. } // end namespace io
  17. namespace video
  18. {
  19. //! Class which is able to create a image from a file.
  20. /** If you want the Irrlicht Engine be able to load textures of
  21. currently unsupported file formats (e.g .gif), then implement
  22. this and add your new Surface loader with
  23. IVideoDriver::addExternalImageLoader() to the engine. */
  24. class IImageLoader : public virtual IReferenceCounted
  25. {
  26. public:
  27. //! Check if the file might be loaded by this class
  28. /** Check is based on the file extension (e.g. ".tga")
  29. \param filename Name of file to check.
  30. \return True if file seems to be loadable. */
  31. virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
  32. //! Check if the file might be loaded by this class
  33. /** Check might look into the file.
  34. \param file File handle to check.
  35. \return True if file seems to be loadable. */
  36. virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0;
  37. //! Creates a surface from the file
  38. /** \param file File handle to check.
  39. \return Pointer to newly created image, or 0 upon error. */
  40. virtual IImage* loadImage(io::IReadFile* file) const = 0;
  41. //! Creates a multiple surfaces from the file eg. whole cube map.
  42. /** \param file File handle to check.
  43. \param type Pointer to E_TEXTURE_TYPE where a recommended type of the texture will be stored.
  44. \return Array of pointers to newly created images. */
  45. virtual core::array<IImage*> loadImages(io::IReadFile* file, E_TEXTURE_TYPE* type) const
  46. {
  47. core::array<IImage*> image;
  48. return image;
  49. }
  50. };
  51. } // end namespace video
  52. } // end namespace irr
  53. #endif