CSQ Open Source FIle Format Specification V1.0 - CSQV1
Author: Gianni Mariani (firstname.lastname@example.org)
Permission to copy granted under the Creative Commons License
FIles with the ".CSQ" extension are used by the Gammill® Creative Studio® software to define quilting “patterns”. The files are basically a collection of 2D lines and splines and arbitrary comments. While Creative Studio® is able to read other file formats (including QLI and DXF formats), CSQ is used as the format to export patterns.
Note that this specification is the "Open Source" specification and may be differ in possibly unknown ways to the unpublished Creative Studio® specification. Proposals to update this document are welcome through either bug reports or git push requests.
Any tool builder or CSQ file provider can use the title "CSQ Open Source FIle Format Specification V1.0" or the abbreviation “CSQV1” to denote referring to this document.
Why Define The CSQ Format
Ideally, Gammill® would provide this document. There are many examples of companies doing precisely this. See the DXF specification from Autodesk or the OOXML specifications from Microsoft.
Formally defining the CSQ file format specification allows anyone to create a compliant application. That means you can expect software from sources other than Gammill® to provide support CSQ files in a consistent way.
Alternatively, not defining the format means everyone developing software that claims to support CSQ format may be making incompatible software and this only leads to problems for end users where they may not reliably interoperate with the applications using these files.
The CSQ Format
CSQ files provide similar data to a subset of what is supported in SVG Paths. The basic primitives and "move", “line to” and “cubic bezier spline to”. CSQ also supports comments which should be used when text search is an application option.
Magic String #CSQLI
The CSQ file begins with a "magic string" “#CSQLI” followed by a new line. This 6 character sequence should begin at the first position in the file. CSQ streams that contain the unicode byte order mark (i.e the character sequence 0xEF,0xBB,0xBF) in the beginning of a CSQ file are malformed.
Apart from the first line in the file, white space is ignored but preserved in comments.
Comments are denoted by starting with character "#" or the character sequence “NO INFO”. Comments terminate at the end of the line.
All lines in a CSQ file have the following grammar. Namely (in a modified BNF specification):
line : command | comment
command: x-coordinate y-coordinate command-type [hash_comment]
command-type: ('1' | '2' | '3')
hash_comment: '#' <text>
comment: ("#" | "NO INFO") <text>
The command-type corresponds as follows:
‘1’ : Move to
‘2’ : Line to
‘3’ : Spline to ;There must be a multiple of 3 spline to coordinates.
Commands that require a start point (Line to and Spline to) use the end point of the previous command. This allows chaining of commands to create a continuous path without the need to repeat the first point.
‘Line to’ produces a straight line segment between the start and end points.
‘Spline to’ is a cubic Bezier spline with the 4 control points being the previous end point (as the start control point) and 3 coordinates provided by 3 "Spline to" commands.
An example CSQ file forming a unit square.
An example CSQ file forming a "hump" curve..
An example of some comments.
# This is a unit square.
0.0,0.0,2 # This closes the loop.
NO INFO Permission to copy granted under the Creative Commons License
NO INFO http://creativecommons.org/licenses/by/2.0.
If you want to contribute to this specification, please raise issues in the issue tracker https://bitbucket.org/owebeeone/csq/issues?status=new&status=open or create a pull request.