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

pen.hpp « graphics - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 93a813bc3b88dff0fa01259b568a8658f556ebfb (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
85
86
87
88
#pragma once

#include "resource.hpp"
#include "icon.hpp"
#include "color.hpp"

#include "../geometry/point2d.hpp"

#include "../base/buffer_vector.hpp"

namespace graphics
{
  struct Pen : public Resource
  {
    /// definition of the line style pattern
    /// used as a texture-cache-key
    struct Info : public Resource::Info
    {
      enum ELineJoin
      {
        ERoundJoin,
        EBevelJoin,
        ENoJoin
      };

      enum ELineCap
      {
        ERoundCap,
        EButtCap,
        ESquareCap
      };

      typedef buffer_vector<double, 16> TPattern;
      Color m_color;
      double m_w;
      TPattern m_pat;
      double m_offset;
      Icon::Info m_icon;
      double m_step;
      ELineJoin m_join;
      ELineCap m_cap;

      bool m_isSolid;

      Info(Color const & color = Color(0, 0, 0, 255),
           double width = 1.0,
           double const * pattern = 0,
           size_t patternSize = 0,
           double offset = 0,
           char const * symbol = 0,
           double step = 0,
           ELineJoin join = ERoundJoin,
           ELineCap cap = ERoundCap);

      double firstDashOffset() const;
      bool atDashOffset(double offset) const;

      Resource::Info const & cacheKey() const;
      m2::PointU const resourceSize() const;
      Resource * createResource(m2::RectU const & texRect,
                                uint8_t pipelineID) const;

      bool lessThan(Resource::Info const * r) const;
    };

    Info m_info;

    bool m_isSolid;

    m2::PointU m_centerColorPixel;
    m2::PointU m_borderColorPixel;

    Pen(m2::RectU const & texRect,
        int pipelineID,
        Info const & info);

    /// with antialiasing zones
    double geometryTileLen() const;
    double geometryTileWidth() const;

    /// without antialiasing zones
    double rawTileLen() const;
    double rawTileWidth() const;

    void render(void * dst);
    Resource::Info const * info() const;
  };
}