This source file includes following definitions.
- BF_GUI_GetBitmapFromResources
1 #include <Resources.h>
2 #include <Bitmap.h>
3 #include <stdlib.h>
4 #include "BF_GUI_Misc.h"
5 #include "Main.h"
6
7 void
8 BF_GUI_GetBitmapFromResources( BBitmap*& themap, int32 resid)
9 {
10
11 BResources res;
12 status_t err;
13
14 size_t reslength;
15 const char * resbuf;
16 BMessage archive;
17
18
19 BFile file( poApp->AppFileName().String(), B_READ_ONLY );
20
21
22 if ( (file.InitCheck() || (err = res.SetTo(&file)) ) == B_NO_ERROR ) {
23
24
25 resbuf = (char*)res.LoadResource( B_ANY_TYPE, resid, &reslength );
26
27 if( resbuf ) {
28
29
30 archive.Unflatten( resbuf );
31 themap = new BBitmap( &archive );
32
33 } else {
34 (new BAlert("", "Error while reading resource from file.", "OK"))->Go();
35 }
36
37 } else {
38 (new BAlert("", "Error opening resource file.", "OK"))->Go();
39 exit(1);
40 }
41 }