Fill.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libmspub project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef INCLUDED_FILL_H
11 #define INCLUDED_FILL_H
12
13 #include <cstddef>
14 #include <vector>
15
16 #include <librevenge/librevenge.h>
17
18 #include "ColorReference.h"
19
20 namespace libmspub
21 {
22 class MSPUBCollector;
23 class Fill
24 {
25 protected:
26 const MSPUBCollector *m_owner;
27 public:
28 Fill(const MSPUBCollector *owner);
29 virtual void getProperties(librevenge::RVNGPropertyList *out) const = 0;
30 virtual ~Fill() { }
31 private:
32 Fill(const Fill &) : m_owner(nullptr) { }
33 Fill &operator=(const Fill &);
34 };
35
36 class ImgFill : public Fill
37 {
38 protected:
39 unsigned m_imgIndex;
40 private:
41 bool m_isTexture;
42 protected:
43 int m_rotation;
44 public:
45 ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation);
46 void getProperties(librevenge::RVNGPropertyList *out) const override;
47 private:
48 ImgFill(const ImgFill &) : Fill(nullptr), m_imgIndex(0), m_isTexture(false), m_rotation(0) { }
49 ImgFill &operator=(const ImgFill &);
50 };
51
52 class PatternFill : public ImgFill
53 {
54 ColorReference m_fg;
55 ColorReference m_bg;
56 public:
57 PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
58 void getProperties(librevenge::RVNGPropertyList *out) const override;
59 private:
60 PatternFill(const PatternFill &) : ImgFill(0, nullptr, true, 0), m_fg(0x08000000), m_bg(0x08000000) { }
61 PatternFill &operator=(const ImgFill &);
62 };
63
64 class SolidFill : public Fill
65 {
66 ColorReference m_color;
67 double m_opacity;
68 public:
69 SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
70 void getProperties(librevenge::RVNGPropertyList *out) const override;
71 private:
72 SolidFill(const SolidFill &) : Fill(nullptr), m_color(0x08000000), m_opacity(1) { }
73 SolidFill &operator=(const SolidFill &);
74 };
75
76 class GradientFill : public Fill
77 {
78 struct StopInfo
79 {
80 ColorReference m_colorReference;
81 unsigned m_offsetPercent;
82 double m_opacity;
83 StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity) : m_colorReference(colorReference), m_offsetPercent(offsetPercent), m_opacity(opacity) { }
84 };
85 std::vector<StopInfo> m_stops;
86 double m_angle;
87 int m_type;
88 double m_fillLeftVal;
89 double m_fillTopVal;
90 double m_fillRightVal;
91 double m_fillBottomVal;
92 public:
93 GradientFill(const MSPUBCollector *owner, double angle = 0, int type = 7);
94 void setFillCenter(double left, double top, double right, double bottom);
95 void addColor(ColorReference c, unsigned offsetPercent, double opacity);
96 void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity);
97 void completeComplexFill();
98 void getProperties(librevenge::RVNGPropertyList *out) const override;
99 private:
100 GradientFill(const GradientFill &) : Fill(nullptr), m_stops(), m_angle(0), m_type(7), m_fillLeftVal(0.0), m_fillTopVal(0.0), m_fillRightVal(0.0), m_fillBottomVal(0.0) { }
101 GradientFill &operator=(const GradientFill &);
102 };
103 }
104
105 #endif /* INCLUDED_FILL_H */
106 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libmspub::Fill::m_owner
const MSPUBCollector * m_owner
Definition: Fill.h:26
libmspub::ImgFill::ImgFill
ImgFill(const ImgFill &)
Definition: Fill.h:48
libmspub::GradientFill::m_stops
std::vector< StopInfo > m_stops
Definition: Fill.h:85
libmspub::SolidFill::SolidFill
SolidFill(const SolidFill &)
Definition: Fill.h:72
libmspub::GradientFill::StopInfo::m_opacity
double m_opacity
Definition: Fill.h:82
libmspub::SolidFill::m_color
ColorReference m_color
Definition: Fill.h:66
libmspub::GradientFill::m_fillRightVal
double m_fillRightVal
Definition: Fill.h:90
ColorReference.h
libmspub::ImgFill::operator=
ImgFill & operator=(const ImgFill &)
libmspub::GradientFill::m_fillBottomVal
double m_fillBottomVal
Definition: Fill.h:91
libmspub::Fill
Definition: Fill.h:23
libmspub::GradientFill::m_type
int m_type
Definition: Fill.h:87
libmspub::GradientFill::StopInfo::StopInfo
StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity)
Definition: Fill.h:83
libmspub::PatternFill::operator=
PatternFill & operator=(const ImgFill &)
libmspub::GradientFill::operator=
GradientFill & operator=(const GradientFill &)
libmspub::GradientFill::m_angle
double m_angle
Definition: Fill.h:86
libmspub::SolidFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const override
Definition: Fill.cpp:89
libmspub::ImgFill
Definition: Fill.h:36
libmspub::ImgFill::m_isTexture
bool m_isTexture
Definition: Fill.h:41
libmspub::PatternFill::PatternFill
PatternFill(const PatternFill &)
Definition: Fill.h:60
libmspub::PatternFill::m_fg
ColorReference m_fg
Definition: Fill.h:54
libmspub::PatternFill
Definition: Fill.h:52
libmspub::ColorReference
Definition: ColorReference.h:17
libmspub::GradientFill::addColorReverse
void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity)
Definition: Fill.cpp:117
libmspub::GradientFill::StopInfo::m_colorReference
ColorReference m_colorReference
Definition: Fill.h:80
libmspub::Fill::~Fill
virtual ~Fill()
Definition: Fill.h:30
libmspub::GradientFill
Definition: Fill.h:76
libmspub::SolidFill::operator=
SolidFill & operator=(const SolidFill &)
libmspub::ImgFill::m_rotation
int m_rotation
Definition: Fill.h:43
libmspub::ImgFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const override
Definition: Fill.cpp:27
libmspub::ImgFill::ImgFill
ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation)
Definition: Fill.cpp:23
libmspub::GradientFill::addColor
void addColor(ColorReference c, unsigned offsetPercent, double opacity)
Definition: Fill.cpp:112
libmspub::GradientFill::StopInfo::m_offsetPercent
unsigned m_offsetPercent
Definition: Fill.h:81
libmspub::PatternFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const override
Definition: Fill.cpp:53
libmspub::ImgFill::m_imgIndex
unsigned m_imgIndex
Definition: Fill.h:39
libmspub::PatternFill::m_bg
ColorReference m_bg
Definition: Fill.h:55
libmspub::GradientFill::m_fillLeftVal
double m_fillLeftVal
Definition: Fill.h:88
libmspub::Fill::Fill
Fill(const MSPUBCollector *owner)
Definition: Fill.cpp:19
libmspub
Definition: Arrow.h:13
libmspub::GradientFill::GradientFill
GradientFill(const MSPUBCollector *owner, double angle=0, int type=7)
Definition: Fill.cpp:100
libmspub::Fill::operator=
Fill & operator=(const Fill &)
libmspub::GradientFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const override
Definition: Fill.cpp:132
libmspub::GradientFill::completeComplexFill
void completeComplexFill()
Definition: Fill.cpp:122
libmspub::SolidFill::SolidFill
SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner)
Definition: Fill.cpp:85
libmspub::GradientFill::setFillCenter
void setFillCenter(double left, double top, double right, double bottom)
Definition: Fill.cpp:104
libmspub::MSPUBCollector
Definition: MSPUBCollector.h:43
libmspub::GradientFill::GradientFill
GradientFill(const GradientFill &)
Definition: Fill.h:100
libmspub::SolidFill
Definition: Fill.h:64
libmspub::GradientFill::m_fillTopVal
double m_fillTopVal
Definition: Fill.h:89
libmspub::Fill::Fill
Fill(const Fill &)
Definition: Fill.h:32
libmspub::PatternFill::PatternFill
PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg)
Definition: Fill.cpp:49
libmspub::Fill::getProperties
virtual void getProperties(librevenge::RVNGPropertyList *out) const =0
libmspub::SolidFill::m_opacity
double m_opacity
Definition: Fill.h:67
libmspub::GradientFill::StopInfo
Definition: Fill.h:78