Title Banner

Previous Book Contents Book Index Next

Newton Developer Technical Information: Newton Programmer's Guide: 2.1 OS Addendum /
Chapter 6 - Drawing and Graphics 2.1 / Using Drawing and Graphics in the Newton 2.1 OS


Importing Color PICTs from the Mac OS Version of NTK

You can use the Mac OS version of NTK to import PICTs into your package as either a picture object or as a pix family. The following sections describe what you can do with a picture object or pix families.

Creating Graphic Shapes from Picture Objects

A picture object, sometimes called a Newton PICT, is an object that consists of primitive drawing commands. It is basically the same data structure as a Mac OS PICT. In most cases, a picture object is smaller than a pix family, but may draw slower.

You can incorporate a picture object in your package using the existing NTK functions GetResource and GetNamedResource. Once a picture object has been included in a package you can render it by converting it to a graphic shape. 16 and 32 bit PICTs can only be imported with these two functions. You cannot create a pix family from such a PICT.

There are two ways to transform the picture object into a graphic shape. You can use the existing function *MakeShape, or the new function *PictToShape. These functions use different algorithms to transform the picture object to a shape. *MakeShape returns a single picture shape, which is basically a wrapper around the PICT. *PictToShape on the other hand, returns an array of shapes derived from the PICT's own drawing commands.

Note
The PICT itself could contain either drawing commands, such as "draw a circle here," "fill this rectangle in black," or it could contain bitmap-based data. If the PICT contains drawing commands, *PictToShape creates an array of shapes based on those commands, which is generally a smaller object. However if the PICT contains bitmap-based information, use of these two functions is basically equivalent.

Using Pix Families

You can create a pix family from a PICT by using either the picture slot editor in NTK, or programmatically with the NTK function *MakePixFamily. *MakePixFamily replaces the deprecated function GetPictAsBits. Pix families can be used anywhere bitmaps are allowed. They can be rendered when used as the value of the icon slot of a clPictureView, or in the pickItems array of a popup menu item, etc. A pix family can be drawn directly on the screen with the CopyBits function. You can create a bitmap shape from the pix family with *MakeShape.

The picture slot editor is provided for the icon slot of clPictureViews. It creates a pix family. For more information on this slot editor, see "Picture Slot Editor". The existing NTK function GetPictAsBits, has not been modified, and returns an old-style black and white bitmap. If you want to create a pix family programmatically, you must use the new NTK function *MakePixFamily.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
26 APR 1997



Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help