summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/image.cpp9
-rw-r--r--src/common/image.h3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/common/image.cpp b/src/common/image.cpp
index f3cfa34..638304e 100644
--- a/src/common/image.cpp
+++ b/src/common/image.cpp
@@ -190,6 +190,15 @@ Math::IntPoint CImage::GetSize() const
return Math::IntPoint(m_data->surface->w, m_data->surface->h);
}
+/** Image must be valid. */
+void CImage::Fill(Gfx::IntColor color)
+{
+ assert(m_data != nullptr);
+
+ Uint32 c = SDL_MapRGBA(m_data->surface->format, color.r, color.g, color.b, color.a);
+ SDL_FillRect(m_data->surface, nullptr, c);
+}
+
/**
* Image must be valid and pixel coords in valid range.
*
diff --git a/src/common/image.h b/src/common/image.h
index d23a6fa..d9da75b 100644
--- a/src/common/image.h
+++ b/src/common/image.h
@@ -79,6 +79,9 @@ public:
//! Returns the image size
Math::IntPoint GetSize() const;
+ //! Fills the whole image with given color
+ void Fill(Gfx::IntColor color);
+
//! Sets the color at given pixel
void SetPixel(Math::IntPoint pixel, Gfx::Color color);