Mildred a shark
Professional

MBitmapPtr is a useful function in its own right but has been included in the c2p section of the manual because it is of particular use for providing the `Chunky' parameter of Mc2p. Using MBitmapPtr you can return an address that has been calculated based on one of Mildred's Bitmap objects.

At its simplest, the routine will take the base address of the Bitmap's data. It will check if `wrapping' is active (see the relevent section of the manual) and if so will add the Bitmap's Origin coordinate position to the base address. Then it will check if `clipping' is active (see the relevent section of the manual), and if so it will add the Bitmap's clip window top-left corner coordinate position to the base address. This final address will then be returned and can be used mainly as the Chunky.l address required by Mc2p.

In its more sophisticated form, the routine can also take additional Xoffset and Yoffset coordinates, produce an address offset from them and add this also to the base address. Using this on its own you can position the topleft corner of the chunky source data. It's greater use comes when you have a map-tile type display where you need to draw tiles to the nearest 16 or 32 pixels, for example, by using the Bitmap's Origin `wrapping' (see the relevent section of the manual). It would be inefficient to specify an aligned origin for the drawing of tiles and then an unaligned origin for the c2p conversion, so Xoffset and Yoffset can be used to provide values between 0-15, or 0-31 for example, to allow finetuning of the scroll position.

If you do not specify a chunky Bitmap object to use, the routine will assume the currently used Bitmap object and base its calculations on that instead.

Possible syntax:
MBitmapPtr ( BitmapNum.w )


MBitmapPtr ( Xoffset.w, Yoffset.w )

MBitmapPtr ( Xoffset.w, Yoffset.w, BitmapNum.w )

Returns:
ChunkyAddress.l


BitmapNum.w
---- This is the number of a previously created chunky Bitmap object. This should be numbered from 0 to the total number of objects minus 1. Calculations will be based on the base address of this Bitmap's data. If this parameter is omitted, the currently used Bitmap will be assumed.

Xoffset.w ---- Xoffset is a horizontal coordinate offset to be added to the position of the source data once other calculations have been completed. If omitted, the offset simply won't be added.

Yoffset.w ---- Yoffset is a verticle coordinate offset to be added to the position of the source data once other calculations have been completed. If omitted, the offset simply won't be added.


ChunkyAddress.l ---- MBitmapPtr is a function and will return a longword address representing the location of some chunky-graphics data in memory.

a shark