mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 05:06:12 +01:00
Added InputStream
This commit is contained in:
1 parent
56df80a7d3
commit
6e251c5415
15 files changed
+323
-33
No files matched your search
@@ -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
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in new issue
Block a user