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