Hi,
you need to call both BmpDelete(bmpV2) and BmpDelete(bmpV3) to free
the headers you've created with BmpCreate and BmpCreateBitmapV3. If
you delete only one of them you will delete its header and bmpbits
but you will still have the other header (structure).
--- In [EMAIL PROTECTED], "Jan Slodicka" <[EMAIL PROTECTED]>
wrote:
> Hi
>
> I would like to know a bit more what's going on in the bitmap
conversions.
> Take following code excerpt:
>
> bmpV2 = BmpCreate( width, height, 16, NULL, &error );
> dataV2 = BmpGetBits( bmpV2 );
> bmpV3 = (BitmapPtr) BmpCreateBitmapV3( bmpV2, kDensityDouble,
dataV2,
> NULL );
> dataV3 = BmpGetBits( bmpV3 );
>
> While debugging, I discovered that dataV2 == dataV3 (they both
point to the
> same location).
>
> Can I assume that:
> 1. I don't need to free the bmpV2 bitmap (using BmpDelete), since
doing so
> would free the dataV2 and thus dataV3, too.
> (When I deleted the bmpV2 bitmap (using BmpDelete), but I
continued to
> use the bmpV3 bitmap, the image data got sometimes corrupted.)
> 2. BmpDelete( bmpV3 ) deletes the image data correctly.
> 3. The bmpV2 header will be freed, either in BmpCreateBitmapV3, or
> BmpDelete( bmpV3 ).
>
> Would be great if somebody could answer that. The official
documentation
> does not reveal much...
>
> Jan Slodicka
>
> ----- Original Message -----
> From: "Aaron Ardiri" <[EMAIL PROTECTED]>
>
>
> >
> > this is what we do in lemmings for example:
> >
> > ---
> > if (DeviceSupportsVersion(romVersion3_5))
> > {
> > globals.drawBitmap =
> > BmpCreate(WIDTH, HEIGHT, globals.scrDepth, NULL, &err);
> > if (err == errNone)
> > {
> > // high density device
> > if (globals.palmHD.device)
> > {
> > globals.drawBitmapV3 =
> > BmpCreateBitmapV3(globals.drawBitmap,
> > globals.palmHD.density,
> > BmpGetBits(globals.drawBitmap), NULL);
> > err = (globals.drawBitmapV3 == NULL);
> > if (err == errNone)
> > globals.drawWindow =
> > WinCreateBitmapWindow((BitmapType *)
globals.drawBitmapV3,
> &err);
> > }
> > else
> > globals.drawWindow =
> > WinCreateBitmapWindow(globals.drawBitmap, &err);
> > }
> > }
> > else
> > globals.drawWindow =
> > WinCreateOffscreenWindow(WIDTH, HEIGHT, screenFormat, &err);
> > err |= (Boolean)(globals.drawWindow == NULL);
> >
> > ---
> >
> > that will give you a window. which, you can then copy using
> > WinCopyRectangle() i know this technique works on *ALL* devices,
> > including 68k palm, sony hires, handera and the palm hires
devices.
> >
> > ---
> > Aaron Ardiri [EMAIL PROTECTED]
> > CEO - CTO +46 70 656
1143
> > Mobile Wizardry
http://www.mobilewizardry.com/
> >
> >
> > --
> > 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/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/