soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SResProvider.cpp
1//////////////////////////////////////////////////////////////////////////
2// File Name: sresprovider.cpp
3// Description: Resource Provider
4//////////////////////////////////////////////////////////////////////////
5#include "souistd.h"
6#include "res.mgr/SResProvider.h"
7#ifdef _WIN32
8#include <io.h>
9#else
10#include <sys/stat.h>
11#include <dirent.h>
12#endif
13SNSBEGIN
14
15//定义3种系统资源类型
16const TCHAR KTypeBitmap[] = _T("BITMAP");
17const TCHAR KTypeCursor[] = _T("CURSOR");
18const TCHAR KTypeIcon[] = _T("ICON");
19const TCHAR KTypeHtml[] = _T("HTML");
20
21//////////////////////////////////////////////////////////////////////////
22IBitmapS *SResLoadFromMemory::LoadImage(LPVOID pBuf, size_t size)
23{
24 IBitmapS *pImg = NULL;
25 GETRENDERFACTORY->CreateBitmap(&pImg);
26 if (!pImg)
27 return NULL;
28 HRESULT hr = pImg->LoadFromMemory((LPBYTE)pBuf, size);
29
30 if (!SUCCEEDED(hr))
31 {
32 pImg->Release();
33 pImg = NULL;
34 }
35
36 return pImg;
37}
38
39IImgX *SResLoadFromMemory::LoadImgX(LPVOID pBuf, size_t size)
40{
41 IImgX *pImgX = NULL;
42 GETRENDERFACTORY->GetImgDecoderFactory()->CreateImgX(&pImgX);
43 if (!pImgX)
44 return NULL;
45 if (0 == pImgX->LoadFromMemory(pBuf, size))
46 {
47 pImgX->Release();
48 pImgX = NULL;
49 }
50 return pImgX;
51}
52
53#ifdef _WIN32
54//////////////////////////////////////////////////////////////////////////
55SResProviderPE::SResProviderPE()
56 : m_hResInst(0)
57 , m_bOwner(FALSE)
58{
59}
60
61SResProviderPE::~SResProviderPE()
62{
63 if (m_bOwner)
64 {
65 FreeLibrary(m_hResInst);
66 }
67}
68
69BOOL SResProviderPE::Init(WPARAM wParam, LPARAM lParam)
70{
71 if (lParam == 0)
72 {
73 m_hResInst = (HINSTANCE)wParam;
74 m_bOwner = FALSE;
75 return TRUE;
76 }
77 else
78 {
79 LPCTSTR pszPath = (LPCTSTR)wParam;
80 m_hResInst = LoadLibrary(pszPath);
81 if (!m_hResInst)
82 return FALSE;
83 m_bOwner = TRUE;
84 return TRUE;
85 }
86}
87
88HBITMAP SResProviderPE::LoadBitmap(LPCTSTR pszResName)
89{
90 return ::LoadBitmap(m_hResInst, pszResName);
91}
92
93HICON SResProviderPE::LoadIcon(LPCTSTR pszResName, int cx /*=0*/, int cy /*=0*/)
94{
95 return (HICON)::LoadImage(m_hResInst, pszResName, IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR);
96}
97
98HCURSOR SResProviderPE::LoadCursor(LPCTSTR pszResName)
99{
100 HRSRC hRes = ::FindResource(m_hResInst, pszResName, RT_ANICURSOR);
101 if (hRes)
102 {
103 DWORD dwSize = SizeofResource(m_hResInst, hRes);
104 HGLOBAL hGlob = LoadResource(m_hResInst, hRes);
105 LPBYTE pBytes = (LPBYTE)LockResource(hGlob);
106 return (HCURSOR)CreateIconFromResource(pBytes, dwSize, FALSE, 0x00030000);
107 }
108 else
109 {
110 return ::LoadCursor(m_hResInst, pszResName);
111 }
112}
113
114IBitmapS *SResProviderPE::LoadImage(LPCTSTR strType, LPCTSTR pszResName)
115{
116 if (!HasResource(strType, pszResName))
117 return NULL;
118 size_t szImgBuf = GetRawBufferSize(strType, pszResName);
119 if (szImgBuf == 0)
120 return NULL;
121 LPVOID pBuf = GetRawBufferPtr(strType, pszResName);
122 return SResLoadFromMemory::LoadImage(pBuf, szImgBuf);
123}
124
125IImgX *SResProviderPE::LoadImgX(LPCTSTR strType, LPCTSTR pszResName)
126{
127 if (!HasResource(strType, pszResName))
128 return NULL;
129 size_t szImgBuf = GetRawBufferSize(strType, pszResName);
130 if (szImgBuf == 0)
131 return NULL;
132 LPVOID pBuf = GetRawBufferPtr(strType, pszResName);
133 return SResLoadFromMemory::LoadImgX(pBuf, szImgBuf);
134}
135
136size_t SResProviderPE::GetRawBufferSize(LPCTSTR strType, LPCTSTR pszResName)
137{
138 HRSRC hRsrc = MyFindResource(strType, pszResName);
139
140 if (NULL == hRsrc)
141 return 0;
142
143 return ::SizeofResource(m_hResInst, hRsrc);
144}
145
146BOOL SResProviderPE::GetRawBuffer(LPCTSTR strType, LPCTSTR pszResName, LPVOID pBuf, size_t size)
147{
148 SASSERT(strType);
149 HRSRC hRsrc = MyFindResource(strType, pszResName);
150
151 if (NULL == hRsrc)
152 return FALSE;
153
154 size_t dwSize = ::SizeofResource(m_hResInst, hRsrc);
155 if (0 == dwSize)
156 return FALSE;
157
158 if (size < dwSize)
159 {
160 SetLastError(ERROR_INSUFFICIENT_BUFFER);
161 return FALSE;
162 }
163 HGLOBAL hGlobal = ::LoadResource(m_hResInst, hRsrc);
164 if (NULL == hGlobal)
165 return FALSE;
166
167 LPVOID pBuffer = ::LockResource(hGlobal);
168 if (NULL == pBuffer)
169 return FALSE;
170
171 memcpy(pBuf, pBuffer, dwSize);
172
173 ::FreeResource(hGlobal);
174
175 return TRUE;
176}
177
178LPVOID SResProviderPE::GetRawBufferPtr(LPCTSTR strType, LPCTSTR pszResName)
179{
180 SASSERT(strType);
181 HRSRC hRsrc = MyFindResource(strType, pszResName);
182
183 if (NULL == hRsrc)
184 return NULL;
185
186 size_t dwSize = ::SizeofResource(m_hResInst, hRsrc);
187 if (0 == dwSize)
188 return NULL;
189
190 HGLOBAL hGlobal = ::LoadResource(m_hResInst, hRsrc);
191 if (NULL == hGlobal)
192 return NULL;
193
194 LPVOID pBuffer = ::LockResource(hGlobal);
195
196 ::FreeResource(hGlobal);
197
198 return pBuffer;
199}
200
201BOOL SResProviderPE::HasResource(LPCTSTR strType, LPCTSTR pszResName)
202{
203 if (!strType)
204 return FALSE;
205 return MyFindResource(strType, pszResName) != NULL;
206}
207
208HRSRC SResProviderPE::MyFindResource(LPCTSTR strType, LPCTSTR pszResName)
209{
210 if (_tcsicmp(strType, KTypeBitmap) == 0)
211 strType = RT_BITMAP;
212 else if (_tcsicmp(strType, KTypeIcon) == 0)
213 strType = RT_GROUP_ICON;
214 else if (_tcsicmp(strType, KTypeCursor) == 0)
215 strType = RT_GROUP_CURSOR;
216 else if (_tcsicmp(strType, KTypeHtml) == 0)
217 strType = RT_HTML;
218
219 HRSRC hRet = ::FindResource(m_hResInst, pszResName, strType);
220 if (!hRet && strType == RT_GROUP_CURSOR)
221 hRet = ::FindResource(m_hResInst, pszResName, RT_ANICURSOR);
222 return hRet;
223}
224
225struct EnumResParam
226{
227 EnumResCallback fun;
228 LPARAM lParam;
229};
230
231static BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam)
232{
233 EnumResParam *enumParam = (EnumResParam *)lParam;
234 return enumParam->fun(lpszType, lpszName, enumParam->lParam);
235}
236
237static BOOL CALLBACK EnumResTypeProc(HMODULE hModule, LPTSTR lpszType, LONG_PTR lParam)
238{
239 return EnumResourceNames(hModule, lpszType, EnumResNameProc, lParam);
240}
241
242void SResProviderPE::EnumResource(EnumResCallback funEnumCB, LPARAM lp)
243{
244 EnumResParam param = { funEnumCB, lp };
245 EnumResourceTypes(m_hResInst, EnumResTypeProc, (LONG_PTR)&param);
246}
247
248struct EnumFileParam
249{
250 EnumFileCallback fun;
251 LPARAM lParam;
252};
253static BOOL CALLBACK EnumResFileProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam)
254{
255 EnumFileParam *enumParam = (EnumFileParam *)lParam;
256 SStringT strPath = SStringT().Format(_T("%s:%s"), lpszType, lpszName);
257 return enumParam->fun(strPath.c_str(), enumParam->lParam);
258}
259
260static BOOL CALLBACK EnumResTypeProc2(HMODULE hModule, LPTSTR lpszType, LONG_PTR lParam)
261{
262 return EnumResourceNames(hModule, lpszType, EnumResFileProc, lParam);
263}
264void SResProviderPE::EnumFile(THIS_ EnumFileCallback funEnumCB, LPARAM lp)
265{
266 EnumFileParam param = { funEnumCB, lp };
267 EnumResourceTypes(m_hResInst, EnumResTypeProc2, (LONG_PTR)&param);
268}
269
270#endif //_WIN32
271//////////////////////////////////////////////////////////////////////////
272//
273
274HBITMAP SResLoadFromFile::LoadBitmap(LPCTSTR strPath)
275{
276 return (HBITMAP)::LoadImage(NULL, strPath, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
277}
278
279HICON SResLoadFromFile::LoadIcon(LPCTSTR strPath, int cx /*=0*/, int cy /*=0*/)
280{
281 return (HICON)::LoadImage(NULL, strPath, IMAGE_ICON, cx, cy, LR_LOADFROMFILE);
282}
283
284HCURSOR SResLoadFromFile::LoadCursor(LPCTSTR strPath)
285{
286 return (HCURSOR)::LoadImage(NULL, strPath, IMAGE_CURSOR, 0, 0, LR_LOADFROMFILE);
287}
288
290{
291 IBitmapS *pImg = NULL;
292 GETRENDERFACTORY->CreateBitmap(&pImg);
293
294 HRESULT hr = pImg->LoadFromFile(strPath);
295 if (!SUCCEEDED(hr))
296 {
297 pImg->Release();
298 pImg = NULL;
299 }
300 return pImg;
301}
302
304{
305 IImgX *pImgX = NULL;
306 GETRENDERFACTORY->GetImgDecoderFactory()->CreateImgX(&pImgX);
307 if (!pImgX)
308 return NULL;
309#ifdef _UNICODE
310 if (0 == pImgX->LoadFromFileW(strPath))
311#else
312 if (0 == pImgX->LoadFromFileA(strPath))
313#endif
314 {
315 pImgX->Release();
316 pImgX = NULL;
317 }
318 return pImgX;
319}
320
322{
323 return file_length(strPath);
324}
325
326BOOL SResLoadFromFile::GetRawBuffer(LPCTSTR strPath, LPVOID pBuf, size_t size)
327{
328 FILE *f = _tfopen(strPath, _T("rb"));
329 if (!f)
330 return FALSE;
331#ifdef _WIN32
332 size_t len = _filelength(_fileno(f));
333#else
334 fseek(f, 0, SEEK_END);
335 size_t len = ftell(f);
336 fseek(f, 0, SEEK_SET);
337#endif
338 if (len > size)
339 {
340 SetLastError(ERROR_INSUFFICIENT_BUFFER);
341 fclose(f);
342 return FALSE;
343 }
344 BOOL bRet = (len == fread(pBuf, 1, len, f));
345
346 fclose(f);
347 return bRet;
348}
349
350//////////////////////////////////////////////////////////////////////////
351// SResProviderFiles
352
356
357SStringT SResProviderFiles::GetRes(LPCTSTR strType, LPCTSTR pszResName)
358{
359 if (!strType)
360 {
361 // pszResName is relative path
362 SStringT strRet = m_strPath + _T(PATH_SLASH) + pszResName;
363 DWORD dwAttr = GetFileAttributes(strRet);
364 if (dwAttr == INVALID_FILE_ATTRIBUTES || (dwAttr & FILE_ATTRIBUTE_ARCHIVE) == 0)
365 strRet = _T("");
366 return strRet;
367 }
368 SResID resID(strType, pszResName);
369 SMap<SResID, SStringT>::CPair *p = m_mapFiles.Lookup(resID);
370 if (!p)
371 return _T("");
372
373 SStringT strRet = m_strPath + _T(PATH_SLASH) + p->m_value;
374 return strRet;
375}
376
377HBITMAP SResProviderFiles::LoadBitmap(LPCTSTR pszResName)
378{
379 SStringT strPath = GetRes(KTypeBitmap, pszResName);
380 if (strPath.IsEmpty())
381 return NULL;
382 return SResLoadFromFile::LoadBitmap(strPath);
383}
384
385HICON SResProviderFiles::LoadIcon(LPCTSTR pszResName, int cx /*=0*/, int cy /*=0*/)
386{
387 SStringT strPath = GetRes(KTypeIcon, pszResName);
388 if (strPath.IsEmpty())
389 return NULL;
390 return SResLoadFromFile::LoadIcon(strPath, cx, cy);
391}
392
393HCURSOR SResProviderFiles::LoadCursor(LPCTSTR pszResName)
394{
395 SStringT strPath = GetRes(KTypeCursor, pszResName);
396 if (strPath.IsEmpty())
397 return NULL;
398 return SResLoadFromFile::LoadCursor(strPath);
399}
400
401IBitmapS *SResProviderFiles::LoadImage(LPCTSTR strType, LPCTSTR pszResName)
402{
403 SStringT strPath = GetRes(strType, pszResName);
404 if (strPath.IsEmpty())
405 return NULL;
406 return SResLoadFromFile::LoadImage(strPath);
407}
408
409IImgX *SResProviderFiles::LoadImgX(LPCTSTR strType, LPCTSTR pszResName)
410{
411 SStringT strPath = GetRes(strType, pszResName);
412 if (strPath.IsEmpty())
413 return NULL;
414 return SResLoadFromFile::LoadImgX(strPath);
415}
416
417size_t SResProviderFiles::GetRawBufferSize(LPCTSTR strType, LPCTSTR pszResName)
418{
419 SStringT strPath = GetRes(strType, pszResName);
420 if (strPath.IsEmpty())
421 return 0;
423}
424
425BOOL SResProviderFiles::GetRawBuffer(LPCTSTR strType, LPCTSTR pszResName, LPVOID pBuf, size_t size)
426{
427 SStringT strPath = GetRes(strType, pszResName);
428 if (strPath.IsEmpty())
429 return FALSE;
430 return SResLoadFromFile::GetRawBuffer(strPath, pBuf, size);
431}
432
433BOOL SResProviderFiles::Init(WPARAM wParam, LPARAM lParam)
434{
435 LPCTSTR pszPath = (LPCTSTR)wParam;
436
437 SStringT strPathIndex = pszPath;
438 strPathIndex += _T(PATH_SLASH);
439 strPathIndex += UIRES_INDEX;
440
441 SXmlDoc xmlDoc;
442 SStringT strFileName;
443 if (!xmlDoc.load_file(strPathIndex, xml_parse_default, enc_auto))
444 return FALSE;
445
446 SXmlNode xmlResource = xmlDoc.root().child(L"resource");
447 if (!xmlResource)
448 return FALSE;
449 SXmlNode xmlType = xmlResource.first_child();
450 while (xmlType)
451 {
452 SStringT strType = S_CW2T(xmlType.name());
453 SXmlNode xmlFile = xmlType.child(L"file");
454 while (xmlFile)
455 {
456 SResID id(strType, S_CW2T(xmlFile.attribute(L"name").value()));
457 SStringT strFile = S_CW2T(xmlFile.attribute(L"path").value());
458#if !defined(_WIN32)
459 strFile.ReplaceChar(_T('\\'), _T('/'));
460#endif
461 //再次Init时会因为此行代码导致资源无法加载
462 // if(!m_strPath.IsEmpty())
463 // strFile.Format(_T("%s\\%s"),(LPCTSTR)m_strPath,(LPCTSTR)strFile);
464 m_mapFiles[id] = strFile;
465 xmlFile = xmlFile.next_sibling(L"file");
466 }
467 xmlType = xmlType.next_sibling();
468 }
469#ifdef _WIN32
470 TCHAR szFullPath[1025];
471 GetFullPathName(pszPath, 1024, szFullPath, NULL);
472 m_strPath = szFullPath;
473#else
474 m_strPath = pszPath;
475#endif //_WIN32
476 return TRUE;
477}
478
479BOOL SResProviderFiles::HasResource(LPCTSTR strType, LPCTSTR pszResName)
480{
481 SStringT resPath = GetRes(strType, pszResName);
482 return !resPath.IsEmpty();
483}
484
485void SResProviderFiles::EnumResource(EnumResCallback funEnumCB, LPARAM lp)
486{
487 SPOSITION pos = m_mapFiles.GetStartPosition();
488 while (pos)
489 {
490 SResID id = m_mapFiles.GetNextKey(pos);
491 if (!funEnumCB(id.szName, id.szType, lp))
492 break;
493 }
494}
495
496void SResProviderFiles::EnumFile(THIS_ EnumFileCallback funEnumCB, LPARAM lp)
497{
498 _EnumFile(NULL, funEnumCB, lp);
499}
500
501void SResProviderFiles::_EnumFile(LPCTSTR pszPath, EnumFileCallback funEnumCB, LPARAM lp)
502{
503#ifdef _WIN32
504 WIN32_FIND_DATA wfd;
505 SStringT strFilter;
506 if (pszPath)
507 strFilter = m_strPath + _T("\\") + pszPath + _T("\\*.*");
508 else
509 strFilter = m_strPath + _T("\\*.*");
510 HANDLE hFind = FindFirstFile(strFilter.c_str(), &wfd);
511 if (hFind != INVALID_HANDLE_VALUE)
512 {
513 do
514 {
515 SStringT strPath;
516 if (pszPath == NULL)
517 strPath = wfd.cFileName;
518 else
519 strPath = SStringT().Format(_T("%s\\%s"), pszPath, wfd.cFileName);
520 if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
521 {
522 if (_tcscmp(wfd.cFileName, _T(".")) == 0 || _tcscmp(wfd.cFileName, _T("..")) == 0)
523 continue;
524 _EnumFile(strPath.c_str(), funEnumCB, lp);
525 }
526 else if (wfd.dwFileAttributes & (FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_READONLY))
527 {
528 if (!funEnumCB(strPath.c_str(), lp))
529 break;
530 }
531 } while (FindNextFile(hFind, &wfd));
532 FindClose(hFind);
533 }
534#else
535 DIR *dir;
536 struct dirent *entry;
537
538 SStringT strFilter;
539 if (pszPath)
540 strFilter = m_strPath + _T("/") + pszPath;
541 else
542 strFilter = m_strPath;
543
544 dir = opendir(pszPath); // 替换为需要枚举的文件夹路径
545 if (dir == NULL)
546 {
547 return;
548 }
549
550 while ((entry = readdir(dir)) != NULL)
551 {
552 SStringT strPath;
553 if (pszPath == NULL)
554 strPath = entry->d_name;
555 else
556 strPath = SStringT().Format(_T("%s\\%s"), pszPath, entry->d_name);
557 if (entry->d_type & DT_DIR)
558 {
559 if (_tcscmp(entry->d_name, _T(".")) == 0 || _tcscmp(entry->d_name, _T("..")) == 0)
560 continue;
561 _EnumFile(strPath.c_str(), funEnumCB, lp);
562 }
563 else if (entry->d_type & DT_REG)
564 {
565 if (!funEnumCB(strPath.c_str(), lp))
566 break;
567 }
568 }
569
570 closedir(dir);
571#endif //_WIN32
572}
573
574SNSEND
资源标识符类
Definition SResID.h:15
static HBITMAP LoadBitmap(LPCTSTR pszFileName)
Loads a bitmap from a file.
static size_t GetRawBufferSize(LPCTSTR pszFileName)
Retrieves the size of the raw buffer for a file.
static BOOL GetRawBuffer(LPCTSTR pszFileName, LPVOID pBuf, size_t size)
Retrieves the raw buffer for a file.
static IBitmapS * LoadImage(LPCTSTR pszFileName)
Loads an image from a file as an IBitmapS object.
static IImgX * LoadImgX(LPCTSTR pszFileName)
Loads an image from a file as an IImgX object.
static HICON LoadIcon(LPCTSTR pszFileName, int cx=0, int cy=0)
Loads an icon from a file.
static HCURSOR LoadCursor(LPCTSTR pszFileName)
Loads a cursor from a file.
static IImgX * LoadImgX(LPVOID pBuf, size_t size)
Loads an image from a memory buffer as an IImgX object.
static IBitmapS * LoadImage(LPVOID pBuf, size_t size)
Loads an image from a memory buffer.
HBITMAP LoadBitmap(LPCTSTR pszResName) OVERRIDE
Loads a bitmap resource.
BOOL HasResource(LPCTSTR pszType, LPCTSTR pszResName) OVERRIDE
Checks if a resource exists.
HICON LoadIcon(LPCTSTR pszResName, int cx, int cy) OVERRIDE
Loads an icon resource.
SResProviderFiles()
Constructor.
IBitmapS * LoadImage(LPCTSTR pszType, LPCTSTR pszResName) OVERRIDE
Loads an image resource as an IBitmapS object.
void EnumFile(EnumFileCallback funEnumCB, LPARAM lp) OVERRIDE
Enumerates files in the resource provider.
BOOL GetRawBuffer(LPCTSTR pszType, LPCTSTR pszResName, LPVOID pBuf, size_t size) OVERRIDE
Retrieves the raw buffer for a resource.
IImgX * LoadImgX(LPCTSTR pszType, LPCTSTR pszResName) OVERRIDE
Loads an image resource as an IImgX object.
HCURSOR LoadCursor(LPCTSTR pszResName) OVERRIDE
Loads a cursor resource.
SStringT GetRes(LPCTSTR strType, LPCTSTR pszResName)
Retrieves the resource path for a given type and name.
void _EnumFile(LPCTSTR pszPath, EnumFileCallback funEnumCB, LPARAM lp)
Enumerates files in a specified path.
size_t GetRawBufferSize(LPCTSTR pszType, LPCTSTR pszResName) OVERRIDE
Retrieves the size of the raw buffer for a resource.
void EnumResource(EnumResCallback funEnumCB, LPARAM lp) OVERRIDE
Enumerates resources of a specific type.
BOOL Init(WPARAM wParam, LPARAM lParam) OVERRIDE
Initializes the resource provider.
const wchar_t * value() const
Gets the attribute value.
Definition SXml.cpp:90
Implementation of IXmlDoc.
Definition SXml.h:912
SXmlNode root() const
Retrieves the root node of the document.
Definition SXml.cpp:754
bool load_file(const char *path, unsigned int options=xml_parse_default, XmlEncoding encoding=enc_auto)
Loads the document from a file (ANSI version).
Definition SXml.cpp:714
Class representing an XML node.
Definition SXml.h:352
SXmlNode next_sibling() const
Gets the next sibling node in the children list of the parent node.
Definition SXml.cpp:393
SXmlNode first_child() const
Gets the first child node of the node.
Definition SXml.cpp:383
const wchar_t * name() const
Gets the name of the node.
Definition SXml.cpp:363
SXmlAttr attribute(const wchar_t *name, bool bCaseSensitive=false) const
Gets the attribute with the specified name.
Definition SXml.cpp:428
SXmlNode child(const wchar_t *name, bool bCaseSensitive=false) const
Gets the child node, attribute, or next/previous sibling with the specified name.
Definition SXml.cpp:423
Bitmap object interface.
Definition SRender-i.h:420
HRESULT LoadFromMemory(LPBYTE pBuf, size_t szLen) PURE
Loads the bitmap from memory.
HRESULT LoadFromFile(LPCTSTR pszFileName) PURE
Loads the bitmap from a file.
long Release() PURE
Decrements the reference count for the object.
Interface for image data.
int LoadFromFileA(LPCSTR pszFileName) PURE
Load image data from a file (ANSI encoding).
int LoadFromMemory(void *pBuf, size_t bufLen) PURE
Load image data from a memory buffer.
int LoadFromFileW(LPCWSTR pszFileName) PURE
Load image data from a file (Unicode encoding).
long Release() PURE
Decrement the reference count.