From afb31963d1d6ca18dc48f205ee8cd45b2efecf82 Mon Sep 17 00:00:00 2001 From: Fabrice Salvaire Date: Wed, 30 Jan 2019 02:48:46 +0100 Subject: [PATCH] doc --- .../source/resources/file-format/dxf.rst | 7 ++ .../source/resources/file-format/index.rst | 18 ++++ .../source/resources/file-format/svg.rst | 90 +++++++++++++++++++ .../resources/file-format/valentina.rst | 7 ++ doc/sphinx/source/resources/index.rst | 1 + 5 files changed, 123 insertions(+) create mode 100644 doc/sphinx/source/resources/file-format/dxf.rst create mode 100644 doc/sphinx/source/resources/file-format/index.rst create mode 100644 doc/sphinx/source/resources/file-format/svg.rst create mode 100644 doc/sphinx/source/resources/file-format/valentina.rst diff --git a/doc/sphinx/source/resources/file-format/dxf.rst b/doc/sphinx/source/resources/file-format/dxf.rst new file mode 100644 index 0000000..314b084 --- /dev/null +++ b/doc/sphinx/source/resources/file-format/dxf.rst @@ -0,0 +1,7 @@ +.. include:: /abbreviation.txt + +.. _dxf-ressources-page: + +================= + DXF File Format +================= diff --git a/doc/sphinx/source/resources/file-format/index.rst b/doc/sphinx/source/resources/file-format/index.rst new file mode 100644 index 0000000..4c9f1ae --- /dev/null +++ b/doc/sphinx/source/resources/file-format/index.rst @@ -0,0 +1,18 @@ +.. include:: /abbreviation.txt + +.. _file-format-ressources-page: + +============== + File Formats +============== + +This section contains resource on file format. + +Contents: + +.. toctree:: + :maxdepth: 2 + + dxf.rst + svg.rst + valentina.rst diff --git a/doc/sphinx/source/resources/file-format/svg.rst b/doc/sphinx/source/resources/file-format/svg.rst new file mode 100644 index 0000000..1194c1f --- /dev/null +++ b/doc/sphinx/source/resources/file-format/svg.rst @@ -0,0 +1,90 @@ +.. include:: /abbreviation.txt + +.. _svg-ressources-page: + +================= + SVG File Format +================= + +Reference Documentations +------------------------ + +* `Scalable Vector Graphics (SVG) W3C Home Page `_ +* `An SVG Primer for Today's Browsers W3C Working Draft — September 2010 `_ +* `Scalable Vector Graphics (SVG) 1.1 (Second Edition) W3C Recommendation 16 August 2011 `_ +* `Mozilla SVG Documentation `_ + +SVG Coordinate System +--------------------- + +SVG uses the screen coordinate system where the X axis points towards the right direction and the Y +axis points towards the bottom direction, thus the origin is at the upper left-hand corner of the +drawing frame. + +Inkscape Software +----------------- + +Inkscape can save a SVG file in several ways: + +* simple: the file will only contains pure SVG +* Inkscape: the file will contains Inkscape extension +* optimised: perform some optimisations on the output +* compressed: file is compressed using the zip algorithm + +**Notes on how Inkscape generates SVG**: + +* As opposite to the SVG Specification, Inkscape set the origin at the bottom of the document, thus + + :math:`\mathbf{Y}_{\mathrm{Inkscape}} = \mathbf{Page\ Height} - \mathbf{Y}_{\mathrm{SVG}}` + + The transformation is a composition of a Y axis parity and a translation on the Y axis of the page height. + + See also https://bugs.launchpad.net/inkscape/+bug/170049 + +* It uses a *group* as top layer and a *transform* +* It uses a mix of absolute and incremental coordinates +* **It spoils in several ways the object's coordinates**: values are transformed and rounded. + Thus **Inkscape should not be be used to make or edit a file which require accurate coordinates.** + +Inkscape SVG example +~~~~~~~~~~~~~~~~~~~~ + +This example uses a margin of 20 and paint + +* an horizontal line of length 100 from the origin (20, 20) +* a vertical line of length 100 from the origin +* a 45° line of length 80 from the origin +* the viewport is (0, 0, 140, 140) + +**Note: this extract is incomplete** + +.. code-block:: text + + + + + + + + + + +This SVG file must be interpreted as follow + +* Draw a line from (20, 276-156) to +(100, 0) (note: l is deduced from m), + + which gives (20, 120) to (120, 120), + + and in Inkscape coordinates (20, 20) to (120, 20) since 140 - 120 = 20 + +* Draw a line from (20, 276-156) to (20, 176-156), + + which gives (20, 120) to (20, 20), + + and in Inkscape coordinates (20, 20) to (20, 120) + +* Draw a line from (20, 276-156) to +(80, -80), + + which gives (20, 120) to (100, 40), + + and in Inkscape coordinates (20, 20) to (100, 100) diff --git a/doc/sphinx/source/resources/file-format/valentina.rst b/doc/sphinx/source/resources/file-format/valentina.rst new file mode 100644 index 0000000..b437fd5 --- /dev/null +++ b/doc/sphinx/source/resources/file-format/valentina.rst @@ -0,0 +1,7 @@ +.. include:: /abbreviation.txt + +.. _valentina-file-format-ressources-page: + +======================= + Valentina File Format +======================= diff --git a/doc/sphinx/source/resources/index.rst b/doc/sphinx/source/resources/index.rst index b097907..c3e6530 100644 --- a/doc/sphinx/source/resources/index.rst +++ b/doc/sphinx/source/resources/index.rst @@ -13,4 +13,5 @@ Contents: .. toctree:: :maxdepth: 2 + file-format/index.rst geometry/index.rst -- GitLab