Re: [NTLK] Structure of a Bitmap when passed to C

From: Simon Bell (simonbell_at_mac.com)
Date: Fri Jul 08 2005 - 03:41:46 PDT


On 8 Jul 2005, at 4:59 am, Matthew Hudson wrote:

> Is there class information at the beginning of the bitmap object and
> if so - what is the structure of that?

Depends what you mean by 'the bitmap object'.

The structure returned by MakeBitmap is a NewtonScript frame:

{
        class: 'bitmap,
        bounds: <boundsrect, length 8>,
        data: <pixels, length xxx>,
        colordata: nil,
        mask: nil
}

The data slot is a binary object containing a PixelMap, which is
probably what you want to mess with in C. A PixelMap is a classic
QuickDraw structure, adapted slightly for Newton, and defined in
NewtQD.h (which is in one of the DDKs, but I can't remember which):

typedef struct
{
        Ptr baseAddr;
        short rowBytes; // pads to long
        short reserved1;
        Rect bounds;
        ULong pixMapFlags;
        Point deviceRes; // resolution of input device (0 indicates
kDefaultDPI)
#if defined(QD_Gray)
        UChar * grayTable; // gray tone table
#endif
} PixelMap;

For sample code, check out my Image Stationery, which deals extensively
with bitmaps, at homepage.mac.com/simonbell/framework

If you'd like to send me code snippets (probably better off-list) I
could try to help you with this.

Simon

-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
Official Newton FAQ: http://www.chuma.org/newton/faq/
WikiWikiNewt for all kinds of articles: http://tools.unna.org/wikiwikinewt/


This archive was generated by hypermail 2.1.5 : Fri Jul 08 2005 - 08:00:02 PDT