mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
STB Memory functions for fonts
Add the ability to read and write to a stream.
This commit is contained in:
parent
7216ba8530
commit
106346630d
4 changed files with 129 additions and 15 deletions
|
|
@ -1206,6 +1206,20 @@ bool GBitmap::readBitmap(const String& bmType, const Torque::Path& path)
|
|||
return regInfo->readFunc(path, this);
|
||||
}
|
||||
|
||||
bool GBitmap::readBitmapStream(const String& bmType, Stream& ioStream, U32 len)
|
||||
{
|
||||
PROFILE_SCOPE(ResourceGBitmap_readBitmapStream);
|
||||
const GBitmap::Registration* regInfo = GBitmap::sFindRegInfo(bmType);
|
||||
|
||||
if (regInfo == NULL)
|
||||
{
|
||||
Con::errorf("[GBitmap::readBitmap] unable to find registration for extension [%s]", bmType.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
return regInfo->readStreamFunc(ioStream, this, len);
|
||||
}
|
||||
|
||||
bool GBitmap::writeBitmap( const String &bmType, const Torque::Path& path, U32 compressionLevel )
|
||||
{
|
||||
FileStream stream;
|
||||
|
|
@ -1230,6 +1244,19 @@ bool GBitmap::writeBitmap( const String &bmType, const Torque::Path& path, U32
|
|||
return regInfo->writeFunc(path, this, (compressionLevel == U32_MAX) ? regInfo->defaultCompression : compressionLevel );
|
||||
}
|
||||
|
||||
bool GBitmap::writeBitmapStream(const String& bmType, Stream& ioStream, U32 compressionLevel)
|
||||
{
|
||||
const GBitmap::Registration* regInfo = GBitmap::sFindRegInfo(bmType);
|
||||
|
||||
if (regInfo == NULL)
|
||||
{
|
||||
Con::errorf("[GBitmap::writeBitmap] unable to find registration for extension [%s]", bmType.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
return regInfo->writeStreamFunc(ioStream, this, (compressionLevel == U32_MAX) ? regInfo->defaultCompression : compressionLevel);
|
||||
}
|
||||
|
||||
template<> void *Resource<GBitmap>::create(const Torque::Path &path)
|
||||
{
|
||||
PROFILE_SCOPE( ResourceGBitmap_create );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue