User:Sallewell/SymbolEditor File Format

Jump to: navigation, search
Under construction.png
 
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.

Contents

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

  1. file
  2. {
  3.     char[15] // containing 'KXStitchSymbols'
  4.     qint32 file_version // == 100
  5.     qint16 next_symbol_id
  6.     QMap<qint16 index, QPainterPath path> pathsMap
  7. }

Version 101

Format uses QDataStream::Qt_4_0

  1. file
  2. {
  3.     char[15] // containing 'KXStitchSymbols'
  4.     qint32 file_version // == 101
  5.     qint16 next_symbol_id
  6.     QMap<qint16 index, Symbol symbol> symbolMap
  7. }

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.

noframe
 
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

The symbol definition only has one version at the moment, version 100, which is defined as

  1. Symbol
  2. {
  3.     qint32 version;
  4.     QPainterPath path;
  5.     bool filled;
  6.     qreal lineWidth;
  7.     qint32 Qt::PenCapStyle
  8.     qint32 Qt::PenJoinStyle
  9. }

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.


This page was last modified on 31 May 2014, at 16:15. This page has been accessed 395 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal