00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef SFML_TEXTURE_HPP
00026 #define SFML_TEXTURE_HPP
00027
00029
00031 #include <SFML/System/Resource.hpp>
00032 #include <SFML/Window/GlResource.hpp>
00033 #include <SFML/Graphics/Image.hpp>
00034
00035
00036 namespace sf
00037 {
00038 class Window;
00039 class Renderer;
00040 class RenderTexture;
00041 class InputStream;
00042
00047 class SFML_API Texture : public Resource<Texture>, GlResource
00048 {
00049 public :
00050
00057 Texture();
00058
00065 Texture(const Texture& copy);
00066
00071 ~Texture();
00072
00084 bool Create(unsigned int width, unsigned int height);
00085
00115 bool LoadFromFile(const std::string& filename, const IntRect& area = IntRect());
00116
00147 bool LoadFromMemory(const void* data, std::size_t size, const IntRect& area = IntRect());
00148
00178 bool LoadFromStream(sf::InputStream& stream, const IntRect& area = IntRect());
00179
00202 bool LoadFromImage(const Image& image, const IntRect& area = IntRect());
00203
00212 unsigned int GetWidth() const;
00213
00222 unsigned int GetHeight() const;
00223
00237 Image CopyToImage() const;
00238
00255 void Update(const Uint8* pixels);
00256
00277 void Update(const Uint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
00278
00297 void Update(const Image& image);
00298
00314 void Update(const Image& image, unsigned int x, unsigned int y);
00315
00334 void Update(const Window& window);
00335
00351 void Update(const Window& window, unsigned int x, unsigned int y);
00352
00362 void Bind() const;
00363
00378 void SetSmooth(bool smooth);
00379
00388 bool IsSmooth() const;
00389
00402 FloatRect GetTexCoords(const IntRect& rectangle) const;
00403
00412 Texture& operator =(const Texture& right);
00413
00424 static unsigned int GetMaximumSize();
00425
00426 private :
00427
00428 friend class Renderer;
00429 friend class RenderTexture;
00430
00444 static unsigned int GetValidSize(unsigned int size);
00445
00447
00449 unsigned int myWidth;
00450 unsigned int myHeight;
00451 unsigned int myTextureWidth;
00452 unsigned int myTextureHeight;
00453 unsigned int myTexture;
00454 bool myIsSmooth;
00455 mutable bool myPixelsFlipped;
00456 };
00457
00458 }
00459
00460
00461 #endif // SFML_TEXTURE_HPP
00462