diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-09-13 20:40:07 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-09-13 20:40:07 +0200 |
commit | 87c87c2c06aaea40784ea4de11d4619b54fb8be2 (patch) | |
tree | 765c830e0f43246714a0ff86493a688cf20045e8 /src/common/image.h | |
parent | 34d7dcf3be24de04b2b9c64edb2666439b353a5b (diff) | |
download | colobot-87c87c2c06aaea40784ea4de11d4619b54fb8be2.tar.gz colobot-87c87c2c06aaea40784ea4de11d4619b54fb8be2.tar.bz2 colobot-87c87c2c06aaea40784ea4de11d4619b54fb8be2.zip |
Image pixel read/write
Diffstat (limited to 'src/common/image.h')
-rw-r--r-- | src/common/image.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/common/image.h b/src/common/image.h index 7588ea9..93c7cab 100644 --- a/src/common/image.h +++ b/src/common/image.h @@ -21,6 +21,8 @@ #pragma once +#include "graphics/core/color.h" +#include "math/intpoint.h" #include <stddef.h> #include <string> @@ -64,12 +66,21 @@ public: //! Frees the allocated image data void Free(); - //! Returns whether the image is empty (has NULL data) - bool IsEmpty(); + //! Returns whether the image is empty (has null data) + bool IsEmpty() const; - //! Returns the image data; if empty - returns NULL + //! Returns the image data; if empty - returns nullptr ImageData* GetData(); + //! Returns the image size + Math::IntPoint GetSize() const; + + //! Sets the color at given pixel + void SetPixel(Math::IntPoint pixel, Gfx::Color color); + + //! Returns the color at given pixel + Gfx::Color GetPixel(Math::IntPoint pixel); + //! Loads an image from the specified file bool Load(const std::string &fileName); |