33 #ifndef MWAW_GRAPHIC_STYLE 34 # define MWAW_GRAPHIC_STYLE 39 # include "librevenge/librevenge.h" 78 o <<
"offset=" << st.
m_offset <<
",";
79 o <<
"color=" << st.
m_color <<
",";
81 o <<
"opacity=" << st.
m_opacity*100.f <<
"%,";
97 Pattern() : m_dim(0,0), m_data(), m_picture(), m_pictureMime(
""), m_pictureAverageColor(
MWAWColor::white())
104 m_dim(dim), m_data(), m_picture(picture), m_pictureMime(mime), m_pictureAverageColor(avColor)
114 if (m_dim[0]==0 || m_dim[1]==0)
return true;
115 if (m_picture.size())
return false;
116 if (m_dim[0]!=8 && m_dim[0]!=16 && m_dim[0]!=32)
return true;
117 return m_data.size()!=size_t((m_dim[0]/8)*m_dim[1]);
120 bool getAverageColor(
MWAWColor &col)
const;
122 bool getUniqueColor(
MWAWColor &col)
const;
124 bool getBinary(librevenge::RVNGBinaryData &data, std::string &type)
const;
129 int diff = m_dim.cmp(a.
m_dim);
130 if (diff)
return diff;
131 if (m_data.size() < a.
m_data.size())
return -1;
132 if (m_data.size() > a.
m_data.size())
return 1;
133 for (
size_t h=0; h < m_data.size(); ++h) {
134 if (m_data[h]<a.
m_data[h])
return 1;
135 if (m_data[h]>a.
m_data[h])
return -1;
137 for (
int i=0; i<2; ++i) {
138 if (m_colors[i] < a.
m_colors[i])
return 1;
139 if (m_colors[i] > a.
m_colors[i])
return -1;
145 if (m_picture.size() < a.
m_picture.size())
return 1;
146 if (m_picture.size() > a.
m_picture.size())
return -1;
147 const unsigned char *ptr=m_picture.getDataBuffer();
148 const unsigned char *aPtr=a.
m_picture.getDataBuffer();
149 if (!ptr || !aPtr)
return 0;
150 for (
unsigned long h=0; h < m_picture.size(); ++h, ++ptr, ++aPtr) {
151 if (*ptr < *aPtr)
return 1;
152 if (*ptr > *aPtr)
return -1;
159 o <<
"dim=" << pat.
m_dim <<
",";
168 for (
size_t h=0; h < pat.
m_data.size(); ++h)
169 o << std::hex << (
int) pat.
m_data[h] << std::dec <<
",";
287 std::vector<MWAWBorder>
const &
borders()
const 301 void addTo(librevenge::RVNGPropertyList &pList,
bool only1d=
false)
const;
303 void addFrameTo(librevenge::RVNGPropertyList &pList)
const;
bool m_flip[2]
two bool to indicated we need to flip the shape or not
Definition: MWAWGraphicStyle.hxx:374
friend std::ostream & operator<<(std::ostream &o, GradientStop const &st)
a print operator
Definition: MWAWGraphicStyle.hxx:76
bool hasSurfaceColor() const
returns true if the surface is defined
Definition: MWAWGraphicStyle.hxx:224
MWAWVec2i m_dim
the dimension width x height
Definition: MWAWGraphicStyle.hxx:175
bool empty() const
return true if we does not have a pattern
Definition: MWAWGraphicStyle.hxx:112
MWAWColor m_surfaceColor
the surface color
Definition: MWAWGraphicStyle.hxx:322
std::string m_frameNextName
the frame next name (if there is a link)
Definition: MWAWGraphicStyle.hxx:365
MWAWColor m_shadowColor
the shadow color
Definition: MWAWGraphicStyle.hxx:327
Definition: MWAWGraphicStyle.hxx:53
float m_opacity
the opacity
Definition: MWAWGraphicStyle.hxx:89
float m_backgroundOpacity
true if the background has some color
Definition: MWAWGraphicStyle.hxx:359
std::string m_frameName
the frame name
Definition: MWAWGraphicStyle.hxx:363
float m_shadowOpacity
true if the shadow has some color
Definition: MWAWGraphicStyle.hxx:329
Pattern()
constructor
Definition: MWAWGraphicStyle.hxx:97
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:226
MWAWGraphicStyle()
constructor
Definition: MWAWGraphicStyle.hxx:190
Definition: MWAWGraphicStyle.hxx:55
MWAWVec2f m_gradientPercentCenter
the gradient center
Definition: MWAWGraphicStyle.hxx:345
MWAWColor m_colors[2]
the two indexed colors
Definition: MWAWGraphicStyle.hxx:178
LineCap
an enum used to define the basic line cap
Definition: MWAWGraphicStyle.hxx:51
LineJoin m_lineJoin
the line join
Definition: MWAWGraphicStyle.hxx:314
MWAWColor m_lineColor
the line color
Definition: MWAWGraphicStyle.hxx:318
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:221
float m_gradientRadius
the gradient radius
Definition: MWAWGraphicStyle.hxx:347
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
Definition: MWAWGraphicStyle.hxx:51
GradientType
an enum used to define the gradient type
Definition: MWAWGraphicStyle.hxx:55
Definition: MWAWGraphicStyle.hxx:55
std::string m_pictureMime
the picture type
Definition: MWAWGraphicStyle.hxx:185
void addTo(librevenge::RVNGPropertyList &pList, bool only1d=false) const
add all the parameters to the propList excepted the frame parameter: the background and the borders ...
Definition: MWAWGraphicStyle.cxx:158
bool hasSameBorders() const
return true if the frame has some border
Definition: MWAWGraphicStyle.hxx:276
void addFrameTo(librevenge::RVNGPropertyList &pList) const
add all the frame parameters to propList: the background and the borders
Definition: MWAWGraphicStyle.cxx:337
the class to store a color
Definition: libmwaw_internal.hxx:177
bool m_arrows[2]
two bool to indicated if extremity has arrow or not
Definition: MWAWGraphicStyle.hxx:350
Definition: MWAWGraphicStyle.hxx:51
bool hasGradient(bool complex=false) const
returns true if the gradient is defined
Definition: MWAWGraphicStyle.hxx:239
float m_rotate
the rotation
Definition: MWAWGraphicStyle.hxx:372
std::vector< float > m_lineDashWidth
the dash array: a sequence of (fullsize, emptysize)
Definition: MWAWGraphicStyle.hxx:310
a structure used to define the gradient limit
Definition: MWAWGraphicStyle.hxx:58
a border
Definition: libmwaw_internal.hxx:309
Definition: MWAWGraphicStyle.hxx:55
std::string m_extra
extra data
Definition: MWAWGraphicStyle.hxx:377
bool hasPattern() const
returns true if the pattern is defined
Definition: MWAWGraphicStyle.hxx:234
MWAWVec2f m_shadowOffset
the shadow offset
Definition: MWAWGraphicStyle.hxx:331
void setPattern(Pattern const &pat)
set the pattern
Definition: MWAWGraphicStyle.hxx:229
LineCap m_lineCap
the line cap
Definition: MWAWGraphicStyle.hxx:312
float m_surfaceOpacity
true if the surface has some color
Definition: MWAWGraphicStyle.hxx:324
float m_gradientBorder
the gradient border opacity
Definition: MWAWGraphicStyle.hxx:343
GradientType m_gradientType
the gradient type
Definition: MWAWGraphicStyle.hxx:337
MWAWColor m_backgroundColor
the background color
Definition: MWAWGraphicStyle.hxx:357
Definition: MWAWGraphicStyle.hxx:53
float m_gradientAngle
the gradient angle
Definition: MWAWGraphicStyle.hxx:341
bool hasBackgroundColor() const
returns true if the background is defined
Definition: MWAWGraphicStyle.hxx:255
Pattern m_pattern
the pattern if it exists
Definition: MWAWGraphicStyle.hxx:334
bool hasBorders() const
return true if the frame has some border
Definition: MWAWGraphicStyle.hxx:271
Definition: MWAWGraphicStyle.hxx:53
void setSurfaceColor(MWAWColor const &col, float opacity=1)
set the surface color
Definition: MWAWGraphicStyle.hxx:218
Definition: MWAWGraphicStyle.hxx:51
virtual ~MWAWGraphicStyle()
virtual destructor
Definition: MWAWGraphicStyle.hxx:211
librevenge::RVNGBinaryData m_picture
a picture
Definition: MWAWGraphicStyle.hxx:183
bool m_fillRuleEvenOdd
true if the fill rule is evenod
Definition: MWAWGraphicStyle.hxx:320
bool hasSurface() const
returns true if the interior surface is defined
Definition: MWAWGraphicStyle.hxx:244
Definition: MWAWGraphicStyle.hxx:55
std::vector< MWAWBorder > const & borders() const
return the frame border: libmwaw::Left | ...
Definition: MWAWGraphicStyle.hxx:287
Definition: MWAWGraphicStyle.hxx:55
int cmp(GradientStop const &a) const
compare two gradient
Definition: MWAWGraphicStyle.hxx:65
MWAWColor m_color
the color
Definition: MWAWGraphicStyle.hxx:87
Definition: MWAWGraphicStyle.hxx:55
Pattern(MWAWVec2i dim, librevenge::RVNGBinaryData const &picture, std::string const &mime, MWAWColor const &avColor)
constructor from a binary data
Definition: MWAWGraphicStyle.hxx:103
bool hasShadow() const
returns true if the shadow is defined
Definition: MWAWGraphicStyle.hxx:266
std::vector< MWAWBorder > m_bordersList
the borders MWAWBorder::Pos (for a frame)
Definition: MWAWGraphicStyle.hxx:361
LineJoin
an enum used to define the basic line join
Definition: MWAWGraphicStyle.hxx:53
void setShadowColor(MWAWColor const &col, float opacity=1)
set the shadow color
Definition: MWAWGraphicStyle.hxx:260
float m_lineOpacity
the line opacity: 0=transparent
Definition: MWAWGraphicStyle.hxx:316
MWAWColor m_pictureAverageColor
the picture average color
Definition: MWAWGraphicStyle.hxx:187
void setBackgroundColor(MWAWColor const &col, float opacity=1)
set the background color
Definition: MWAWGraphicStyle.hxx:249
float m_lineWidth
the linewidth
Definition: MWAWGraphicStyle.hxx:308
friend std::ostream & operator<<(std::ostream &o, Pattern const &pat)
a print operator
Definition: MWAWGraphicStyle.hxx:157
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:265
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:260
bool hasLine() const
returns true if the border is defined
Definition: MWAWGraphicStyle.hxx:213
std::vector< unsigned char > m_data
the pattern data: a sequence of data: p[0..7,0],p[8..15,0]...p[0..7,1],p[8..15,1], ...
Definition: MWAWGraphicStyle.hxx:180
int cmp(Pattern const &a) const
compare two patterns
Definition: MWAWGraphicStyle.hxx:127
GradientStop(float offset=0.0, MWAWColor const &col=MWAWColor::black(), float opacity=1.0)
constructor
Definition: MWAWGraphicStyle.hxx:60
a basic pattern used in a MWAWGraphicStyle:
Definition: MWAWGraphicStyle.hxx:95
float m_offset
the offset
Definition: MWAWGraphicStyle.hxx:85
void setBorders(int wh, MWAWBorder const &border)
sets the cell border: wh=libmwaw::LeftBit|...
Definition: MWAWGraphicStyle.cxx:139
Definition: MWAWGraphicStyle.hxx:55
std::vector< GradientStop > m_gradientStopList
the list of gradient limits
Definition: MWAWGraphicStyle.hxx:339
static MWAWGraphicStyle emptyStyle()
returns an empty style.
Definition: MWAWGraphicStyle.hxx:204
void resetBorders()
reset the border
Definition: MWAWGraphicStyle.hxx:292
virtual ~Pattern()
virtual destructor
Definition: MWAWGraphicStyle.hxx:110