IImageLoader.h 1.4 KB

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