Adding Patterns and Gray Tones to the Fill Tool
To add patterns or gray tones to the fill pattern palette, use the *RegPatterns
method of the Draw application's viewDef. This method takes two arguments, a uniquely identifying symbol and an array of patterns. This array can contain any of thekRGB_GrayXX
gray tone constants, a packed RGB integer (as returned by *PackRGB
), or a pattern, gray pattern, or dithered pattern. For information on these values see "Specifying Shades of Gray" and "Using Patterns, Gray Patterns, and Dithered Patterns". The viewDef contains a *UnRegPatterns
method to remove patterns from the fill palette.Patterns are usually added in an auto part package. The sample code below shows the full content of a text file that creates such an auto part.
Listing 2-2 Adding to the Draw application's fill tool
DefineGlobalConstant( 'kCheckeredPattern,
MakeBinaryFromHex ("F0F0F0F00F0F0F0F",'pattern)
InstallScript := func (partFrame, removeFrame)
begin local viewDef := GetViewDefs('drawPaper).default; local sym := EnsureInternal(kAppSymbol); local pats := [ kRGB_Gray6, vfGray, kCheckeredPattern, { class :'ditherPattern, pattern : vfLtGray, foreground: kRGB_Gray2, background: kRGB_GrayD, } ]; if viewDef then viewDef:RegPatterns(sym, pats) end; RemoveScript := func (removeFrame) begin local viewDef := GetViewDefs('drawPaper).default; if viewDef then viewDef:UnRegPatterns(kAppSymbol); end;
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help