Synopsis
Loads a pattern file to use in filling regions or histograms.
Syntax
load_fill(patternfile, slot=chips_userfill1)
Description
The function arguments.
Argument | Description |
---|---|
patternfile | The path to a bitmap file, in XBM format, containing the pattern file. |
slot | The pattern slot to use: one of chips_userfill1, chips_userfill2, or chips_userfill3. |
The load_fill command allows the user to load their own pattern file to use in filling regions or histograms. This command is part of the advanced ChIPS module; refer to "ahelp chips" for information. To load the module:
from pychips.advanced import *
User patterns should be specified as a standard .xbm file. Chips uses a 32 x 32 bit pattern for its fill. If an xbm is provided with dimensions smaller that 32 x 32, the pattern is used and the excess bits are padded (appears transparent in the output). If the bit pattern is larger than 32 x 32, the upper left hand 32 x 32 bits of the pattern are used.
XMB patterns are relatively easy to generate via tools such as xpaint or gimp. Alternatively, users can save the following template to a file and edit the bit values:
#define tessel_width 32 #define tessel_height 32 static unsigned char tessel_bits[] = { 0x70, 0x00, 0x70, 0x00, 0x90, 0x01, 0xd0, 0x01, 0x16, 0x06, 0x16, 0x06, 0x1a, 0x18, 0x1a, 0x18, 0x02, 0x64, 0x02, 0x64, 0x03, 0x80, 0x03, 0x80, 0x02, 0x60, 0x02, 0x60, 0x1a, 0x18, 0x1a, 0x18, 0x16, 0x06, 0x16, 0x06, 0x90, 0x09, 0x90, 0x09, 0x70, 0x00, 0x70, 0x00, 0x90, 0x01, 0x90, 0x01, 0x16, 0x06, 0x16, 0x06, 0x1a, 0x18, 0x1a, 0x18, 0x02, 0x64, 0x02, 0x64, 0x03, 0x80, 0x03, 0x80, 0x02, 0x60, 0x02, 0x60, 0x1a, 0x18, 0x1a, 0x18, 0x16, 0x06, 0x16, 0x06, 0x90, 0x09, 0x90, 0x09, 0x70, 0x00, 0x70, 0x00, 0x90, 0x01, 0x90, 0x01, 0x16, 0x06, 0x16, 0x06, 0x1a, 0x18, 0x1a, 0x18, 0x02, 0x64, 0x02, 0x64, 0x03, 0x80, 0x03, 0x80, 0x02, 0x60, 0x02, 0x60, 0x1a, 0x18, 0x1a, 0x18, 0x16, 0x06, 0x16, 0x06, 0x90, 0x01, 0x90, 0x09, 0x70, 0x02, 0x70, 0x00, 0x10, 0x00, 0x90, 0x01, };
Examples
Example 1
chips> add_region(5,.5,.5,.5,"fill.style=userfill1") chips> load_fill("/data/chips/tessel.xbm") chips> add_region(6,.3,.3,.3,"fill.style=userfill1")
A region is created and filled with the default userfill1 style. A new pattern is loaded as userfill1 from the file /data/chips/tessel.xbm. When the second region is created, it is filled with the new userfill1 pattern.
Example 2
chips> load_fill("tessel.xbm", chips_userfill2)
Load up a pattern into the "userfill2" slot.
Bugs
See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.