beautypg.com

Making copybits scale its output bitmap 13, Storing compressed pictures and bitmaps 13, Capturing a portion of a view into a bitmap 13 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 544

background image

C H A P T E R 1 3

Drawing and Graphics

13-18

Using the Drawing Interface

Making CopyBits Scale Its Output Bitmap

13

CopyBits

uses the bounds of the bitmap passed to it to scale the bitmap that it

draws; so, by changing the bounds of the bitmap passed to

CopyBits

, you can

make this method scale the bitmap it draws. If you want to scale the output bitmap
without changing the bounds of the original, call

ScaleShape

on a clone of the

original bitmap and pass the modified clone bitmap to the

CopyBits

method.

Storing Compressed Pictures and Bitmaps

13

NTK supports limited compression of pictures and bitmaps. If you store your
package compressed (using the “optimize for space” setting), all items in your
package are compressed in small (approximately 1 KB) pages, rather than object
by object.

You can use the NTK compile-time function

GetNamedResource

to get a

Macintosh PICT resource that can be drawn on the Newton in a view of the

clPictureView

class. PICT resources are generally smaller than bitmap

frames because each bitmap within the PICT resource contains compressed
bitmap data.

Note

This information applies to the Mac OS version of NTK; the
Windows version differs. See the Newton Toolkit User’s Guide
for details.

Capturing a Portion of a View Into a Bitmap

13

Use the

ViewIntoBitmap

method to capture a portion of a specified view into a

specified bitmap. This function does not provide scaling capability, although
scaling can be accomplished by passing the

destBitmap

bitmap returned by this

method to the

DrawIntoBitmap

function as the value of its

shape

parameter.

Figure 13-10 shows the relationships between the view to be captured, the source
rectangle, the destination bitmap, and the destination rectangle.