diff --git a/CSFML/include/SFML/Graphics/Image.h b/CSFML/include/SFML/Graphics/Image.h
index e098944f..4d8a43cd 100644
--- a/CSFML/include/SFML/Graphics/Image.h
+++ b/CSFML/include/SFML/Graphics/Image.h
@@ -155,7 +155,6 @@ CSFML_API sfBool sfImage_CopyScreen(sfImage* image, sfRenderWindow* window, sfIn
////////////////////////////////////////////////////////////
/// Change the color of a pixel of an image
-/// Don't forget to call Update when you end modifying pixels
///
/// \param image : Image to modify
/// \param x : X coordinate of pixel in the image
@@ -189,6 +188,21 @@ CSFML_API sfColor sfImage_GetPixel(const sfImage* image, unsigned int x, unsigne
////////////////////////////////////////////////////////////
CSFML_API const sfUint8* sfImage_GetPixelsPtr(const sfImage* image);
+////////////////////////////////////////////////////////////
+/// Update a sub-rectangle of the image from an array of pixels
+///
+/// Warning: for performances reasons, this function doesn't
+/// perform any check; thus you're responsible of ensuring that
+/// \a rectangle does not exceed the image size, and that
+/// \a pixels contains enough elements.
+///
+/// \param image : Image to update
+/// \param rectangle : Sub-rectangle of the image to update
+/// \param pixels : Array of pixels to write to the image
+///
+////////////////////////////////////////////////////////////
+CSFML_API void sfImage_UpdatePixels(const sfImage* image, const sfUint8* pixels, sfIntRect rectangle);
+
////////////////////////////////////////////////////////////
/// Bind the image for rendering
///
diff --git a/CSFML/src/SFML/Graphics/Image.cpp b/CSFML/src/SFML/Graphics/Image.cpp
index 1b37f1e2..c1eff4cd 100644
--- a/CSFML/src/SFML/Graphics/Image.cpp
+++ b/CSFML/src/SFML/Graphics/Image.cpp
@@ -208,6 +208,16 @@ const sfUint8* sfImage_GetPixelsPtr(const sfImage* image)
}
+////////////////////////////////////////////////////////////
+/// Update a sub-rectangle of the image from an array of pixels
+////////////////////////////////////////////////////////////
+void sfImage_UpdatePixels(const sfImage* image, const sfUint8* pixels, sfIntRect rectangle)
+{
+ sf::IntRect rect(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom);
+ CSFML_CALL_PTR(image, UpdatePixels(pixels, rect));
+}
+
+
////////////////////////////////////////////////////////////
/// Bind the image for rendering
////////////////////////////////////////////////////////////
diff --git a/CSFML/src/SFML/Graphics/csfml-graphics-d.def b/CSFML/src/SFML/Graphics/csfml-graphics-d.def
index 3f9d1c00..64461eb5 100644
--- a/CSFML/src/SFML/Graphics/csfml-graphics-d.def
+++ b/CSFML/src/SFML/Graphics/csfml-graphics-d.def
@@ -26,6 +26,7 @@ EXPORTS
sfImage_SetPixel
sfImage_GetPixel
sfImage_GetPixelsPtr
+ sfImage_UpdatePixels
sfImage_Bind
sfImage_SetSmooth
sfImage_GetWidth
diff --git a/CSFML/src/SFML/Graphics/csfml-graphics.def b/CSFML/src/SFML/Graphics/csfml-graphics.def
index f3c53d03..0d262e3a 100644
--- a/CSFML/src/SFML/Graphics/csfml-graphics.def
+++ b/CSFML/src/SFML/Graphics/csfml-graphics.def
@@ -26,6 +26,7 @@ EXPORTS
sfImage_SetPixel
sfImage_GetPixel
sfImage_GetPixelsPtr
+ sfImage_UpdatePixels
sfImage_Bind
sfImage_SetSmooth
sfImage_GetWidth
diff --git a/dotnet/extlibs/csfml-audio.dll b/dotnet/extlibs/csfml-audio.dll
index c9e7b804..2b470fd4 100644
Binary files a/dotnet/extlibs/csfml-audio.dll and b/dotnet/extlibs/csfml-audio.dll differ
diff --git a/dotnet/extlibs/csfml-graphics.dll b/dotnet/extlibs/csfml-graphics.dll
index a78905f9..0ae5d4b6 100644
Binary files a/dotnet/extlibs/csfml-graphics.dll and b/dotnet/extlibs/csfml-graphics.dll differ
diff --git a/dotnet/extlibs/csfml-window.dll b/dotnet/extlibs/csfml-window.dll
index 93e862ba..494649d3 100644
Binary files a/dotnet/extlibs/csfml-window.dll and b/dotnet/extlibs/csfml-window.dll differ
diff --git a/dotnet/src/Graphics/Image.cs b/dotnet/src/Graphics/Image.cs
index 2849f9f6..74bda10f 100644
--- a/dotnet/src/Graphics/Image.cs
+++ b/dotnet/src/Graphics/Image.cs
@@ -267,6 +267,38 @@ namespace SFML
}
}
+ ////////////////////////////////////////////////////////////
+ ///
+ /// Update the pixels of the image
+ ///
+ /// 2 dimensions array containing the pixels
+ ////////////////////////////////////////////////////////////
+ public void UpdatePixels(Color[,] pixels)
+ {
+ UpdatePixels(pixels, 0, 0);
+ }
+
+ ////////////////////////////////////////////////////////////
+ ///
+ /// Update the pixels of the image
+ ///
+ /// 2 dimensions array containing the pixels
+ /// X position of the rectangle to update
+ /// Y position of the rectangle to update
+ ////////////////////////////////////////////////////////////
+ public void UpdatePixels(Color[,] pixels, uint x, uint y)
+ {
+ unsafe
+ {
+ fixed (Color* PixelsPtr = pixels)
+ {
+ int Width = pixels.GetLength(0);
+ int Height = pixels.GetLength(1);
+ sfImage_UpdatePixels(This, PixelsPtr, new IntRect((int)x, (int)y, Width, Height));
+ }
+ }
+ }
+
////////////////////////////////////////////////////////////
///
/// Bind the image for rendering
@@ -393,6 +425,9 @@ namespace SFML
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfImage_GetPixelsPtr(IntPtr This);
+ [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
+ unsafe static extern void sfImage_UpdatePixels(IntPtr This, Color* Pixels, IntRect Rectangle);
+
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfImage_Bind(IntPtr This);