Fill.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This file is part of the libmspub project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_FILL_H
#define INCLUDED_FILL_H
#include <vector>
#include <librevenge/librevenge.h>
#include "ColorReference.h"
namespace libmspub
{
class MSPUBCollector;
class Fill
{
protected:
const MSPUBCollector *m_owner;
public:
Fill(const MSPUBCollector *owner);
virtual void getProperties(librevenge::RVNGPropertyList *out) const = 0;
virtual ~Fill() { }
private:
Fill(const Fill &) : m_owner(nullptr) { }
Fill &operator=(const Fill &);
};
class ImgFill : public Fill
{
protected:
unsigned m_imgIndex;
private:
bool m_isTexture;
protected:
int m_rotation;
public:
ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation);
void getProperties(librevenge::RVNGPropertyList *out) const override;
private:
ImgFill(const ImgFill &) : Fill(nullptr), m_imgIndex(0), m_isTexture(false), m_rotation(0) { }
ImgFill &operator=(const ImgFill &);
};
class PatternFill : public ImgFill
{
ColorReference m_fg;
ColorReference m_bg;
public:
PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
void getProperties(librevenge::RVNGPropertyList *out) const override;
private:
PatternFill(const PatternFill &) : ImgFill(0, nullptr, true, 0), m_fg(0x08000000), m_bg(0x08000000) { }
PatternFill &operator=(const ImgFill &);
};
class SolidFill : public Fill
{
ColorReference m_color;
double m_opacity;
public:
SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
void getProperties(librevenge::RVNGPropertyList *out) const override;
private:
SolidFill(const SolidFill &) : Fill(nullptr), m_color(0x08000000), m_opacity(1) { }
SolidFill &operator=(const SolidFill &);
};
class GradientFill : public Fill
{
struct StopInfo
{
ColorReference m_colorReference;
unsigned m_offsetPercent;
double m_opacity;
StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity) : m_colorReference(colorReference), m_offsetPercent(offsetPercent), m_opacity(opacity) { }
};
std::vector<StopInfo> m_stops;
double m_angle;
int m_type;
double m_fillLeftVal;
double m_fillTopVal;
double m_fillRightVal;
double m_fillBottomVal;
public:
GradientFill(const MSPUBCollector *owner, double angle = 0, int type = 7);
void setFillCenter(double left, double top, double right, double bottom);
void addColor(ColorReference c, unsigned offsetPercent, double opacity);
void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity);
void completeComplexFill();
void getProperties(librevenge::RVNGPropertyList *out) const override;
private:
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) { }
GradientFill &operator=(const GradientFill &);
};
}
#endif /* INCLUDED_FILL_H */
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
ColorReference.h
libmspub::ColorReference
Definition ColorReference.h:20
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
Fill(const MSPUBCollector *owner)
Definition Fill.cpp:21
libmspub::Fill::~Fill
virtual ~Fill()
Definition Fill.h:29
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::GradientFill
GradientFill(const MSPUBCollector *owner, double angle=0, int type=7)
Definition Fill.cpp:102
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::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(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation)
Definition Fill.cpp:25
libmspub::ImgFill::ImgFill
ImgFill(const ImgFill &)
Definition Fill.h:47
libmspub::MSPUBCollector
Definition MSPUBCollector.h:45
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(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg)
Definition Fill.cpp:51
libmspub::PatternFill::PatternFill
PatternFill(const PatternFill &)
Definition Fill.h:59
libmspub::SolidFill::SolidFill
SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner)
Definition Fill.cpp:87
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::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