Added Image::UpdatePixels to CSFML and SFML.Net
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1436 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
e394b6f35c
commit
f9680f1818
8 changed files with 62 additions and 1 deletions
|
@ -267,6 +267,38 @@ namespace SFML
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Update the pixels of the image
|
||||
/// </summary>
|
||||
/// <param name="pixels">2 dimensions array containing the pixels</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public void UpdatePixels(Color[,] pixels)
|
||||
{
|
||||
UpdatePixels(pixels, 0, 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Update the pixels of the image
|
||||
/// </summary>
|
||||
/// <param name="pixels">2 dimensions array containing the pixels</param>
|
||||
/// <param name="x">X position of the rectangle to update</param>
|
||||
/// <param name="y">Y position of the rectangle to update</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// 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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue