IImageLoader.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #pragma once
  5. #include "IReferenceCounted.h"
  6. #include "IImage.h"
  7. #include "ITexture.h"
  8. #include "path.h"
  9. #include "irrArray.h"
  10. namespace irr
  11. {
  12. namespace io
  13. {
  14. class IReadFile;
  15. } // end namespace io
  16. namespace video
  17. {
  18. //! Class which is able to create a image from a file.
  19. /** If you want the Irrlicht Engine be able to load textures of
  20. currently unsupported file formats (e.g .gif), then implement
  21. this and add your new Surface loader with
  22. IVideoDriver::addExternalImageLoader() to the engine. */
  23. class IImageLoader : public virtual IReferenceCounted
  24. {
  25. public:
  26. //! Check if the file might be loaded by this class
  27. /** Check is based on the file extension (e.g. ".tga")
  28. \param filename Name of file to check.
  29. \return True if file seems to be loadable. */
  30. virtual bool isALoadableFileExtension(const io::path &filename) const = 0;
  31. //! Check if the file might be loaded by this class
  32. /** Check might look into the file.
  33. \param file File handle to check.
  34. \return True if file seems to be loadable. */
  35. virtual bool isALoadableFileFormat(io::IReadFile *file) const = 0;
  36. //! Creates a surface from the file
  37. /** \param file File handle to check.
  38. \return Pointer to newly created image, or 0 upon error. */
  39. virtual IImage *loadImage(io::IReadFile *file) const = 0;
  40. };
  41. } // end namespace video
  42. } // end namespace irr