Esempio n. 1
0
// ---------------------------------------------------------------------------
NLMISC::CBitmap *CDataBase::loadBitmap (const std::string &fileName)
{
	NLMISC::CBitmap *pBitmap = new NLMISC::CBitmap();

	try
	{
		CIFile fileIn;
		if (fileIn.open (fileName))
		{
			pBitmap->load (fileIn);
		}
		else
		{
			pBitmap->makeDummy();
			nlwarning ("Bitmap not found : %s", fileName.c_str());
		}
	}
	catch (Exception& e)
	{
		pBitmap->makeDummy();
		theApp.errorMessage ("Error while loading bitmap %s : %s", fileName.c_str(), e.what());
	}

	return pBitmap;
}
Esempio n. 2
0
bool CIconWnd::loadIcon(const std::string &filename, NLMISC::CBitmap &bmp)
{
    // Try to get the file path
    string filepath = CPath::lookup(filename, false, false);
    if (filepath == "")
    {
        bmp.makeDummy();
        bmp.convertToType(NLMISC::CBitmap::RGBA);
        bmp.resample(40, 40);
        return false;
    }

    // load icon
    CIFile f;
    f.open(filepath);

    bmp.load(f);
    bmp.convertToType(NLMISC::CBitmap::RGBA);
    bmp.resample(40, 40);

    f.close();

    return true;
}