Welcome to mirror list, hosted at ThFree Co, Russian Federation.

skin_generator.hpp « skin_generator - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 295059744e5238f7ee971585eb7de3421a979e80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once

#include "geometry/rect2d.hpp"
#include "geometry/packer.hpp"

#include "coding/writer.hpp"

#include "base/base.hpp"

#include "std/vector.hpp"
#include "std/list.hpp"
#include "std/string.hpp"
#include "std/map.hpp"

#include <boost/gil/gil_all.hpp>

#include <QtGui/QPainter>
#include <QtGui/QImage>
#include <QtCore/QFileInfo>
#include <QtCore/QSize>
#include <QtSvg/QSvgRenderer>
#include <QtXml/QXmlContentHandler>
#include <QtXml/QXmlDefaultHandler>

class QImage;

namespace gil = boost::gil;

namespace tools
{
  class SkinGenerator
  {
  public:
      struct SymbolInfo
      {
        QSize m_size;
        QString m_fullFileName;
        QString m_symbolID;

        m2::Packer::handle_t m_handle;

        SymbolInfo() {}
        SymbolInfo(QSize size, QString const & fullFileName, QString const & symbolID)
          : m_size(size), m_fullFileName(fullFileName), m_symbolID(symbolID) {}
      };

      typedef vector<SymbolInfo> TSymbols;

      struct SkinPageInfo
      {
        TSymbols m_symbols;
        int m_width;
        int m_height;
        string m_fileName;
        string m_dir;
        string m_suffix;
        m2::Packer m_packer;
      };

  private:

      bool m_needColorCorrection;

      QSvgRenderer m_svgRenderer;

      typedef vector<SkinPageInfo> TSkinPages;
      TSkinPages m_pages;

      bool m_overflowDetected;
      void markOverflow();

  public:

      SkinGenerator(bool needColorCorrection);
      //void processFont(string const & fileName, string const & skinName, vector<int8_t> const & fontSizes, int symbolScale);
      void processSymbols(string const & symbolsDir,
                          string const & skinName,
                          vector<QSize> const & symbolSizes,
                          vector<string> const & suffix);
      void renderPages();
      bool writeToFile(string const & skinName);
      void writeToFileNewStyle(string const & skinName);
    };
} // namespace tools