Sara Revell wrote:

> Hi,
> 
> I need a bit of information about scrolling bitmaps.  I know it is possible
> to do this, but my question is, can I also control the placement of the
> bitmap internally, and not just from the pen?  What I mean is, if the
> program is given a co-ordinate for part of the bitmap, it is possible to
> center the image on that co-ordinate?

Sure. It's actually pretty easy. The Palm screen is a 160x160 display.
0,0 is in the upper left-hand corner, 160,160 is in the lower right.
This would make the center 80,80. To center the image on an interest 
point you'd do something like:

RectangleType interestPt;
int winCenterX=80;
int winCenterY=80;
int offsetX,offsetY;
BitmapType *bmap;
MemHandle bmapH;

        interestPt=myGetInterestPoint();
        offsetX = winCenterX - interestPt.topleft.x;
        offsetY = winCenterY - interestPt.topleft.y;                    

        bitmapH = DmGetResource(bitmapRsc,myBitMapID);
        if(bitmapH !=NULL) {            
                bmap = (BitmapPtr) MemHandleLock(bmapH);
                WinDrawBitmap(myBitmapID, offsetX,offsetY);
                MemHandleUnlock(bmapH);
                DmReleaseResource(bmapH);
        }


This will shift your bitmap over the distance between the center and 
your interest point. This should also work for images larger than the
screen itself, but it assumes that you've done any viewport setup you 
need to beforehand. In any case, this should be enough to give you the
general idea.

'dillo


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to