/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * This file is part of the libmspub 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/. */ #ifndef INCLUDED_POLYGONUTILS_H #define INCLUDED_POLYGONUTILS_H #include #include #include #include #include "Coordinate.h" #include "ShapeType.h" namespace libmspub { const int PROP_ADJUST_VAL_FIRST = 327; const int PROP_ADJUST_VAL_LAST = 336; const int PROP_GEO_LEFT = 320; const int PROP_GEO_TOP = 321; const int PROP_GEO_RIGHT = 322; const int PROP_GEO_BOTTOM = 323; const int OTHER_CALC_VAL = 0x400; const int ASPECT_RATIO = 0x600; class VectorTransformation2D; struct Color; struct Line; typedef struct { int m_x; int m_y; } Vertex; typedef struct { int m_flags; int m_argOne; int m_argTwo; int m_argThree; } Calculation; typedef struct { Vertex first; Vertex second; } TextRectangle; struct CustomShape { const Vertex *mp_vertices; unsigned m_numVertices; const unsigned short *mp_elements; unsigned m_numElements; const Calculation *mp_calculations; unsigned m_numCalculations; const int *mp_defaultAdjustValues; unsigned m_numDefaultAdjustValues; const TextRectangle *mp_textRectangles; unsigned m_numTextRectangles; unsigned m_coordWidth; unsigned m_coordHeight; const Vertex *mp_gluePoints; unsigned m_numGluePoints; unsigned char m_adjustShiftMask; Coordinate getTextRectangle(double x, double y, double width, double height, std::function calculator) const; CustomShape(const Vertex *p_vertices, unsigned numVertices, const unsigned short *p_elements, unsigned numElements, const Calculation *p_calculations, unsigned numCalculations, const int *p_defaultAdjustValues, unsigned numDefaultAdjustValues, const TextRectangle *p_textRectangles, unsigned numTextRectangles, unsigned coordWidth, unsigned coordHeight, const Vertex *p_gluePoints, unsigned numGluePoints, unsigned char adjustShiftMask = 0) : mp_vertices(p_vertices), m_numVertices(numVertices), mp_elements(p_elements), m_numElements(numElements), mp_calculations(p_calculations), m_numCalculations(numCalculations), mp_defaultAdjustValues(p_defaultAdjustValues), m_numDefaultAdjustValues(numDefaultAdjustValues), mp_textRectangles(p_textRectangles), m_numTextRectangles(numTextRectangles), m_coordWidth(coordWidth), m_coordHeight(coordHeight), mp_gluePoints(p_gluePoints), m_numGluePoints(numGluePoints), m_adjustShiftMask(adjustShiftMask) { } }; struct DynamicCustomShape { std::vector m_vertices; std::vector m_elements; std::vector m_calculations; std::vector m_defaultAdjustValues; std::vector m_textRectangles; std::vector m_gluePoints; unsigned m_coordWidth; unsigned m_coordHeight; unsigned char m_adjustShiftMask; DynamicCustomShape(unsigned coordWidth, unsigned coordHeight) : m_vertices(), m_elements(), m_calculations(), m_defaultAdjustValues(), m_textRectangles(), m_gluePoints(), m_coordWidth(coordWidth), m_coordHeight(coordHeight), m_adjustShiftMask(0) { } }; std::shared_ptr getFromDynamicCustomShape(const DynamicCustomShape &dcs); const CustomShape *getCustomShape(ShapeType type); bool isShapeTypeRectangle(ShapeType type); librevenge::RVNGPropertyList calcClipPath(const std::vector &verts, double x, double y, double height, double width, VectorTransformation2D transform, std::shared_ptr shape); void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector lines, std::function calculator, const std::vector &palette, std::shared_ptr shape); } // libmspub #endif /* INCLUDED_POLYGONUTILS_H */ /* vim:set shiftwidth=2 softtabstop=2 expandtab: */