Blame src/lib/PolygonUtils.h

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