diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-02-24 18:08:38 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-08-29 20:10:49 +0900 |
commit | e4a68755703d35d04feb4cbd2eaf145b8826a2a8 (patch) | |
tree | b8eb6cac5d17cf5741a500c37c972ff6ca516fe9 /include/basegfx | |
parent | fc87027936cdce7a40a80c5f2072186dd922935b (diff) |
svgio visitor, add draw commands and create the from svg
Adds a visitor for svgio for visiting svg nodes and create something
useful from them.
Basic draw commands - a tree of draw commands (with sub-pixel
precision support) just to store a simple definition for drawing.
Adds a svg draw visitor and create draw commands from the svg
structure and expose the commands through UNO API.
Change-Id: I073e891a2cffdd76d4e3b838590e3a19c998e9bf
Reviewed-on: https://gerrit.libreoffice.org/68770
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 7894fd2b442eff45ecf14088ebd17ee9f8678752)
Diffstat (limited to 'include/basegfx')
-rw-r--r-- | include/basegfx/DrawCommands.hxx | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/include/basegfx/DrawCommands.hxx b/include/basegfx/DrawCommands.hxx new file mode 100644 index 000000000000..23afbecb9273 --- /dev/null +++ b/include/basegfx/DrawCommands.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +class DrawBase; + +class DrawCommand +{ +public: + std::vector<std::shared_ptr<DrawBase>> maChildren; +}; + +enum class DrawCommandType +{ + Root, + Rectangle, + Path +}; + +class DrawBase : public DrawCommand +{ +private: + DrawCommandType meType; + +public: + DrawBase(DrawCommandType eType) + : meType(eType) + { + } + + DrawCommandType getType() { return meType; } +}; + +class DrawRoot : public DrawBase +{ +public: + basegfx::B2DRange maRectangle; + + DrawRoot() + : DrawBase(DrawCommandType::Root) + { + } +}; + +class DrawRectangle : public DrawBase +{ +public: + basegfx::B2DRange maRectangle; + + DrawRectangle(basegfx::B2DRange const& rRectangle) + : DrawBase(DrawCommandType::Rectangle) + , maRectangle(rRectangle) + { + } +}; + +class DrawPath : public DrawBase +{ +public: + basegfx::B2DPolyPolygon maPolyPolygon; + + DrawPath(basegfx::B2DPolyPolygon const& rPolyPolygon) + : DrawBase(DrawCommandType::Path) + , maPolyPolygon(rPolyPolygon) + { + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |