Apple Newton Utilities Uživatelská příručka Strana 547

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 942
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 546
CHAPTER 13
Drawing and Graphics
Using the Drawing Interface 13-21
You can also use MakePict:
myText := MakePict([{penpattern: 0, font: ...}, rect,
{font: ...}, txtshape], {font: ...});
You can set the font in locations with MakePict. In this case the font gets
“encapsulated” into the PICT.
If the
{penpattern} frame was not present in the picture shape, any of the above
places should sufce to set the font.
PICT Swapping During Run-Time Operations 13
To set a default picture for a clPictureView, use NTK’s picture slot editor to set
the
icon slot of the clPictureView. You may select a PICT resource from any
resource le 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
DefConst at compile time in
a text le 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.
DefConst('kPictureAsBitMap,
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.
DefConst('kPictureAsPict,
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
resource!");
// 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.
DefConst('kPictureAsPictBounds,
PictBounds("Ralph", 0, 0));
CloseResFile();
Zobrazit stránku 546
1 2 ... 542 543 544 545 546 547 548 549 550 551 552 ... 941 942

Komentáře k této Příručce

Žádné komentáře