diff options
Diffstat (limited to 'Source/Asura.Engine/Graphics/Image.h')
-rw-r--r-- | Source/Asura.Engine/Graphics/Image.h | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/Source/Asura.Engine/Graphics/Image.h b/Source/Asura.Engine/Graphics/Image.h new file mode 100644 index 0000000..5b27079 --- /dev/null +++ b/Source/Asura.Engine/Graphics/Image.h @@ -0,0 +1,119 @@ +#ifndef __AE_IMAGE_H__ +#define __AE_IMAGE_H__ + +#include "Math/Vector2.h" +#include "Manager.hpp" +#include "Texture.h" +#include "Color.h" +#include "Factory.h" + +namespace AsuraEngine +{ + namespace Graphics + { + + class ImageFactory; + + /// + /// ImageͼƬڴȡϷĽһImageڴ桢ԴֻᱣһݣҪ + /// imageêλãźתǶȣʹspriteһֻࡣ + /// + class Image final : public Texture, public Filesystem::Asset + { + public: + + uint GetWidth(); + uint GetHeight(); + + /// + /// ijһλõ + /// + Color GetPixel(uint x, uint y); + + private: + + friend class ImageFactory; + + Image(Color* pixels, int width, int height); + ~Image(); + + /// + /// СΪλ + /// + uint mWidth, mHeight; + Color* mPixels; + + /// + /// ID + /// + uint mID; + + }; + + /// + /// + /// + class ImageManager : public Manager + { + public: + + /// + /// ͨIDȡ·dzͼƬString::Null + /// + Containers::String GetImagePath(uint ID); + + /// + /// ͨID·ȡIDûҵ0 + /// + uint GetImageID(const Containers::String& path); + + Image* GetImage(const Containers::String& path); + + Image* GetImage(const Containers::String& ID); + + uint AddImage(const Containers::String& path, Image* image); + + uint AddImage(Image* image); + + bool RemoveImage(uint ID); + + bool RemoveImage(Image* image); + + private: + + /// + /// еimage + /// + Containers::Map<uint, Image*> mImages; + + /// + /// image·IDӳ䡣Դ.asrimageͨ·õimageԲеimageڴmapС + /// ɳimageֻͨIDȡԳҪID + /// + Containers::StringMap<uint> mImageIDs; + + }; + + /// + /// + /// + class ImageFactory : public Factory + { + public: + + /// + /// image pixelйimage + /// + Image* ReadBuffer(Color* pixels, int width, int height); + + /// + /// image externݲ + /// + Image* Decode(); + + }; + + } +} + +#endif
\ No newline at end of file |