I have sent it to you. Let me know if this works. The function you want is:

void DrawBitmap(UInt16 x, UInt16 y, UInt16 id)
{
    MemHandle h;
    BitmapPtr p;
        
    h = DmGet1Resource(bitmapRsc, id);
    if (h != NULL) {
        p = (BitmapPtr) MemHandleLock(h);

        WinDrawBitmap(p, x, y);
        MemHandleUnlock(h);
        DmReleaseResource(h);
    }
}

Note that this function will pull a bitmap from the program's *.prc file and draw it a coordinates x, y. You need to know the id of the bitmap. It should be the resoruce id, the number found next to the bitmap (or bitmap family) in Constructor. I do not store the resource bitmap, since it is already in a resource. I simply draw it to the screen.

BTW you need a colored simulator, emulator, or palm to run this, else change the code that checks for the colored device feature in the AppStart() function. Hope this helps and you can code this alright.

I hope the helps. The algorithm for reading a windows bitmap from the SD card or a *.pdb is different. You will want different code for that. I had enough trouble getting this working, but I have code in another program that will capture from the screen and save the result to a windows bitmap. The problem is, the conversion processing is done in hotsync, not on the handheld. I do not have that code at home, so it may take a few days to get it.

As long as the bitmap is created in the prc file in constructor, the above code will work. If not, email me back for something different. The other code is not easy and I recall having crashed the poor little m515 I ran it on (over and over) while doing it.


Benjamin


luis maldonado wrote:
hello Ben,
By all means please mail me the bitmap program to luis.maldon...@hotmail.com <mailto:luis.maldon...@hotmail.com> Thank you much, I'm looking forward to it.... Luis.

> Date: Mon, 9 Mar 2009 18:38:09 -0500
 > From: britt...@mchsi.com
 > Subject: Re: Copying Tbmp/tAIB resources -- not working?
 > To: palm-dev-forum@news.palmos.com
 >
 > With your permission, I will e-mail you a program that reads a whole
 > bunch of bitmap resources and displays it to the screen. If you look at
 > my website, it is the Set game. Each card is a separate bitmap resource.
 > I will e-mail you the source code if you ask.
 >
 > Benjamin
 > http://writerbenjamin.com
 >
 > luis maldonado wrote:
 > > Hi everyone,
 > >
 > > wouldn't it be nice if some of who have already solved the bitmap
 > > processing problem to give us newbies a bit of help and show use
 > > some sample code that:
 > >
 > > 1) gets the ENTIRE header
 > > 2) the BITMAP bits
 > > 3) show the BITMAP on the device.
 > >
 > > 4) differences between low res and hi res bitmaps....
 > >
 > > the OS has been deemed as a deas OS and we're still asking for help on
 > > how to display BITMAPS....
 > >
 > > searching the web is no help.....
 > >
 > > anywho, just a thought....
 > >
 > > Luis
 > >
 > >
 > > > Date: Fri, 27 Feb 2009 08:49:12 +0100
 > > > From: michal.sel...@visicom.sk
 > > > Subject: Re: Copying Tbmp/tAIB resources -- not working?
 > > > To: palm-dev-forum@news.palmos.com
 > > >
 > > > the safest would be to use BmpGetSizes to obtain size of header and
 > > size of data
> > > so you will know how much you need to store. and as others wrote, you are > > > caching only (incomplete) header in your code, use BmpGetBits to get data
 > > >
 > > > Ryan Rix wrote:
 > > > > Hey guys,
 > > > >
 > > > > I am writing code to dynamically draw icons for an application
 > > launcher.
> > > > I am using a linked list to store all of the entries of the launcher,
 > > > > which include both tAIB resource bitmaps (which are just BitmapType
> > > > written to a resource, right?) and generic BitmapTypes, all stored as
 > > > > pointers in my node structure as a BitmapPtr icon.
 > > > >
 > > > > When I attempt to copy the resource to a static location in memory
 > > using
 > > > >
 > > > > newLink->icon=MemPtrNew( sizeof(BitmapType));
 > > > > DmOpenRef ref=DmOpenDatabase(cn,id,dmModeReadWrite);
 > > > > MemHandle h = DmGetResource( 'tAIB', 1000 );
 > > > > if(h){
 > > > > BitmapPtr oldIcon = MemHandleLock(h);
 > > > > MemMove(newLink->icon, oldIcon, sizeof(BitmapType));
 > > > > MemHandleUnlock(h);
 > > > > }else{
 > > > > newLink->icon=NULL;
 > > > > }
 > > > > DmReleaseResource(h)
 > > > >
 > > > > I usually get crap written to the BitmapPtr and when I draw it with
> > > > WinDrawBitmap I usually get either a crash or just crap drawn to the
 > > > > screen, I've yet to get a working icon.
 > > > > Does anyone have a clue why my code keeps crapping out like this?

--
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to