background image
C H A P T E R 1 3
Drawing and Graphics
Using the Drawing Interface
You can also use
myText := MakePict([{penpattern: 0, font: ...}, rect,
{font: ...}, txtshape], {font: ...});
You can set the font in locations with
. In this case the font gets
"encapsulated" into the PICT.
If the
frame was not present in the picture shape, any of the above
places should suffice to set the font.
PICT Swapping During Run-Time Operations
To set a default picture for a
, use NTK's picture slot editor to set
slot of the
. You may select a PICT resource from any
resource file that has been added to your project. The picture will be converted on
the Macintosh from a type 1 or 2 PICT into a bitmap, and stored in your package at
compile time. To change this picture at run time, you need to keep a reference to
each alternate picture or bitmap. This is done using
at compile time in
a text file as follows:
OpenResFile(HOME & "Photos Of Ralph.rsrc");
// Here we convert a PICT 1 or PICT 2 into a BitMap.
// This is what NTK's picture slot editor does.
GetPictAsBits("Ralph", nil));
// Here the picture is assumed to be in PICT 1 format.
// If it is not, the picture will not draw and you may
// throw exceptions when attempting to draw the object.
GetNamedResource("PICT", "Ralph", 'picture));
// Verify this is a Format 1 PICT object!
if ExtractWord('kPictureAsPict, 10) <> 0x1101 then
print("WARNING: Ralph is not a Format 1 PICT
// This is one way to get the picture's bounds
// information. You can also extract it from the
// picture's own bounds rectangle at either compile time
// or run time, by using ExtractWord to construct each
// slot of a bounds frame.
PictBounds("Ralph", 0, 0));
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна