=============BEGINNING OF DOCUMENT================= This document is Copyright (c) 1996 by Ravi Nielsen All Rights Reserved. You may download and print this document for your own use. You may not copy, distribute, or publish this document electronically or on paper without the express permission of the author. You may freely use the WIF Specification itself in any weaving program you develop, provided your program includes all sections described below under Minimum Requirements--including but not limited to the WIF section and the Version, Date, and Developers information. =================================================== WEAVING INFORMATION FILE (WIF) SPECIFICATION VERSION 1.0 MARCH 3, 1996 DEVELOPED BY: RAVI NIELSEN, PATTERNLAND WEAVE SIMULATOR BOB KEATES, FIBERWORKS PCW ROB SINKLER, SWIFTWEAVE WRITTEN BY: RAVI NIELSEN, MAPLE HILL SOFTWARE =================================================== EMAIL ADDRESSESS Ravi Nielsen: ravi@mhsoft.com Bob Keates: keates@chembio.uoguelph.ca Rob Sinkler: shrub@slip.net RATIONALE Currently each weaving program uses its own format for storing weave information. Each format is especially suited to the individual program, but does not lend itself to translation across programs. In addition files are machine readable only. CRITERIA The Weaving Information File (WIF) specification is designed to meet the following criteria: 1. It can evolve and change as the need arises, without rendering earlier versions unreadable by new programs nor later versions unreadable by older programs. 2. It can be understood by a human reader. 3. It can be read by any computer capable of reading an ASCII text file. To meet the above criteria, the WIF takes the form of a Microsoft Windows ".INI" file. But it departs from this standard in at least one important way. WIF files are not limited to 64K, as are Windows 3.1 ini files. This means that standard Windows 3.1 functions can NOT be used to process WIF files. It may be that Windows 95 functions will work. Macintosh and Windows 3.1 programmers must write their own utilities to read and write WIF files. WIF SPECIFICATION ================= The WIF specification consists of a set of English language Section and Key names and agreements on how the data will be presented. Where several possible data formats exist, preference will be given to the format that meets all three criteria. Efficiency is sacrificed in favor of readability by humans. Specifically, efficient bit sensitive numbers are abandoned in favor of comma separated arrays understandable by a weaver. SECTION AND KEY NAMES The INI file specification dictates that section names are in brackets [section name] and key names are followed by an equals sign and the data: Keyname=data. COMMENTS Comments may be freely included if prefaced by a semicolon at the beginning of the line. Comments may also be included following a numeric entry or boolean entry. While not required, these comments should be prefixed by a semicolon. Key lines containing a text string may not contain a comment. INFORMATIONAL AND DATA SECTIONS For the purpose of the WIF specification, sections are defined as "INFORMATIONAL" and "DATA" Sections. A [CONTENTS] section is a special Informational Section that lists all other Sections with the exception of two: [TRANSLATIONS], and [WIF]. Each section is included in [CONTENTS] as a boolean Keyline with a value of yes or no. This tells the processing program whether the section exists or not. UPPER AND LOWER CASE By convention, Section names are upper case and Key Names are upper/lower case. But programs must process all section and key names in a case insensitive manner. Specifically, the section names which appear as key names under [CONTENTS] may commonly appear in upper case, since they are also Section names. ORDER INDEPENDENCE Programs that process WIF files may not depend on a specific order of section names, nor of key lines within sections. Note that this precludes the use of the Windows ReadPrivateProfileString with a nil Key to put all lines in a section into a buffer. While the order of Key lines in data sections like [THREADING] can expected to be written in numeric order, the WIF standard says that each Key must be evaluated in case this order is not followed. This stated, however, some programs may work most efficiently with a preferred Section order. See "Optional Programming Considerations" at the end of this document. MINIMUM REQUIREMENTS Every WIF file should include the following Sections and Key lines. The boolean values of the sections listings as Key lines under [CONTENTS] determines whether the Section itself exists. Detailed notes on each section and on the valid values for Key lines is included in the Sample Weaving Information File format that follows immediately after the Minimum requirements listing. -------------Begin Minimum Requirements----------------- [TRANSLATIONS] Language= [WIF] Version=1.0 Date=March 3, 1996 Developers=Ravi Nielsen, Bob Keates, Rob Sinkler Source Program= Source Version= [CONTENTS] COLOR PALETTE= WARP SYMBOL PALETTE= WEFT SYMBOL PALETTE= TEXT= WEAVING= WARP= WEFT= BITMAP IMAGE= BITMAP FILE= DESIGN= ; Beginning of Data Sections NOTES= TIEUP= ; Color and Symbol tables COLOR TABLE= WARP SYMBOL TABLE= WEFT SYMBOL TABLE= ; Warp Data Sections THREADING= WARP THICKNESS= WARP THICKNESS ZOOM= WARP SPACING= WARP SPACING ZOOM= WARP COLORS= WARP SYMBOLS= ; Weft Data Sections TREADLING= LIFTPLAN= WEFT THICKNESS= WEFT THICKNESS ZOOM= WEFT SPACING= WEFT SPACING ZOOM= WEFT COLORS= WEFT SYMBOLS= ; Bitmap or Design Data BITMAP IMAGE DATA= DESIGN DATA= -----------End Minimum Requirements----------------- =================================================== A SAMPLE WEAVING INFORMATION FILE The following section is a machine readable sample file. It should be extracted from this document and saved with a ".WIF" suffix for testing purposes. Following the machine readable section are additional sections containing example data for Bitmap Image Data, Bitmap File, Design, and Design Data sections. Following that is the section on Optional Programming Considerations. NOTE: The weaving represented by this sample file is not meant to represent an actual weaving pattern. Rather it was created as a programmer's test pattern to show a range of 16 colors. ;=============BEGIN MACHINE READABLE================ ; WEAVING INFORMATION FILE (WIF) ; DOCUMENTATION OF VERSION 1.0 ; MARCH 3, 1996 [TRANSLATIONS] ; Allows the creation of foreign language WIF files. If language ; equals English, no further action is necessary; if another ;language is listed, each section and key name must be translated ;in this section. All further processing must use the referenced ;names. The purpose is to assure that the file can be read by ;non-English speaking readers. Language=English ;OR ;Language=Martian ; translation of section and key names follows ;Warp=Wrpa ; the Martian word for Warp ;Threading=Thrda ; the Martian word for threading [WIF] ; Provides information on the file format. Version=1.0 ; the WIF version supported. Date=March 3, 1996 ; the date of the WIF version Developers=Ravi Nielsen, Bob Keates, Rob Sinkler ; the initial collaborators who designed the WIF format Source Program=A Weaving Program ; the name of the program that wrote the WIF file Source Version=V 1.12W ; the version of the program--an alpha field [CONTENTS] ;This section lists every section contained in the file. A ;program should read these Keys to determine in advance what ;data is available in the file. It can then present the user ;with a dialog box asking which sections to include. By ;reading all sections up to the beginning of data sections, ;programs can present the user with detailed information ;about the contents of the file. ;Valid values= yes or no; true or false; 1 or 0 COLOR PALETTE=yes WARP SYMBOL PALETTE=yes WEFT SYMBOL PALETTE=yes TEXT=yes WEAVING=yes WARP=yes WEFT=yes BITMAP IMAGE=no BITMAP FILE=no DESIGN=no ; Beginning of Data Sections NOTES=yes TIEUP=yes ; Color and Symbol tables COLOR TABLE=yes WARP SYMBOL TABLE=yes WEFT SYMBOL TABLE=yes ; Warp Data Sections THREADING=yes WARP THICKNESS=yes WARP THICKNESS ZOOM=yes WARP SPACING=yes WARP SPACING ZOOM=yes WARP COLORS=yes WARP SYMBOLS=yes ; Weft Data Sections TREADLING=yes LIFTPLAN=yes WEFT THICKNESS=yes WEFT THICKNESS ZOOM=yes WEFT SPACING=yes WEFT SPACING ZOOM=yes WEFT COLORS=yes WEFT SYMBOLS=yes BITMAP IMAGE DATA=no DESIGN DATA=no [COLOR PALETTE] Entries=16 ; maximum number of entries in color table Form=RGB ; Valid values: RGB; CMYK; HSV(Hue,Saturation,Value) Range=0,255 ; the range of allowable values contained in the palette entries [WARP SYMBOL PALETTE] ; maximum number of entries in warp symbol table Entries=16 [WEFT SYMBOL PALETTE] ; maximum number of entries in weft symbol table Entries=16 [TEXT] ; provides information about the weaving and artist Title=A Sample WIF File ;title of the Weaving Author=Ravi Nielsen ;name of the artist Address= ;address of the artist EMail= ;email of the artist Telephone= ;voice number of the artist FAX= ;FAX number of the artist [WEAVING] ; information on the weaving Shafts=10 Treadles=12 Rising Shed=yes Profile=no [WARP] ; this section describes the warp Threads=32 ; 32 threads in the threading section Colors=16 ; 16 colors are used Palette=yes ; the color section references the palette ColorMix=yes ; color section includes RGB, CMKY, or HSV as specified by ; Color Palette Form Color=0,0,0,0 ; the default single color. [Palette Ndx],R,G,B Units=Decipoints ; units in which spacing and thickness are measured ; valid values: ; decipoints, inches, centimeters, display, printer Spacing=100 ; default spacing is 100 decipoints Thickness=80 ; default thickness is 80 decipoints Symbol=X ; single symbol is "X" ; See comments under Warp Symbol Table for valid formats [WEFT] ; this section describes the weft. See the comments under ; Warp for a description of each line. Threads=32 Colors=16 Palette=yes ColorMix=yes Color=0,0,0,255 Units=Decipoints Spacing=100 Thickness=80 Symbol== [NOTES] ;Each line is prefaced by its line number. 1=This is a note line. 2=This is another line. [TIEUP] ; The shafts tied to each treadle are separated by commas ; programs that store a tieup in a bit sensitive number must ; convert the comma separated string. Maximum number of ; values is specified under [Weaving] Shafts 1=1,3,9 2=2,4,8,10 3=3,5,7,9 4=4,6,8 5=5,7 6=4,6,8 7=3,5,7,9 8=2,4,8,10 9=1,3,9 10=2 11=1,3 12=2 [COLOR TABLE] ; Each entry must take the form of a triplet or Quadruplet as ; specified by the Form entry under [Color Palette]. 1=0,0,168 2=0,168,0 3=0,168,168 4=168,0,0 5=168,0,168 6=168,88,0 7=168,168,168 8=88,88,88 9=88,88,255 10=88,255,88 11=88,255,255 12=255,88,88 13=255,88,255 14=255,255,88 15=255,255,255 16=0,0,0 [WARP SYMBOL TABLE] ; The maximum number of entries is specified under ; [Warp Symbol Palette]. ; Entries may take the form of a character or an ; ASCII code, or a quoted symbol ; Examples: ;1=1 ; numeral 1 ;2=X ; character X ;3=#219 ; ASCII character 219 ;4=#35 ; the '#' character specified by ASCII code only ;5=' ' ; the space character 1=1 2=2 3=3 4=4 5=5 6=6 7=7 8=8 9=9 10=A 11=B 12=C 13=D 14=E 15=F 16=G [WEFT SYMBOL TABLE] ; The maximum number of entries is specified under ; [Weft Symbol Palette]. ; See Warp Symbol Table comments for valid formats 1=1 2=2 3=3 4=4 5=5 6=6 7=7 8=8 9=9 10=A 11=B 12=C 13=D 14=E 15=F 16=G [THREADING] ; The threading for the warp. 1=4 ; warp thread 1 uses shaft 4 2=5 ; warp thread 2 uses shaft 5 3=6 4=7 5=8 6=9 7=10 8=1 9=2 10=3 11=4 12=5 13=6 14=7 15=8 16=0 17=10 18=1 19=2 20=3 21=4 22=5 23=6 24=7 25=8 26=10 27=1 28=2 29=5 30=4 31=3 32=2 [WARP THICKNESS] ; the thickness of each warp thread in the selected unit. 1=80 ; warp thread 1 is 80 decipoints 2=160 ; warp thread 2 is 160 decipoints 3=80 4=160 5=80 6=160 7=80 8=160 9=80 10=160 11=80 12=160 13=80 14=160 15=80 16=160 17=80 18=160 19=80 20=160 21=80 22=160 23=80 24=160 25=80 26=160 27=80 28=160 29=80 30=160 31=80 32=160 [WARP THICKNESS ZOOM] ; a magnification factor times the default thickness 1=1 ; Warp thread 1 is 1 X the default warp thickness 2=2 ; Warp thread 2 is 2 X the default warp thickness 3=1 ; Warp thread 3 is 1 X the default warp thickness 4=2 5=1 6=2 7=1 8=2 9=1 10=2 11=1 12=2 13=1 14=2 15=1 16=2 17=1 18=2 19=1 20=2 21=1 22=2 23=1 24=2 25=1 26=2 27=1 28=2 29=1 30=2 31=1 32=2 [WARP SPACING] ; the spacing of each warp thread in the selected unit 1=100 ; Warp thread 1 exists within a spacing of 100 decipoints 2=200 ; Warp thread 2 exists within a spacing of 200 decipoints 3=100 4=200 5=100 6=200 7=100 8=200 9=100 10=200 11=100 12=200 13=100 14=200 15=100 16=200 17=100 18=200 19=100 20=200 21=100 22=200 23=100 24=200 25=100 26=200 27=100 28=200 29=100 30=200 31=100 32=200 [WARP SPACING ZOOM] ; a magnification factor times the default spacing 1=1 ; Warp thread 1 exists within a spacing of 1 X Default Warp Spacing 2=2 ; Warp thread 2 exists within a spacing of 2 X Default Warp Spacing 3=1 4=2 5=1 6=2 7=1 8=2 9=1 10=2 11=1 12=2 13=1 14=2 15=1 16=2 17=1 18=2 19=1 20=2 21=1 22=2 23=1 24=2 25=1 26=2 27=1 28=2 29=1 30=2 31=1 32=2 [WARP COLORS] ; first number is an index into the palette ; followed by an optional color mix if [WARP] ColorMix=yes 1=1,0,0,168 ; Warp thread one uses Palette Index 1; which is RGB 0,0,168 2=1,0,0,168 3=2,0,168,0 4=2,0,168,0 5=3,0,168,168 6=3,0,168,168 7=4,168,0,0 8=4,168,0,0 9=5,168,0,168 10=5,168,0,168 11=6,168,88,0 12=6,168,88,0 13=7,168,168,168 14=7,168,168,168 15=8,88,88,88 16=8,88,88,88 17=9,88,88,255 18=9,88,88,255 19=10,88,255,88 20=10,88,255,88 21=11,88,255,255 22=11,88,255,255 23=12,255,88,88 24=12,255,88,88 25=13,255,88,255 26=13,255,88,255 27=14,255,255,88 28=14,255,255,88 29=15,255,255,255 30=15,255,255,255 31=16,0,0,0 32=16,0,0,0 [WARP SYMBOLS] ; Index into the Warp Symbol Table 1=1 ; Warp thread 1 uses symbol #1 2=2 ; Warp thread 2 uses symbol #2 3=1 ; Warp thread 3 uses symbol #1 4=2 5=1 6=2 7=1 8=2 9=1 10=2 11=1 12=2 13=1 14=2 15=1 16=2 17=1 18=2 19=1 20=2 21=1 22=2 23=1 24=2 25=1 26=2 27=1 28=2 29=1 30=2 31=1 32=2 [TREADLING] ; The treadling for the weft. ; Valid formats include single treadle numbers and ; multiple treadle numbers separated by commas ; Example: ; 1=1,3 means Weft 1 uses both treadle 1 and 3 1=1 2=2 3=3 4=2 5=3 6=2 7=3 8=4 9=5 10=6 11=7 12=8 13=9 14=10 15=11 16=0 ; weft thread 16 is empty 17=1 18=2 19=3 20=4 21=5 22=6 23=7 24=8 25=9 26=0 27=11 28=12 29=4 30=5 31=6 32=7 [LIFTPLAN] ; The shafts raised (if Rising Shed) for each weft row 1=1,3,9 2=2,4,8,10 3=3,5,7,9 4=2,4,8,10 5=3,5,7,9 6=2,4,8,10 7=3,5,7,9 8=4,6,8 9=5,7 10=4,6,8 11=3,5,7,9 12=2,4,8,10 13=1,3,9 14=2 15=1,3 16=0 17=1,3,9 18=2,4,8,10 19=3,5,7,9 20=4,6,8 21=5,7 22=4,6,8 23=3,5,7,9 24=2,4,8,10 25=1,3,9 26=0 27=1,3 28=2 29=4,6,8 30=5,7 31=4,6,8 32=3,5,7,9 [WEFT THICKNESS] ; thickness of each weft thread in the specified unit 1=80 2=160 3=80 4=160 5=80 6=160 7=80 8=160 9=80 10=160 11=80 12=160 13=80 14=160 15=80 16=160 17=80 18=160 19=80 20=160 21=80 22=160 23=80 24=160 25=80 26=160 27=80 28=160 29=80 30=160 31=80 32=160 [WEFT THICKNESS ZOOM] ; a magnification factor times the default thickness 1=1 2=2 3=1 4=2 5=1 6=2 7=1 8=2 9=1 10=2 11=1 12=2 13=1 14=2 15=1 16=2 17=1 18=2 19=1 20=2 21=1 22=2 23=1 24=2 25=1 26=2 27=1 28=2 29=1 30=2 31=1 32=2 [WEFT SPACING] ; the spacing of each weft thread in the selected unit 1=100 2=200 3=100 4=200 5=100 6=200 7=100 8=200 9=100 10=200 11=100 12=200 13=100 14=200 15=100 16=200 17=100 18=200 19=100 20=200 21=100 22=200 23=100 24=200 25=100 26=200 27=100 28=200 29=100 30=200 31=100 32=200 [WEFT SPACING ZOOM] ; a magnification factor times the default spacing 1=1 2=2 3=1 4=2 5=1 6=2 7=1 8=2 9=1 10=2 11=1 12=2 13=1 14=2 15=1 16=2 17=1 18=2 19=1 20=2 21=1 22=2 23=1 24=2 25=1 26=2 27=1 28=2 29=1 30=2 31=1 32=2 [WEFT COLORS] ; first number is an index into the palette ; followed by an optional color mix if [WARP] ColorMix=yes 1=1,0,0,168 2=1,0,0,168 3=2,0,168,0 4=2,0,168,0 5=3,0,168,168 6=3,0,168,168 7=4,168,0,0 8=4,168,0,0 9=5,168,0,168 10=5,168,0,168 11=6,168,88,0 12=6,168,88,0 13=7,168,168,168 14=7,168,168,168 15=8,88,88,88 16=8,88,88,88 17=9,88,88,255 18=9,88,88,255 19=10,88,255,88 20=10,255,255,255 21=11,88,255,255 22=11,88,255,255 23=12,255,88,88 24=12,255,88,88 25=13,255,88,255 26=13,255,88,255 27=14,255,255,88 28=14,255,255,88 29=15,255,255,255 30=15,255,255,255 31=16,0,0,0 32=16,0,0,0 [WEFT SYMBOLS] ; Index into the Warp Symbol Table 1=1 2=2 3=1 4=2 5=1 6=2 7=1 8=2 9=1 10=2 11=1 12=2 13=1 14=2 15=1 16=2 17=1 18=2 19=1 20=2 21=1 22=2 23=1 24=2 25=1 26=2 27=1 28=2 29=1 30=2 31=1 32=2 ;===============END MACHINE READABLE================ The following sections illustrate support for Bitmap Image Data, Bitmap File, Design, and Design Data sections. [BITMAP IMAGE DATA] Pixelcolumns=96 ; implies 12 bytes per row if pixeldepth=1 Pixelrows=48 Pixeldepth=1 ; if pixeldepth>1, planes=1 Planes=4 ; if planes>1, pixeldepth=1 1=ff,ff,fc,1e,3c,78,. . . . . . 2=. . . . . 49=. . . . ; data for plane 2 starts here [BITMAP FILE] Platform=PC ;Valid Values are PC, MAC, UNIX Path=C:\weavings ; or location string of whatever platform Format=BMP ; Valid values are BMP, PCX, TIFF, GIF File=bitimage.bmp [DESIGN] ; This is another way of representing a pattern, be it a ; drawdown or other pattern. Each square of visible pattern is ; represented by an x,y coordinate; a palette index; and an ; optional color mix in RGB, CMKY, or HSV form. Thus a large ; area with few filled in squares requires relatively little ; information to describe it compared to a bitmap. LeftRight=true ; orientation of coordinate grid TopDown=true ; orientation of coordinate grid Columns=10 ; width of design Rows=10 ; height of design Entries=25 ; number of defined pixels Palette=yes ; color section references the palette ColorMix=yes ; color section includes RGB, CMKY or HSV values [DESIGN DATA] 1=1,2,3,255,255,255 ; coordinate x=1 y=2 palette color=3 RGB=255,255,255 2=10,10,1,0,0,0 ; coordinate x=10 y=10 palette color=1 RGB=0,0,0 ;etc. ======END OFFICIAL WIF SPECIFICATION DOCUMENTATION====== OPTIONAL PROGRAMMING CONSIDERATIONS The following notes address issues which fall outside the official WIF standard. They are presented in that light by the author, Ravi Nielsen, and represent issues which relate specifically to Patternland Weave Simulator and perhaps other programs which may in the future use a similar coding strategy. 1. PREFERRED SECTION ORDER Programs which read WIF files must not rely on the order of Sections within the file or the order of data lines within sections. However, some programs (including Patternland) use a multi- pass sequential read approach, while other programs use completely order-independent Windows-style INI file functions modified to support files larger than 64K. Programs which use the sequential read approach are most efficient if the "Information" Sections describing the "Data" Sections come first in the file. Patternland uses a "smart" 4-pass model. WIF files can be optimized for these programs by placing the Information Sections first. The following list is a suggested order for a WIF file optimized for sequential read. When files are written in this order, they can be read in one pass sequentially without resetting to the beginning. The order of sections within each "pass" is not important. 1st pass: TRANSLATIONS 2nd pass: WIF CONTENTS COLOR PALETTE WARP SYMBOL PALETTE WEFT SYMBOL PALETTE 3rd pass: TEXT WEAVING WARP (this gives me a thread count to show the user) WEFT (likewise) BITMAP IMAGE (could present user with size of bitmap) BITMAP FILE (could present user with name of bitmap file) DESIGN (could present user with size of Design) At this point a user selection dialog may be presented containing detailed information about the file, allowing the user to select what to read. 4th pass, all the remaining data sections. By reading Translations first, keynames in the WIF section can be translated. Because the Color_Palette section contains the Color Form and Range specification, and the Warp and Weft sections contain colors, the Color Palette section must be read first. Once I've read the CONTENTS section I know which of the Pass 3 major sections to expect. The group is considered complete once I have all the ones listed "yes" in CONTENTS. Patternland code assigns a pass group number to each section. As I read the file, if I come upon a section in a higher group before I'm done with the current group, the program resets to the beginning of the file before reading the next group of sections. If, however, the file was written with sections grouped as above, I never have to start over and do one continuous sequential read--except for pausing after Groups 1-3 to present the user with an information and options dialog box. While this approach may seem involved, I believe it to be much faster than independently finding each Section/Keyname and reading its data. 2. MULTI-LINE TITLES Patternland supports multiline Titles; WIF does not. Patternland replaces CRLF with // on writing a Title to a WIF file and replaces // with a CRLF on reading a WIF file. If a program supports multiline titles, the programmer may wish to adopt this convention. New lines are represented by double slashes as per this example: [TEXT] Title=A multiline Title//New Line 2//New Line 3 3. USER OPTIONS A program that supports WIF files may wish to take advantage of the flexibility the specificiation provides for extracting specific sections from the file. A program may present the user with a Dialog box on reading a WIF file after processing the Informational Sections and learning the details of what the file contains; or on writing the file before the writing begins. Following are some of the options Patternland provides the user. Range Saving a WIF: Dialog presents the current Warp and Weft limits. From and To ranges are always written out as Threads 1 to Threads [To-From+1]. Reading a WIF: Dialog presents the ranges contained in the file, i.e., 1 to Threads. New/Overwrite/Insert/Add AT Thread. New: At Thread is forced to 1. Current weaving is erased and thread ranges are read in starting with 1. Overwrite: At Thread is enabled. Thread ranges are read in and replace threads starting with respective warp and weft At Thread values. If range exceeds current weaving, additional threads are added. Insert: At Thread is enabled. Thread ranges are read in and inserted starting with respective warp and weft At Thread values. Add: At Thread is disabled. Reads last thread in current warp and weft. Thread ranges are read in and added to the end of the current weaving. Checkboxes are presented for the user to individually select most of the components of the file. A View option allows the user to view the TEXT information prior to loading the file. =======================END OF DOCUMENT======================