http://www.newton-inc.com/dev/techinfo/qa/qa.htm
MakeBitmap
and copy data into the bitmap.GetPICTAsBits
). If you want to create bitmaps dynamically at compile time, you can create a simple bitmap object with the following format.{
bounds: <bounds frame>,
bits: <raw bitmap data>,
mask: <raw bitmap data for mask - optional>
}
Binary object <raw bitmap data> - class 'bits
bytes data-type descr
0-3 long ignored
4-5 word #bytes per row of the bitmap data
(must be a multiple of 4)
6-7 word ignored
8-15 bitmap rectangle - portion of bits to use--see IM I
8-9 word top
10-11 word left
12-13 word bottom
14-15 word right
16-* bits pixel data, 1 for "on" pixel, 0 for off
MakeBitmap
global function, use the GetShapeInfo
function to get the bitmap and other slots required to interpret the meaning of the bitmap created by MakeBitmap
. GetShapeInfo
or the following slots for images created by other applications, images stored in the Newton ROM, images created with functions other than MakeBitmap
, nor images with a depth other than 1.MakeBitmap
of depth
1, the return value of GetShapeInfo
contains frame with information you can use to interpret the bitmap data.bits
slot referencing the bitmap data for the bitmap. This bitmap data can be manipulated at run time (or copied for non-Newton use), using other slots in the return value of GetShapeInfo
to interpret the bitmap binary object: scanOffset
, bitsBounds
, and rowBytes
. For instance, the first bit of the image created with MakeBitmap
can be obtained with code like: bitmapInfo := GetShapeInfo(theBitmap);
firstByte := ExtractByte(bitmapInfo.bits, bitmapInfo.scanOffset);
firstBit := firstByte >> 7; // 1 or 0, representing on or off
rowBytes
will always be 32-bit aligned. For instance, for a bitmap with a bitsBounds
having width 33 pixels, rowBytes
will be 8 to indicate 8 bytes offsets per horizontal line and 31 bits of unused data at the end of every horizontal line.