sync with SFML

+ Image.updatePixels

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1437 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
trass3r 2010-03-03 15:29:16 +00:00
parent f9680f1818
commit b4189fd660

View File

@ -36,9 +36,9 @@ import dsfml.system.common,
/**
* Image is the low-level class for loading and
* manipulating images
*/
* Image is the low-level class for loading and
* manipulating images
*/
class Image : DSFMLObject
{
package:
@ -297,10 +297,25 @@ public:
return cast(bool)sfImage_IsSmooth(m_ptr);
}
private:
extern (C)
/**
* 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
* rectangle does not exceed the image size, and that
* pixels contains enough elements.
*
* Params:
* rectangle = sub rectangle of the image to update
* pixels = array of pixels to write to the image
*/
void updatePixels(ubyte[] pixels, IntRect rectangle)
{
static
sfImage_UpdatePixels(m_ptr, pixels.ptr, rectangle);
}
private:
static extern (C)
{
void* function() sfImage_Create;
void* function(uint, uint, Color) sfImage_CreateFromColor;
@ -320,33 +335,11 @@ private:
uint function(void*) sfImage_GetWidth;
uint function(void*) sfImage_GetHeight;
int function(void*) sfImage_IsSmooth;
}
void function(void*, ubyte*, IntRect) sfImage_UpdatePixels;
}
static this()
{
debug
DllLoader dll = DllLoader.load("csfml-graphics-d");
else
DllLoader dll = DllLoader.load("csfml-graphics");
mixin(loadFromSharedLib("sfImage_Create"));
mixin(loadFromSharedLib("sfImage_CreateFromColor"));
mixin(loadFromSharedLib("sfImage_CreateFromPixels"));
mixin(loadFromSharedLib("sfImage_CreateFromFile"));
mixin(loadFromSharedLib("sfImage_CreateFromMemory"));
mixin(loadFromSharedLib("sfImage_Destroy"));
mixin(loadFromSharedLib("sfImage_SaveToFile"));
mixin(loadFromSharedLib("sfImage_CreateMaskFromColor"));
mixin(loadFromSharedLib("sfImage_CopyScreen"));
mixin(loadFromSharedLib("sfImage_Copy"));
mixin(loadFromSharedLib("sfImage_SetPixel"));
mixin(loadFromSharedLib("sfImage_GetPixel"));
mixin(loadFromSharedLib("sfImage_GetPixelsPtr"));
mixin(loadFromSharedLib("sfImage_Bind"));
mixin(loadFromSharedLib("sfImage_SetSmooth"));
mixin(loadFromSharedLib("sfImage_GetWidth"));
mixin(loadFromSharedLib("sfImage_GetHeight"));
mixin(loadFromSharedLib("sfImage_IsSmooth"));
}
mixin(loadFromSharedLib2("csfml-graphics", "sfImage",
"Create", "CreateFromColor", "CreateFromPixels", "CreateFromFile", "CreateFromMemory", "Destroy", "SaveToFile",
"CreateMaskFromColor", "CopyScreen", "Copy", "SetPixel", "GetPixel", "GetPixelsPtr", "Bind", "SetSmooth", "GetWidth",
"GetHeight", "IsSmooth", "UpdatePixels"));
}