Fill.h Source File documentation

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 <vector>
14
15#include <librevenge/librevenge.h>
16
17#include "ColorReference.h"
18
19namespace libmspub
20{
21class MSPUBCollector;
22 class Fill
23{
24protected:
25 const MSPUBCollector *m_owner;
26public:
27 Fill(const MSPUBCollector *owner);
28 virtual void getProperties(librevenge::RVNGPropertyList *out) const = 0;
29 virtual ~Fill() { }
30private:
31 Fill(const Fill &) : m_owner(nullptr) { }
32 Fill &operator=(const Fill &);
33};
34
35 class ImgFill : public Fill
36{
37protected:
38 unsigned m_imgIndex;
39private:
40 bool m_isTexture;
41protected:
42 int m_rotation;
43public:
44 ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation);
45 void getProperties(librevenge::RVNGPropertyList *out) const override;
46private:
47 ImgFill(const ImgFill &) : Fill(nullptr), m_imgIndex(0), m_isTexture(false), m_rotation(0) { }
48 ImgFill &operator=(const ImgFill &);
49};
50
51 class PatternFill : public ImgFill
52{
53 ColorReference m_fg;
54 ColorReference m_bg;
55public:
56 PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
57 void getProperties(librevenge::RVNGPropertyList *out) const override;
58private:
59 PatternFill(const PatternFill &) : ImgFill(0, nullptr, true, 0), m_fg(0x08000000), m_bg(0x08000000) { }
60 PatternFill &operator=(const ImgFill &);
61};
62
63 class SolidFill : public Fill
64{
65 ColorReference m_color;
66 double m_opacity;
67public:
68 SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
69 void getProperties(librevenge::RVNGPropertyList *out) const override;
70private:
71 SolidFill(const SolidFill &) : Fill(nullptr), m_color(0x08000000), m_opacity(1) { }
72 SolidFill &operator=(const SolidFill &);
73};
74
75 class GradientFill : public Fill
76{
77 struct StopInfo
78 {
79 ColorReference m_colorReference;
80 unsigned m_offsetPercent;
81 double m_opacity;
82 StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity) : m_colorReference(colorReference), m_offsetPercent(offsetPercent), m_opacity(opacity) { }
83 };
84 std::vector<StopInfo> m_stops;
85 double m_angle;
86 int m_type;
87 double m_fillLeftVal;
88 double m_fillTopVal;
89 double m_fillRightVal;
90 double m_fillBottomVal;
91public:
92 GradientFill(const MSPUBCollector *owner, double angle = 0, int type = 7);
93 void setFillCenter(double left, double top, double right, double bottom);
94 void addColor(ColorReference c, unsigned offsetPercent, double opacity);
95 void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity);
96 void completeComplexFill();
97 void getProperties(librevenge::RVNGPropertyList *out) const override;
98private:
99 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) { }
100 GradientFill &operator=(const GradientFill &);
101};
102}
103
104#endif /* INCLUDED_FILL_H */
105/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
ColorReference.h
libmspub::ColorReference
Definition ColorReference.h:20
libmspub::Fill
Definition Fill.h:23
libmspub::Fill::Fill
Fill(const Fill &)
Definition Fill.h:31
libmspub::Fill::getProperties
virtual void getProperties(librevenge::RVNGPropertyList *out) const =0
libmspub::Fill::operator=
Fill & operator=(const Fill &)
libmspub::Fill::m_owner
const MSPUBCollector * m_owner
Definition Fill.h:25
libmspub::Fill::~Fill
virtual ~Fill()
Definition Fill.h:29
libmspub::GradientFill
Definition Fill.h:76
libmspub::GradientFill::m_fillRightVal
double m_fillRightVal
Definition Fill.h:89
libmspub::GradientFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const override
Definition Fill.cpp:134
libmspub::GradientFill::addColor
void addColor(ColorReference c, unsigned offsetPercent, double opacity)
Definition Fill.cpp:114
libmspub::GradientFill::m_fillBottomVal
double m_fillBottomVal
Definition Fill.h:90
libmspub::GradientFill::m_fillTopVal
double m_fillTopVal
Definition Fill.h:88
libmspub::GradientFill::addColorReverse
void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity)
Definition Fill.cpp:119
libmspub::GradientFill::m_type
int m_type
Definition Fill.h:86
libmspub::GradientFill::m_stops
std::vector< StopInfo > m_stops
Definition Fill.h:84
libmspub::GradientFill::setFillCenter
void setFillCenter(double left, double top, double right, double bottom)
Definition Fill.cpp:106
libmspub::GradientFill::m_fillLeftVal
double m_fillLeftVal
Definition Fill.h:87
libmspub::GradientFill::operator=
GradientFill & operator=(const GradientFill &)
libmspub::GradientFill::m_angle
double m_angle
Definition Fill.h:85
libmspub::GradientFill::GradientFill
GradientFill(const GradientFill &)
Definition Fill.h:99
libmspub::GradientFill::completeComplexFill
void completeComplexFill()
Definition Fill.cpp:124
libmspub::ImgFill
Definition Fill.h:36
libmspub::ImgFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const override
Definition Fill.cpp:29
libmspub::ImgFill::m_imgIndex
unsigned m_imgIndex
Definition Fill.h:38
libmspub::ImgFill::m_isTexture
bool m_isTexture
Definition Fill.h:40
libmspub::ImgFill::operator=
ImgFill & operator=(const ImgFill &)
libmspub::ImgFill::m_rotation
int m_rotation
Definition Fill.h:42
libmspub::ImgFill::ImgFill
ImgFill(const ImgFill &)
Definition Fill.h:47
libmspub::MSPUBCollector
Definition MSPUBCollector.h:45
libmspub::PatternFill
Definition Fill.h:52
libmspub::PatternFill::operator=
PatternFill & operator=(const ImgFill &)
libmspub::PatternFill::m_bg
ColorReference m_bg
Definition Fill.h:54
libmspub::PatternFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const override
Definition Fill.cpp:55
libmspub::PatternFill::m_fg
ColorReference m_fg
Definition Fill.h:53
libmspub::PatternFill::PatternFill
PatternFill(const PatternFill &)
Definition Fill.h:59
libmspub::SolidFill
Definition Fill.h:64
libmspub::SolidFill::SolidFill
SolidFill(const SolidFill &)
Definition Fill.h:71
libmspub::SolidFill::m_opacity
double m_opacity
Definition Fill.h:66
libmspub::SolidFill::m_color
ColorReference m_color
Definition Fill.h:65
libmspub::SolidFill::operator=
SolidFill & operator=(const SolidFill &)
libmspub::SolidFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const override
Definition Fill.cpp:91
libmspub
Definition Arrow.h:14
libmspub::GradientFill::StopInfo
Definition Fill.h:78
libmspub::GradientFill::StopInfo::m_offsetPercent
unsigned m_offsetPercent
Definition Fill.h:80
libmspub::GradientFill::StopInfo::StopInfo
StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity)
Definition Fill.h:82
libmspub::GradientFill::StopInfo::m_opacity
double m_opacity
Definition Fill.h:81
libmspub::GradientFill::StopInfo::m_colorReference
ColorReference m_colorReference
Definition Fill.h:79