You are currently offline, waiting for your internet to reconnect

Making PICT Resource with PICTURE$ Picture and SavePicture

This article was previously published under Q43021
This article has been archived. It is offered "as is" and will no longer be updated.
There are two routines you can use to write a picture to the resourcefork of a file: SavePicture and AddPicture.

This article describes how to use SavePicture to save an image as aPICT resource that was recorded in the QuickDraw string format usingthe PICTURE ON and PICTURE OFF statements.

An alternate method is to record the picture as a bitmap withOpenPicture and ClosePicture, and save it as a PICT resource with theAddPicture routine. For more information, query in this Knowledge Baseon the following words:
OpenPicture AddPicture
You can record a picture as a string of QuickDraw calls with thePICTURE ON and PICTURE OFF statements. This string can be translatedto a picture with the PICTURE$ function and written to the resourcefork of a file with SavePicture. SavePicture is an MBLC routine thatis built into QuickBASIC.

Once you save the picture in the resource fork of a file, you can useResEdit or a BASIC program to move it to the resource fork of anotherfile or application. (However, this QuickDraw string format will notbe viewable in ResEdit.) You can retrieve the picture into a stringvariable with the LoadPicture routine, and redraw it with QuickBASIC'sPICTURE statement.

Code Example

'  Example of how to save a picture saved as a string'  to the resource fork of a file'  Open a file to hold your resource:ref% = 0OpenResFile "circle",ref%'  Draw your picture:PICTURE ON    ' Turn on recording of picture  CALL SHOWPEN   ' Turns on screen pen to see drawing while recording  CIRCLE (100,100),25  ' Any drawing statements go herePICTURE OFF   ' Turn off recording of pictureimage$ = picture$  'Retrieve picture string stored as QuickDraw calls'  Place the finished picture in the resource fork of the file:id% = 1SavePicture ref%,id%,image$CloseResFile ref%				

Article ID: 43021 - Last Review: 02/27/2014 20:59:35 - Revision: 1.2

  • kbnosurvey kbarchive KB43021