This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Bitmap Resource in a LIB


Bitmap Resource in a LIB

Postby ppcStudios » Dec 19, 2003 @ 3:22am

I have built a static lib of my RaptureEngine. Within the project I have a resource file which contains a watermark image, so when the library is built this image is supposed to be embedded within it. I then load this bitmap onto a surface and draw it as needed.

The only problem is that CreateSurface() can't locate the bitmap resource. I'm not 100% positive that the resource is even being included in the library even though VC says it is compiling the resources. Has anyone tried doing this before? I did a Google search and only came up with one thread pertaining to the problem, but it had no resolution. Is there any way to make this work?
G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby fzammetti » Dec 19, 2003 @ 4:10am

Well, this of course isn't the answer your looking for, but thinking in work-around mode...

Could you store your bitmap in an array and during initialization plot it onto a surface? Then just use that surface as you had previously intended to use your watermark surface?

If it's a 256-color image, your just talking about storing an int for each pixel referencing an entry in another array, your palette. Then just plot each point and off you go. A slight delay at startup, but nothing severe. Shouldn't take up much more memory than incorporating a bitmap anyway, even including the extra little bit of code.

Like I said, not the "right" answer, but it might do the trick. As an added bonus, it should make it slightly harder for someone nefarious to change or remove your watermark.
...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby gersen » Dec 19, 2003 @ 4:27am

I'm pretty sure that you can't include in a .lib a resource file. All the resources are related with exe and dll file format so simply it can't be included in a .lib.

As fzammetti have said you can convert a bitmap in an array and then load it with the
CreateSurface(DWORD dwFlags, BYTE* pImageFileMem, DWORD dwImageFileSize);
passing the array pointer as the pImageFileMem.
For the conversion you can use a tool that I have used thousand of times when I have programmed the gba http://www.devrs.com/gb/files/b2x.zip
With this little app you can convert a file to a C statements. You can convert directly a .png (or the graph format you want) in a static C array and include it on your .lib. Then you can load it with the CreateSurface... oh, I have written this part before :)
User avatar
gersen
pm Member
 
Posts: 147
Joined: Oct 19, 2002 @ 8:40am
Location: Italy


Postby ppcStudios » Dec 19, 2003 @ 4:28am

Actually, I thought of that as an option. I was hoping to keep things simple and find a solution to why the bitmap resource doesn't appear to be included in the lib, but if I can't resolve it pretty quickly I'll probably fall back to this idea.

I noticed one of the CreateSurface interfaces took a BYTE * to the image data. I may explore that avenue further.

edit: Thanks Frank and Thomas!
G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby ppcStudios » Dec 19, 2003 @ 4:37am

Thomas: That's a pretty slick little program! Do you know if any data needs to be stripped out of the resulting array to work with CreateSurface?
G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby gersen » Dec 19, 2003 @ 4:45am

No, you can use it as it is with CreateSurface. I love that little program :D
User avatar
gersen
pm Member
 
Posts: 147
Joined: Oct 19, 2002 @ 8:40am
Location: Italy


Postby ppcStudios » Dec 19, 2003 @ 4:56am

I didn't have much luck the first time around. The image was just a huge black block. Do I need to specify to generate 16 bit values?
G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby ppcStudios » Dec 19, 2003 @ 5:02am

Never mind. I figured it out =)

It appears to work perfectly!
G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby gersen » Dec 19, 2003 @ 5:22am

Now we are all waiting for the release of your Rapture Engine :D
User avatar
gersen
pm Member
 
Posts: 147
Joined: Oct 19, 2002 @ 8:40am
Location: Italy


Postby ppcStudios » Dec 19, 2003 @ 5:24am

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby ppcStudios » Dec 19, 2003 @ 5:26am

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby Johan » Jan 3, 2004 @ 12:45pm

Johan Sanneblad, M.Sc, Ph.D
GapiDraw Systems Architect
[]
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby ppcStudios » Jan 3, 2004 @ 12:55pm

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby mlepage » Jan 3, 2004 @ 7:08pm

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby abiemann » Jul 11, 2004 @ 9:20pm

abiemann
pm Member
 
Posts: 73
Joined: Jul 9, 2004 @ 11:26pm


Next

Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron