Thanks Logan.
I used the rowBytes in place of the width and it works !!

Aryeh


----- Original Message ----- 
From: "Logan Shaw" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Thursday, December 16, 2004 8:12 AM
Subject: Re: Bitmap


> [EMAIL PROTECTED] wrote:
> > 1. I know we can request the current screen and get them saved to a
> > bitmap ,this is for full screen  but can I request for only part of the
> > screen by specifying the co-ordinates?
>
> If you just want to save if, use WinSaveBits().  It takes a
> RectangleType pointer as an argument.
>
> > Is it possible to with any direct
> > API s that are available  or how this can be done?
> >
> > 2.I want to compare a saved bitmap with another bitmap, any fast and
> > straight way to do this???
>
> Haven't done it, but you should be able to do this:
>
> Create both bitmaps yourself with BmpRsrcCreate().  Make them both
> the same format.  16-bit should be good, but you may also want to
> key off the screen format if they are both coming from the screen.
>
> Then use WinCreateBitmapWindow() to turn them both into a window.
> Copy from wherever (such as the draw window) to the bitmaps using
> WinCopyRectangle().
>
> Now, to compare them, you can access the internals of the bitmap
> since you have use BmpRsrcCreate() to create them and know that
> they are not in some weird system format.  So, use BmpGetBits()
> to get a pointer to the pixel data and BmpGetDimensions() to
> find out the bytes per row, then use your knowledge of the pixel
> format (since you specified it when creating the bitmap) to
> compare the relevant bytes on each row.  You could just MemCmp()
> the whole entire pixel data, but there is no guarantee that there
> aren't unused bytes (or at least bits) between rows that might
> be filled with random garbage.  (In other words, rowbytes doesn't
> necessarily equal 2 * bitmapwidth for all 16-bit bitmaps, and
> it certainly doesn't equal bitmapwidth / 2 for all 4-bit bitmaps,
> especially if bitmapwidth is an odd number!)
>
>   - Logan
>
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


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

Reply via email to