User:Sallewell/SymbolEditor File Format: Difference between revisions
(Created page with "{{Construction}} The [http://userbase.kde.org/SymbolEditor SymbolEditor] application was originally written to provide symbol libraries for the [http://userbase.kde.org/KXStit...") |
m (→Version 101) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Construction}} | {{Construction}} | ||
The [http://userbase.kde.org/SymbolEditor SymbolEditor] application was originally written to provide symbol libraries for the [http://userbase.kde.org/KXStitch KXStitch] application. If anyone else finds these symbol libraries useful, these are the file format used. | The [http://userbase.kde.org/SymbolEditor SymbolEditor] application was originally written to provide symbol libraries for the [http://userbase.kde.org/KXStitch KXStitch] application. If anyone else finds these symbol libraries useful, these are the file format used. Have a look at the code in the two applications for examples of their usage. | ||
== Versions of the format == | == Versions of the format == | ||
Line 7: | Line 7: | ||
=== Version 100 === | === Version 100 === | ||
Format uses QDataStream::Qt_4_0 | Format uses QDataStream::Qt_4_0 | ||
<syntaxhighlight lang="cpp-qt" line> | |||
file { | file | ||
{ | |||
char[15] containing 'KXStitchSymbols' | char[15] // containing 'KXStitchSymbols' | ||
qint32 file_version // == 100 | |||
qint32 file_version = 100 | qint16 next_symbol_id | ||
QMap<qint16 index, QPainterPath path> pathsMap | |||
qint16 next_symbol_id | |||
QMap<qint16 index, QPainterPath path> pathsMap | |||
} | } | ||
</syntaxhighlight> | |||
=== Version 101 === | === Version 101 === | ||
Format uses QDataStream::Qt_4_0 | Format uses QDataStream::Qt_4_0 | ||
<syntaxhighlight lang="cpp-qt" line> | |||
file | |||
{ | |||
char[15] // containing 'KXStitchSymbols' | |||
qint32 file_version // == 101 | |||
qint16 next_symbol_id | |||
QMap<qint16 index, Symbol symbol> symbolMap | |||
} | |||
</syntaxhighlight> | |||
==== Symbol Index ==== | |||
The index can be used by applications to reference a symbol in a library without having to store the symbol definition with any files created by that application. | |||
{{Warning|SymbolEditor can be used to remove symbols from a library, so this needs to be accounted for in code that uses them.}} | |||
} | |||
== Symbol Definition == | == Symbol Definition == | ||
The symbol definition only has one version at the moment, version 100, which is defined as | The symbol definition only has one version at the moment, version 100, which is defined as | ||
Symbol { | <syntaxhighlight lang="cpp-qt" line> | ||
Symbol | |||
{ | |||
qint32 version; | |||
QPainterPath path; | |||
bool filled; | |||
qreal lineWidth; | |||
qint32 Qt::PenCapStyle | |||
qint32 Qt::PenJoinStyle | |||
} | |||
</syntaxhighlight> | |||
QPainterPath | The coordinates of the QPainterPath will be in the range 0.0 .. 1.0 in both the x and y directions. The QPainterPath can be scaled to suit the destination. Both SymbolEditor and KXStitch use a transformation matrix on the QWidget to achieve this. | ||
Latest revision as of 16:15, 31 May 2014
Under Construction |
---|
This is a new page, currently under construction! |
The SymbolEditor application was originally written to provide symbol libraries for the KXStitch application. If anyone else finds these symbol libraries useful, these are the file format used. Have a look at the code in the two applications for examples of their usage.
Versions of the format
There are currently two versions of the file format. Version 100 is deprecated and it is unlikely that any symbol libraries will exist in the wild. Version 101 is the current format.
Version 100
Format uses QDataStream::Qt_4_0
file
{
char[15] // containing 'KXStitchSymbols'
qint32 file_version // == 100
qint16 next_symbol_id
QMap<qint16 index, QPainterPath path> pathsMap
}
Version 101
Format uses QDataStream::Qt_4_0
file
{
char[15] // containing 'KXStitchSymbols'
qint32 file_version // == 101
qint16 next_symbol_id
QMap<qint16 index, Symbol symbol> symbolMap
}
Symbol Index
The index can be used by applications to reference a symbol in a library without having to store the symbol definition with any files created by that application.
Symbol Definition
The symbol definition only has one version at the moment, version 100, which is defined as
Symbol
{
qint32 version;
QPainterPath path;
bool filled;
qreal lineWidth;
qint32 Qt::PenCapStyle
qint32 Qt::PenJoinStyle
}
The coordinates of the QPainterPath will be in the range 0.0 .. 1.0 in both the x and y directions. The QPainterPath can be scaled to suit the destination. Both SymbolEditor and KXStitch use a transformation matrix on the QWidget to achieve this.