Added InputStream

This commit is contained in:
Laurent Gomila committed 2011-07-21 20:38:54 +02:00
1 parent 56df80a7d3
commit 6e251c5415
15 files changed
+323 -33

No files matched your search

+21
View File
@@ -29,6 +29,7 @@
#include <SFML/Graphics/ImageStruct.h>
#include <SFML/Graphics/RenderWindowStruct.h>
#include <SFML/Internal.h>
#include <SFML/CallbackStream.h>
////////////////////////////////////////////////////////////
@@ -99,6 +100,26 @@ sfImage* sfImage_CreateFromMemory(const void* data, size_t sizeInBytes)
}
////////////////////////////////////////////////////////////
/// Create a new image from a custom stream
////////////////////////////////////////////////////////////
sfImage* sfImage_CreateFromStream(sfInputStream* stream)
{
CSFML_CHECK_RETURN(stream, NULL);
sfImage* image = new sfImage;
CallbackStream sfmlStream(stream);
if (!image->This->LoadFromStream(sfmlStream))
{
delete image;
image = NULL;
}
return image;
}
////////////////////////////////////////////////////////////
/// Copy an existing image
////////////////////////////////////////////////////////////