Newton Developer Technical Support Sample Code
Bitmap, bitmap transform sample
by Bob Ebert & J. Christopher Bell, Newton Developer Technical Support
Copyright ©1995 Apple Computer, Inc.  All rights reserved.

You may incorporate this sample code into your applications without
restriction.  This sample code has been provided "AS IS" and the
responsibility for its operation is 100% yours.  You are not
permitted to modify and redistribute the source as "DTS Sample Code."
If you are going to re-distribute the source, we require that you
make it clear in the source that the code was descended from
Apple-provided sample code, but that you've made changes.


This example shows the basics of manipulating bitmap objects on the Newton.

The New button simply creates new contents of the original bitmap.

The Transform Once view shows what happens when the selected transform 
is applied to the original.

The Transform Again view cumulatively applies the selected transform.

The meat of the sample is in the function DoTransform in the base view.
This is where all the bitmap manipulations are done.  Rotations are simply
calls to MungeBitmap.  Transforms are done by applying either the offset
or scale transform to a bitmap, creating a new bitmap that is drawn.

An alternate method for doing repeated transforms (not demonstated in this
sample) would be to have the transform applied when the shape is actually
drawn, inside the "once" and "again" views.  To accomplish the multiple
transform effect for the "again" you could nest the transform styles.

For example, the following call to drawshape will apply both the scaling
transform and the offset transform to the shape:

DrawShape([ {transform: [5, 5]},
		   [ {transform: [RelBounds(0,0,10,10), RelBounds(0,0,20,20)]},
		    shape
		  ]], nil);
