[comp.sys.mac.programmer] Turbo Pascal & PICT files

SORCHARD@cc.utah.edu (10/27/89)

>Does anybody out there know how to get Turbo Pascal to load a PICT
>(or any other graphics format) file and display it. The manual
>says absoluteley nothing about this. Can it be done?
  > Thanx a million ---> Rob

It is easy to call a PICT resource file and draw it to a rectangle on the screen (or off screen).  It requires that you make calls to the Macintosh toolbox, to do this you Turbo Pascal to load the proper Units.  This can be done by calling
{$U-}
{$R Rsrc.file}
uses
  MemTypes, QuickDraw;

The commands to load and draw the PICT file are as follows (See Inside Mac V1, chapter 6):

	PictHandle:= getpicture(SPICT Rsrc NumberS); {function to load a PICT Resource, returns Variable of type PictHandle}
  CloseResFile(SPICT Rsrc NumberS); {Closes resource}
  SetRect(Rect,Left,Top,Right,Bottom); {sets up rectangle to recieve the PICT}
 {Rect is a variable of type Rect: Left,Top,Right,Bottom are integers to define the rectangle.}
  fillRect(Rect,white); {Resets area inside rectangle to white, Optional}
  drawpicture(PicHandle,Rect); {Draws Pict into the Rectangle}

Hope this helps

Steve Orchard
University of Utah
SOrchard@cc.utah.edu