diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-02-24 18:08:38 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-03-06 16:33:06 +0100 |
commit | 7894fd2b442eff45ecf14088ebd17ee9f8678752 (patch) | |
tree | cf1525a0c7118b6c84a0abd555a36277f8d8e91b /include | |
parent | de5dc664fc923b9704860f51267c438cad28cbe4 (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>
Diffstat (limited to 'include')
-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: */ |