Pattern Editor, Resedit: How to Create New Pattern (32468)






This article was previously published under Q32468

SUMMARY

The Pattern Editor program on the BASIC released disk can be used to create a pattern to determine its hexadecimal (hex) representation. The hex representation of the pattern can then be loaded into an array to use with the various pattern toolbox routines. The Pattern Editor does not write patterns in a program's resource fork.

The Save and New options are always dimmed and cannot be selected. They appear on the screen and may be implemented in the future; however, these options are currently inactive.

To store a pattern in the resource fork of a program, you can use the Resedit application, as described below.

MORE INFORMATION

To create a pattern using Resedit, do the following:
  1. Create a resource called PAT using the New option on the File menu if the PAT resource is not already present for the file.
  2. Open the PAT resource and select New on the File menu to bring up a blank window.
  3. Create your pattern by clicking in the center portion of the window. Clicking will toggle points in the window that represent an 8-byte pattern.
  4. The pattern's identification number can be changed by doing a Get Info on the File menu and changing the value in the ID field.
The following program loads a pattern (which was added to the resource fork of a program by Resedit) and fills a rectangle with the pattern:

   ref% = system(7)    'Sets reference number to current file
   id% = 1
   DIM pat%(3)
   DIM rect%(3)
   SetRect rect%(0),10,10,120,120
   LoadPattern ref%, id%, pat%(0)     ' Retrieves pattern into array.
   CALL FILLRECT(VARPTR(rect%(0)),VARPTR(pat%(0)))     ' Uses array.
				

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB32468