2005-03-09 01:31:56 +00:00
|
|
|
|
//========= Copyright <20> 1996-2001, Valve LLC, All rights reserved. ============
|
|
|
|
|
//
|
|
|
|
|
// Purpose:
|
|
|
|
|
//
|
|
|
|
|
// $NoKeywords: $
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
|
|
#include "../cl_dll/wrect.h"
|
|
|
|
|
#include "../cl_dll/cl_dll.h"
|
|
|
|
|
#include "vgui.h"
|
|
|
|
|
#include "vgui_loadtga.h"
|
|
|
|
|
#include "vgui_inputstream.h"
|
|
|
|
|
|
|
|
|
|
|
2005-04-01 03:04:57 +00:00
|
|
|
|
#include "ui/MemoryInputStream.h"
|
2005-03-09 01:31:56 +00:00
|
|
|
|
|
2005-04-01 03:04:57 +00:00
|
|
|
|
vgui::BitmapTGA* vgui_LoadTGANoInvertAlpha(char const *pFilename)
|
|
|
|
|
{ return vgui_LoadTGA(pFilename,false); }
|
2005-03-09 01:31:56 +00:00
|
|
|
|
|
2005-04-01 03:04:57 +00:00
|
|
|
|
vgui::BitmapTGA* vgui_LoadTGA(char const *pFilename, bool bInvertAlpha)
|
2005-03-09 01:31:56 +00:00
|
|
|
|
{
|
2005-04-01 03:04:57 +00:00
|
|
|
|
int nLength = 0;
|
|
|
|
|
uchar* pData = gEngfuncs.COM_LoadFile((char*)pFilename, 5, &nLength);
|
2005-03-09 01:31:56 +00:00
|
|
|
|
|
2005-04-01 03:04:57 +00:00
|
|
|
|
if( !pData )
|
2005-03-09 01:31:56 +00:00
|
|
|
|
return NULL;
|
2005-04-01 03:04:57 +00:00
|
|
|
|
|
|
|
|
|
MemoryInputStream stream(pData,nLength);
|
|
|
|
|
vgui::BitmapTGA *pRet = new vgui::BitmapTGA(&stream, bInvertAlpha);
|
|
|
|
|
gEngfuncs.COM_FreeFile(pData);
|
|
|
|
|
|
2005-03-09 01:31:56 +00:00
|
|
|
|
return pRet;
|
|
|
|
|
}
|
2005-04-01 03:04:57 +00:00
|
|
|
|
|