MWAWGraphicStyle.hxx Source File documentation

MWAWGraphicStyle.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33 #ifndef MWAW_GRAPHIC_STYLE
34 # define MWAW_GRAPHIC_STYLE
35 # include <ostream>
36 # include <string>
37 # include <vector>
38
39 # include "librevenge/librevenge.h"
40 # include "libmwaw_internal.hxx"
41
47 class MWAWGraphicStyle
48 {
49 public:
51 enum LineCap { C_Butt, C_Square, C_Round };
53 enum LineJoin { J_Miter, J_Round, J_Bevel };
54
56 struct Arrow {
58 Arrow()
59 : m_viewBox()
60 , m_path("")
61 , m_width(0)
62 , m_isCentered(false)
63 {
64 }
66 Arrow(float w, MWAWBox2i const &box, std::string const &path, bool centered=false)
67 : m_viewBox(box)
68 , m_path(path)
69 , m_width(w)
70 , m_isCentered(centered)
71 {
72 }
74 static Arrow plain()
75 {
76 return Arrow(5, MWAWBox2i(MWAWVec2i(0,0),MWAWVec2i(20,30)), "m10 0-10 30h20z", false);
77 }
79 friend std::ostream &operator<<(std::ostream &o, Arrow const &arrow)
80 {
81 if (arrow.isEmpty()) return o;
82 o << "w=" << arrow.m_width << ",";
83 o << "viewbox=" << arrow.m_viewBox << ",";
84 o << "path=" << arrow.m_path << ",";
85 if (arrow.m_isCentered) o << "centered,";
86 return o;
87 }
89 bool operator==(Arrow const &arrow) const
90 {
91 return m_width>=arrow.m_width && m_width<=arrow.m_width &&
92 m_viewBox==arrow.m_viewBox && m_path==arrow.m_path && m_isCentered==arrow.m_isCentered;
93 }
95 bool operator!=(Arrow const &arrow) const
96 {
97 return !(*this==arrow);
98 }
100 bool operator<(Arrow const &arrow) const
101 {
102 if (m_isCentered<arrow.m_isCentered) return m_isCentered ? true : false;
103 return m_width<arrow.m_width && m_viewBox<arrow.m_viewBox && m_path < arrow.m_path;
104 }
106 bool operator<=(Arrow const &arrow) const
107 {
108 return *this<arrow || *this==arrow;
109 }
111 bool operator>(Arrow const &arrow) const
112 {
113 return !(*this<=arrow);
114 }
116 bool operator>=(Arrow const &arrow) const
117 {
118 return !(*this<arrow);
119 }
121 bool isEmpty() const
122 {
123 return m_width<=0 || m_path.empty();
124 }
126 void addTo(librevenge::RVNGPropertyList &propList, std::string const &type) const;
127
129 MWAWBox2i m_viewBox;
131 std::string m_path;
133 float m_width;
135 bool m_isCentered;
136 };
137
139 struct Gradient {
141 struct Stop {
143 explicit Stop(float offset=0.0, MWAWColor const &col=MWAWColor::black(), float opacity=1.0)
144 : m_offset(offset)
145 , m_color(col)
146 , m_opacity(opacity)
147 {
148 }
150 int cmp(Stop const &a) const
151 {
152 if (m_offset < a.m_offset) return -1;
153 if (m_offset > a.m_offset) return 1;
154 if (m_color < a.m_color) return -1;
155 if (m_color > a.m_color) return 1;
156 if (m_opacity < a.m_opacity) return -1;
157 if (m_opacity > a.m_opacity) return 1;
158 return 0;
159 }
161 friend std::ostream &operator<<(std::ostream &o, Stop const &st)
162 {
163 o << "offset=" << st.m_offset << ",";
164 o << "color=" << st.m_color << ",";
165 if (st.m_opacity<1)
166 o << "opacity=" << st.m_opacity*100.f << "%,";
167 return o;
168 }
170 float m_offset;
172 MWAWColor m_color;
174 float m_opacity;
175 };
177 enum Type { G_None, G_Axial, G_Linear, G_Radial, G_Rectangular, G_Square, G_Ellipsoid };
179 Gradient()
180 : m_type(G_None)
181 , m_stopList()
182 , m_angle(0)
183 , m_border(0)
184 , m_percentCenter(0.5f,0.5f)
185 , m_radius(1)
186 {
187 m_stopList.push_back(Stop(0.0, MWAWColor::white()));
188 m_stopList.push_back(Stop(1.0, MWAWColor::black()));
189 }
191 bool hasGradient(bool complex=false) const
192 {
193 return m_type != G_None && static_cast<int>(m_stopList.size()) >= (complex ? 3 : 2);
194 }
196 void addTo(librevenge::RVNGPropertyList &propList) const;
198 friend std::ostream &operator<<(std::ostream &o, Gradient const &grad)
199 {
200 switch (grad.m_type) {
201 case Gradient::G_Axial:
202 o << "axial,";
203 break;
204 case Gradient::G_Linear:
205 o << "linear,";
206 break;
207 case Gradient::G_Radial:
208 o << "radial,";
209 break;
210 case Gradient::G_Rectangular:
211 o << "rectangular,";
212 break;
213 case Gradient::G_Square:
214 o << "square,";
215 break;
216 case Gradient::G_Ellipsoid:
217 o << "ellipsoid,";
218 break;
219 case Gradient::G_None:
220 #if !defined(__clang__)
221 default:
222 #endif
223 break;
224 }
225 if (grad.m_angle>0 || grad.m_angle<0) o << "angle=" << grad.m_angle << ",";
226 if (grad.m_stopList.size() >= 2) {
227 o << "stops=[";
228 for (auto const &stop : grad.m_stopList)
229 o << "[" << stop << "],";
230 o << "],";
231 }
232 if (grad.m_border>0) o << "border=" << grad.m_border*100 << "%,";
233 if (grad.m_percentCenter != MWAWVec2f(0.5f,0.5f)) o << "center=" << grad.m_percentCenter << ",";
234 if (grad.m_radius<1) o << "radius=" << grad.m_radius << ",";
235 return o;
236 }
237
239 int cmp(Gradient const &a) const
240 {
241 if (m_type < a.m_type) return -1;
242 if (m_type > a.m_type) return 1;
243 if (m_angle < a.m_angle) return -1;
244 if (m_angle > a.m_angle) return 1;
245 if (m_stopList.size() < a.m_stopList.size()) return 1;
246 if (m_stopList.size() > a.m_stopList.size()) return -1;
247 for (auto c :m_stopList) {
248 int diff = c.cmp(c);
249 if (diff) return diff;
250 }
251 if (m_border < a.m_border) return -1;
252 if (m_border > a.m_border) return 1;
253 int diff=m_percentCenter.cmp(a.m_percentCenter);
254 if (diff) return diff;
255 if (m_radius < a.m_radius) return -1;
256 if (m_radius > a.m_radius) return 1;
257 return 0;
258 }
260 Type m_type;
262 std::vector<Stop> m_stopList;
264 float m_angle;
266 float m_border;
268 MWAWVec2f m_percentCenter;
270 float m_radius;
271 };
272
277 struct Pattern {
279 Pattern()
280 : m_dim(0,0)
281 , m_data()
282 , m_picture()
283 , m_pictureAverageColor(MWAWColor::white())
284 {
285 m_colors[0]=MWAWColor::black();
286 m_colors[1]=MWAWColor::white();
287 }
289 Pattern(MWAWVec2i dim, MWAWEmbeddedObject const &picture, MWAWColor const &avColor)
290 : m_dim(dim)
291 , m_data()
292 , m_picture(picture)
293 , m_pictureAverageColor(avColor)
294 {
295 m_colors[0]=MWAWColor::black();
296 m_colors[1]=MWAWColor::white();
297 }
298 Pattern(Pattern const &)=default;
299 Pattern &operator=(Pattern const &)=default;
300 Pattern &operator=(Pattern &&)=default;
302 virtual ~Pattern();
304 bool empty() const
305 {
306 if (m_dim[0]==0 || m_dim[1]==0) return true;
307 if (!m_picture.m_dataList.empty()) return false;
308 if (m_dim[0]!=8 && m_dim[0]!=16 && m_dim[0]!=32) return true;
309 return m_data.size()!=size_t((m_dim[0]/8)*m_dim[1]);
310 }
312 bool getAverageColor(MWAWColor &col) const;
314 bool getUniqueColor(MWAWColor &col) const;
316 bool getBinary(MWAWEmbeddedObject &picture) const;
317
319 int cmp(Pattern const &a) const
320 {
321 int diff = m_dim.cmp(a.m_dim);
322 if (diff) return diff;
323 if (m_data.size() < a.m_data.size()) return -1;
324 if (m_data.size() > a.m_data.size()) return 1;
325 for (size_t h=0; h < m_data.size(); ++h) {
326 if (m_data[h]<a.m_data[h]) return 1;
327 if (m_data[h]>a.m_data[h]) return -1;
328 }
329 for (int i=0; i<2; ++i) {
330 if (m_colors[i] < a.m_colors[i]) return 1;
331 if (m_colors[i] > a.m_colors[i]) return -1;
332 }
333 if (m_pictureAverageColor < a.m_pictureAverageColor) return 1;
334 if (m_pictureAverageColor > a.m_pictureAverageColor) return -1;
335 diff=m_picture.cmp(a.m_picture);
336 if (diff) return diff;
337 return 0;
338 }
340 friend std::ostream &operator<<(std::ostream &o, Pattern const &pat)
341 {
342 o << "dim=" << pat.m_dim << ",";
343 if (!pat.m_picture.isEmpty()) {
344 o << "pict=" << pat.m_picture << ",";
345 o << "col[average]=" << pat.m_pictureAverageColor << ",";
346 }
347 else {
348 if (!pat.m_colors[0].isBlack()) o << "col0=" << pat.m_colors[0] << ",";
349 if (!pat.m_colors[1].isWhite()) o << "col1=" << pat.m_colors[1] << ",";
350 o << "[";
351 for (auto data : pat.m_data)
352 o << std::hex << static_cast<int>(data) << std::dec << ",";
353 o << "],";
354 }
355 return o;
356 }
358 MWAWVec2i m_dim;
359
361 MWAWColor m_colors[2];
363 std::vector<unsigned char> m_data;
364 protected:
366 MWAWEmbeddedObject m_picture;
368 MWAWColor m_pictureAverageColor;
369 };
371 MWAWGraphicStyle()
372 : m_lineDashWidth()
373 , m_lineWidth(1)
374 , m_lineCap(C_Butt)
375 , m_lineJoin(J_Miter)
376 , m_lineOpacity(1)
377 , m_lineColor(MWAWColor::black())
378 , m_surfaceColor(MWAWColor::white())
379 , m_surfaceOpacity(0)
380 , m_shadowColor(MWAWColor::black())
381 , m_shadowOpacity(0)
382 , m_shadowOffset(1,1)
383 , m_pattern()
384 , m_gradient()
385 , m_backgroundColor(MWAWColor::white())
386 , m_backgroundOpacity(-1)
387 , m_rotate(0)
388 , m_bordersList()
389 , m_frameName("")
390 , m_frameNextName("")
391 , m_fillRuleEvenOdd(false)
392 , m_doNotPrint(false)
393 , m_extra("")
394 {
395 for (auto &fl : m_flip) fl=false;
396 }
397 MWAWGraphicStyle(MWAWGraphicStyle const &)=default;
398 MWAWGraphicStyle &operator=(MWAWGraphicStyle const &)=default;
399 MWAWGraphicStyle &operator=(MWAWGraphicStyle &&)=default;
401 static MWAWGraphicStyle emptyStyle()
402 {
403 MWAWGraphicStyle res;
404 res.m_lineWidth=0;
405 return res;
406 }
408 virtual ~MWAWGraphicStyle();
410 bool hasLine() const
411 {
412 return m_lineWidth>0 && m_lineOpacity>0;
413 }
415 void setSurfaceColor(MWAWColor const &col, float opacity = 1)
416 {
417 m_surfaceColor = col;
418 m_surfaceOpacity = opacity;
419 }
421 bool hasSurfaceColor() const
422 {
423 return m_surfaceOpacity > 0;
424 }
426 void setPattern(Pattern const &pat, float opacity = 1)
427 {
428 m_pattern=pat;
429 m_surfaceOpacity = opacity;
430 }
432 bool hasPattern() const
433 {
434 return !m_pattern.empty() && m_surfaceOpacity > 0;
435 }
437 bool hasGradient(bool complex=false) const
438 {
439 return m_gradient.hasGradient(complex);
440 }
442 bool hasSurface() const
443 {
444 return hasSurfaceColor() || hasPattern() || hasGradient();
445 }
447 void setBackgroundColor(MWAWColor const &col, float opacity = 1)
448 {
449 m_backgroundColor = col;
450 m_backgroundOpacity = opacity;
451 }
453 bool hasBackgroundColor() const
454 {
455 return m_backgroundOpacity > 0;
456 }
458 void setShadowColor(MWAWColor const &col, float opacity = 1)
459 {
460 m_shadowColor = col;
461 m_shadowOpacity = opacity;
462 }
464 bool hasShadow() const
465 {
466 return m_shadowOpacity > 0;
467 }
469 bool hasBorders() const
470 {
471 return !m_bordersList.empty();
472 }
474 bool hasSameBorders() const
475 {
476 if (m_bordersList.empty()) return true;
477 if (m_bordersList.size()!=4) return false;
478 for (size_t i=1; i<m_bordersList.size(); ++i) {
479 if (m_bordersList[i]!=m_bordersList[0])
480 return false;
481 }
482 return true;
483 }
485 std::vector<MWAWBorder> const &borders() const
486 {
487 return m_bordersList;
488 }
490 void resetBorders()
491 {
492 m_bordersList.resize(0);
493 }
495 void setBorders(int wh, MWAWBorder const &border);
497 friend std::ostream &operator<<(std::ostream &o, MWAWGraphicStyle const &st);
499 void addTo(librevenge::RVNGPropertyList &pList, bool only1d=false) const;
501 void addFrameTo(librevenge::RVNGPropertyList &pList) const;
503 int cmp(MWAWGraphicStyle const &a) const;
504
506 std::vector<float> m_lineDashWidth;
508 float m_lineWidth;
510 LineCap m_lineCap;
512 LineJoin m_lineJoin;
514 float m_lineOpacity;
516 MWAWColor m_lineColor;
518 MWAWColor m_surfaceColor;
520 float m_surfaceOpacity;
521
523 MWAWColor m_shadowColor;
525 float m_shadowOpacity;
527 MWAWVec2f m_shadowOffset;
528
530 Pattern m_pattern;
531
533 Gradient m_gradient;
534
535 //
536 // related to the frame
537 //
538
540 MWAWColor m_backgroundColor;
542 float m_backgroundOpacity;
544 float m_rotate;
546 std::vector<MWAWBorder> m_bordersList;
548 std::string m_frameName;
550 std::string m_frameNextName;
551
553 Arrow m_arrows[2];
554
555 //
556 // some transformation: must probably be somewhere else
557 //
558
560 bool m_flip[2];
561
563 bool m_fillRuleEvenOdd;
564
566 bool m_doNotPrint;
568 std::string m_extra;
569 };
570 #endif
571 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWGraphicStyle::operator<<
friend std::ostream & operator<<(std::ostream &o, MWAWGraphicStyle const &st)
a print operator
Definition: MWAWGraphicStyle.cxx:497
MWAWGraphicStyle::Pattern::getUniqueColor
bool getUniqueColor(MWAWColor &col) const
check if the pattern has only one color; if so returns true...
Definition: MWAWGraphicStyle.cxx:86
MWAWGraphicStyle::Gradient::G_Square
@ G_Square
Definition: MWAWGraphicStyle.hxx:177
MWAWGraphicStyle::Gradient::Stop::m_opacity
float m_opacity
the opacity
Definition: MWAWGraphicStyle.hxx:174
MWAWGraphicStyle::Arrow::m_path
std::string m_path
the arrow path
Definition: MWAWGraphicStyle.hxx:131
MWAWGraphicStyle::m_lineCap
LineCap m_lineCap
the line cap
Definition: MWAWGraphicStyle.hxx:510
MWAWGraphicStyle::Arrow::isEmpty
bool isEmpty() const
returns true if there is no arrow
Definition: MWAWGraphicStyle.hxx:121
MWAWGraphicStyle::hasBorders
bool hasBorders() const
return true if the frame has some border
Definition: MWAWGraphicStyle.hxx:469
MWAWGraphicStyle::m_doNotPrint
bool m_doNotPrint
a bool to know if the shape must not be printed
Definition: MWAWGraphicStyle.hxx:566
MWAWGraphicStyle::hasSurfaceColor
bool hasSurfaceColor() const
returns true if the surface is defined
Definition: MWAWGraphicStyle.hxx:421
MWAWGraphicStyle::Pattern::empty
bool empty() const
return true if we does not have a pattern
Definition: MWAWGraphicStyle.hxx:304
MWAWGraphicStyle::m_backgroundColor
MWAWColor m_backgroundColor
the background color
Definition: MWAWGraphicStyle.hxx:540
MWAWGraphicStyle::Gradient::Stop::m_offset
float m_offset
the offset
Definition: MWAWGraphicStyle.hxx:170
MWAWGraphicStyle::Gradient::Stop::operator<<
friend std::ostream & operator<<(std::ostream &o, Stop const &st)
a print operator
Definition: MWAWGraphicStyle.hxx:161
MWAWGraphicStyle::operator=
MWAWGraphicStyle & operator=(MWAWGraphicStyle &&)=default
MWAWGraphicStyle::Pattern::cmp
int cmp(Pattern const &a) const
compare two patterns
Definition: MWAWGraphicStyle.hxx:319
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
MWAWGraphicStyle::J_Bevel
@ J_Bevel
Definition: MWAWGraphicStyle.hxx:53
MWAWPictBitmapIndexed::setColors
void setColors(std::vector< MWAWColor > const &cols)
sets the array of indexed colors
Definition: MWAWPictBitmap.hxx:446
MWAWGraphicStyle::m_pattern
Pattern m_pattern
the pattern if it exists
Definition: MWAWGraphicStyle.hxx:530
MWAWGraphicStyle::m_extra
std::string m_extra
extra data
Definition: MWAWGraphicStyle.hxx:568
MWAWGraphicStyle::Arrow::addTo
void addTo(librevenge::RVNGPropertyList &propList, std::string const &type) const
add a arrow to the propList knowing the type (start, end)
Definition: MWAWGraphicStyle.cxx:56
MWAWGraphicStyle::addFrameTo
void addFrameTo(librevenge::RVNGPropertyList &pList) const
add all the frame parameters to propList: the background and the borders
Definition: MWAWGraphicStyle.cxx:380
MWAWGraphicStyle::setSurfaceColor
void setSurfaceColor(MWAWColor const &col, float opacity=1)
set the surface color
Definition: MWAWGraphicStyle.hxx:415
MWAWGraphicStyle::setShadowColor
void setShadowColor(MWAWColor const &col, float opacity=1)
set the shadow color
Definition: MWAWGraphicStyle.hxx:458
MWAWGraphicStyle::Gradient::m_type
Type m_type
the gradient type
Definition: MWAWGraphicStyle.hxx:260
MWAWGraphicStyle::Pattern::Pattern
Pattern(Pattern const &)=default
MWAWGraphicStyle::Gradient::G_None
@ G_None
Definition: MWAWGraphicStyle.hxx:177
MWAWGraphicStyle::m_fillRuleEvenOdd
bool m_fillRuleEvenOdd
true if the fill rule is evenod
Definition: MWAWGraphicStyle.hxx:563
MWAWGraphicStyle::Arrow::plain
static Arrow plain()
returns a basic plain arrow
Definition: MWAWGraphicStyle.hxx:74
MWAWGraphicStyle::Arrow::m_isCentered
bool m_isCentered
flag to know if the arrow is centered
Definition: MWAWGraphicStyle.hxx:135
MWAWGraphicStyle::m_surfaceOpacity
float m_surfaceOpacity
true if the surface has some color
Definition: MWAWGraphicStyle.hxx:520
MWAWEmbeddedObject::m_dataList
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libmwaw_internal.hxx:512
MWAWGraphicStyle::m_bordersList
std::vector< MWAWBorder > m_bordersList
the borders MWAWBorder::Pos (for a frame)
Definition: MWAWGraphicStyle.hxx:546
MWAWColor::white
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:250
MWAWGraphicStyle::LineJoin
LineJoin
an enum used to define the basic line join
Definition: MWAWGraphicStyle.hxx:53
libmwaw::BottomBit
@ BottomBit
Definition: libmwaw_internal.hxx:178
MWAWGraphicStyle::Arrow::operator>=
bool operator>=(Arrow const &arrow) const
operator>=
Definition: MWAWGraphicStyle.hxx:116
MWAWFontConverter.hxx
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
MWAWEmbeddedObject
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
MWAWGraphicStyle::Arrow::m_viewBox
MWAWBox2i m_viewBox
the arrow viewbox
Definition: MWAWGraphicStyle.hxx:129
MWAWGraphicStyle::setBackgroundColor
void setBackgroundColor(MWAWColor const &col, float opacity=1)
set the background color
Definition: MWAWGraphicStyle.hxx:447
MWAWGraphicStyle::Pattern::getAverageColor
bool getAverageColor(MWAWColor &col) const
return the average color
Definition: MWAWGraphicStyle.cxx:101
MWAWGraphicStyle::Gradient::G_Linear
@ G_Linear
Definition: MWAWGraphicStyle.hxx:177
MWAWGraphicStyle::Arrow::operator<=
bool operator<=(Arrow const &arrow) const
operator<=
Definition: MWAWGraphicStyle.hxx:106
MWAWColor::str
std::string str() const
print the color in the form #rrggbb
Definition: libmwaw_internal.cxx:232
MWAWBorder::None
@ None
Definition: libmwaw_internal.hxx:335
MWAWGraphicStyle::C_Butt
@ C_Butt
Definition: MWAWGraphicStyle.hxx:51
MWAWPictBitmap::getBinary
bool getBinary(MWAWEmbeddedObject &picture) const override
returns the final picture
Definition: MWAWPictBitmap.hxx:225
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
MWAWGraphicStyle::hasLine
bool hasLine() const
returns true if the border is defined
Definition: MWAWGraphicStyle.hxx:410
MWAWGraphicStyle::Pattern::m_data
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:363
MWAWGraphicStyle::~MWAWGraphicStyle
virtual ~MWAWGraphicStyle()
virtual destructor
Definition: MWAWGraphicStyle.cxx:228
MWAWGraphicStyle::Pattern::m_pictureAverageColor
MWAWColor m_pictureAverageColor
the picture average color
Definition: MWAWGraphicStyle.hxx:368
MWAWGraphicStyle::m_lineOpacity
float m_lineOpacity
the line opacity: 0=transparent
Definition: MWAWGraphicStyle.hxx:514
MWAWGraphicStyle::Pattern::operator<<
friend std::ostream & operator<<(std::ostream &o, Pattern const &pat)
a print operator
Definition: MWAWGraphicStyle.hxx:340
MWAWGraphicStyle::Gradient::Stop::Stop
Stop(float offset=0.0, MWAWColor const &col=MWAWColor::black(), float opacity=1.0)
constructor
Definition: MWAWGraphicStyle.hxx:143
MWAWGraphicStyle::Gradient::G_Rectangular
@ G_Rectangular
Definition: MWAWGraphicStyle.hxx:177
MWAWGraphicStyle::resetBorders
void resetBorders()
reset the border
Definition: MWAWGraphicStyle.hxx:490
MWAWGraphicStyle::J_Round
@ J_Round
Definition: MWAWGraphicStyle.hxx:53
MWAWGraphicStyle::Pattern
a basic pattern used in a MWAWGraphicStyle:
Definition: MWAWGraphicStyle.hxx:277
MWAWColor::barycenter
static MWAWColor barycenter(float alpha, MWAWColor const &colA, float beta, MWAWColor const &colB)
return alpha*colA+beta*colB
Definition: libmwaw_internal.cxx:206
MWAWGraphicStyle::hasPattern
bool hasPattern() const
returns true if the pattern is defined
Definition: MWAWGraphicStyle.hxx:432
MWAWGraphicStyle::Gradient::Stop::cmp
int cmp(Stop const &a) const
compare two gradient
Definition: MWAWGraphicStyle.hxx:150
MWAWEmbeddedObject::cmp
int cmp(MWAWEmbeddedObject const &pict) const
a comparison function
Definition: libmwaw_internal.cxx:606
MWAWGraphicStyle::emptyStyle
static MWAWGraphicStyle emptyStyle()
returns an empty style.
Definition: MWAWGraphicStyle.hxx:401
MWAWGraphicStyle::Gradient::Stop::m_color
MWAWColor m_color
the color
Definition: MWAWGraphicStyle.hxx:172
MWAWGraphicStyle::m_surfaceColor
MWAWColor m_surfaceColor
the surface color
Definition: MWAWGraphicStyle.hxx:518
MWAWVec2::cmp
int cmp(MWAWVec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libmwaw_internal.hxx:777
MWAWGraphicStyle::Gradient::cmp
int cmp(Gradient const &a) const
compare two gradient
Definition: MWAWGraphicStyle.hxx:239
libmwaw::Bottom
@ Bottom
Definition: libmwaw_internal.hxx:176
libmwaw_internal.hxx
MWAWEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition: libmwaw_internal.hxx:486
MWAWGraphicStyle::m_lineWidth
float m_lineWidth
the linewidth
Definition: MWAWGraphicStyle.hxx:508
MWAWGraphicStyle::Gradient::Stop
a structure used to define the gradient limit in MWAWGraphicStyle
Definition: MWAWGraphicStyle.hxx:141
MWAWBorder
a border
Definition: libmwaw_internal.hxx:333
MWAWGraphicStyle::m_flip
bool m_flip[2]
two bool to indicated we need to flip the shape or not
Definition: MWAWGraphicStyle.hxx:560
MWAWColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:284
MWAWGraphicStyle::Arrow::Arrow
Arrow(float w, MWAWBox2i const &box, std::string const &path, bool centered=false)
constructor
Definition: MWAWGraphicStyle.hxx:66
MWAWGraphicStyle::Arrow::operator<
bool operator<(Arrow const &arrow) const
operator<
Definition: MWAWGraphicStyle.hxx:100
MWAWGraphicStyle::Pattern::m_dim
MWAWVec2i m_dim
the dimension width x height
Definition: MWAWGraphicStyle.hxx:358
MWAWGraphicStyle::Gradient::operator<<
friend std::ostream & operator<<(std::ostream &o, Gradient const &grad)
a print operator
Definition: MWAWGraphicStyle.hxx:198
MWAWGraphicStyle::Gradient::m_border
float m_border
the gradient border opacity
Definition: MWAWGraphicStyle.hxx:266
MWAWGraphicStyle::setBorders
void setBorders(int wh, MWAWBorder const &border)
sets the cell border: wh=libmwaw::LeftBit|...
Definition: MWAWGraphicStyle.cxx:232
libmwaw::RightBit
@ RightBit
Definition: libmwaw_internal.hxx:178
MWAWVec2< float >
MWAWPictBitmapIndexed::setRow
void setRow(int j, U const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:430
MWAWGraphicStyle::m_arrows
Arrow m_arrows[2]
the two arrows corresponding to start and end extremity
Definition: MWAWGraphicStyle.hxx:553
MWAWGraphicStyle::setPattern
void setPattern(Pattern const &pat, float opacity=1)
set the pattern
Definition: MWAWGraphicStyle.hxx:426
MWAWColor::black
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:245
MWAWGraphicStyle::Pattern::~Pattern
virtual ~Pattern()
virtual destructor
Definition: MWAWGraphicStyle.cxx:82
MWAWGraphicStyle::Pattern::Pattern
Pattern(MWAWVec2i dim, MWAWEmbeddedObject const &picture, MWAWColor const &avColor)
constructor from a binary data
Definition: MWAWGraphicStyle.hxx:289
MWAWGraphicStyle::hasBackgroundColor
bool hasBackgroundColor() const
returns true if the background is defined
Definition: MWAWGraphicStyle.hxx:453
MWAWGraphicStyle::Pattern::operator=
Pattern & operator=(Pattern const &)=default
MWAWGraphicStyle::Gradient::G_Axial
@ G_Axial
Definition: MWAWGraphicStyle.hxx:177
MWAWGraphicStyle::Pattern::m_picture
MWAWEmbeddedObject m_picture
a picture
Definition: MWAWGraphicStyle.hxx:366
MWAWGraphicStyle::Pattern::m_colors
MWAWColor m_colors[2]
the two indexed colors
Definition: MWAWGraphicStyle.hxx:361
MWAWGraphicStyle::Arrow::m_width
float m_width
the arrow width in point
Definition: MWAWGraphicStyle.hxx:133
MWAWGraphicStyle::hasSameBorders
bool hasSameBorders() const
return true if the frame has some border
Definition: MWAWGraphicStyle.hxx:474
libmwaw::Top
@ Top
Definition: libmwaw_internal.hxx:176
MWAWGraphicStyle::m_backgroundOpacity
float m_backgroundOpacity
true if the background has some color
Definition: MWAWGraphicStyle.hxx:542
MWAWBorder::m_style
Style m_style
the border style
Definition: libmwaw_internal.hxx:380
MWAWGraphicStyle::m_shadowColor
MWAWColor m_shadowColor
the shadow color
Definition: MWAWGraphicStyle.hxx:523
MWAWGraphicStyle::m_lineColor
MWAWColor m_lineColor
the line color
Definition: MWAWGraphicStyle.hxx:516
MWAWGraphicStyle::Gradient::addTo
void addTo(librevenge::RVNGPropertyList &propList) const
add a gradient to the propList
Definition: MWAWGraphicStyle.cxx:168
MWAWGraphicStyle::hasShadow
bool hasShadow() const
returns true if the shadow is defined
Definition: MWAWGraphicStyle.hxx:464
MWAWGraphicStyle::m_frameName
std::string m_frameName
the frame name
Definition: MWAWGraphicStyle.hxx:548
MWAWGraphicStyle::C_Square
@ C_Square
Definition: MWAWGraphicStyle.hxx:51
MWAWBox2i
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1191
libmwaw::LeftBit
@ LeftBit
Definition: libmwaw_internal.hxx:178
MWAWGraphicStyle::Pattern::Pattern
Pattern()
constructor
Definition: MWAWGraphicStyle.hxx:279
MWAWGraphicStyle::cmp
int cmp(MWAWGraphicStyle const &a) const
compare two styles
Definition: MWAWGraphicStyle.cxx:428
MWAWGraphicStyle::m_shadowOpacity
float m_shadowOpacity
true if the shadow has some color
Definition: MWAWGraphicStyle.hxx:525
MWAWGraphicStyle.hxx
MWAWEmbeddedObject::m_typeList
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libmwaw_internal.hxx:514
MWAWGraphicStyle::C_Round
@ C_Round
Definition: MWAWGraphicStyle.hxx:51
MWAWGraphicStyle::Gradient
a basic gradient used in a MWAWGraphicStyle
Definition: MWAWGraphicStyle.hxx:139
MWAWPictBitmapIndexed
a bitmap of int to store indexed bitmap
Definition: MWAWPictBitmap.hxx:357
MWAWGraphicStyle::LineCap
LineCap
an enum used to define the basic line cap
Definition: MWAWGraphicStyle.hxx:51
MWAWGraphicStyle::Gradient::m_percentCenter
MWAWVec2f m_percentCenter
the gradient center
Definition: MWAWGraphicStyle.hxx:268
MWAWGraphicStyle::m_frameNextName
std::string m_frameNextName
the frame next name (if there is a link)
Definition: MWAWGraphicStyle.hxx:550
MWAWGraphicStyle::m_gradient
Gradient m_gradient
the gradient
Definition: MWAWGraphicStyle.hxx:533
MWAWGraphicStyle::Gradient::Gradient
Gradient()
constructor
Definition: MWAWGraphicStyle.hxx:179
libmwaw::Right
@ Right
Definition: libmwaw_internal.hxx:176
MWAWGraphicStyle::Gradient::G_Ellipsoid
@ G_Ellipsoid
Definition: MWAWGraphicStyle.hxx:177
MWAWGraphicStyle::Gradient::m_radius
float m_radius
the gradient radius
Definition: MWAWGraphicStyle.hxx:270
MWAWGraphicStyle::hasGradient
bool hasGradient(bool complex=false) const
returns true if the gradient is defined
Definition: MWAWGraphicStyle.hxx:437
libmwaw::TopBit
@ TopBit
Definition: libmwaw_internal.hxx:178
MWAWGraphicStyle::Gradient::hasGradient
bool hasGradient(bool complex=false) const
returns true if the gradient is defined
Definition: MWAWGraphicStyle.hxx:191
MWAWGraphicStyle::m_lineJoin
LineJoin m_lineJoin
the line join
Definition: MWAWGraphicStyle.hxx:512
MWAWGraphicStyle::m_lineDashWidth
std::vector< float > m_lineDashWidth
the dash array: a sequence of (fullsize, emptysize)
Definition: MWAWGraphicStyle.hxx:506
MWAWGraphicStyle::Pattern::getBinary
bool getBinary(MWAWEmbeddedObject &picture) const
tries to convert the picture in a binary data ( ppm)
Definition: MWAWGraphicStyle.cxx:128
MWAWGraphicStyle::MWAWGraphicStyle
MWAWGraphicStyle()
constructor
Definition: MWAWGraphicStyle.hxx:371
libmwaw::Left
@ Left
Definition: libmwaw_internal.hxx:176
MWAWGraphicStyle::Arrow::Arrow
Arrow()
constructor ( no arrow)
Definition: MWAWGraphicStyle.hxx:58
libmwaw.hxx
libmwaw API: main libmwaw interface header
MWAWGraphicStyle::operator=
MWAWGraphicStyle & operator=(MWAWGraphicStyle const &)=default
MWAWColor::isWhite
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:289
MWAWGraphicStyle::m_rotate
float m_rotate
the rotation
Definition: MWAWGraphicStyle.hxx:544
MWAWPictBitmap.hxx
MWAWGraphicStyle::addTo
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:251
MWAWGraphicStyle::borders
std::vector< MWAWBorder > const & borders() const
return the frame border: libmwaw::Left | ...
Definition: MWAWGraphicStyle.hxx:485
MWAWGraphicStyle::Gradient::m_angle
float m_angle
the gradient angle
Definition: MWAWGraphicStyle.hxx:264
MWAWBox2< int >
MWAWGraphicStyle::MWAWGraphicStyle
MWAWGraphicStyle(MWAWGraphicStyle const &)=default
MWAWGraphicStyle::Arrow::operator<<
friend std::ostream & operator<<(std::ostream &o, Arrow const &arrow)
operator<<
Definition: MWAWGraphicStyle.hxx:79
MWAWGraphicStyle::Gradient::G_Radial
@ G_Radial
Definition: MWAWGraphicStyle.hxx:177
MWAWGraphicStyle::Arrow::operator>
bool operator>(Arrow const &arrow) const
operator>
Definition: MWAWGraphicStyle.hxx:111
MWAWGraphicStyle::m_shadowOffset
MWAWVec2f m_shadowOffset
the shadow offset
Definition: MWAWGraphicStyle.hxx:527
MWAWGraphicStyle::Arrow::operator!=
bool operator!=(Arrow const &arrow) const
operator!=
Definition: MWAWGraphicStyle.hxx:95
MWAWGraphicStyle::hasSurface
bool hasSurface() const
returns true if the interior surface is defined
Definition: MWAWGraphicStyle.hxx:442
MWAWGraphicStyle::Arrow::operator==
bool operator==(Arrow const &arrow) const
operator==
Definition: MWAWGraphicStyle.hxx:89
MWAWGraphicStyle::Gradient::Type
Type
an enum used to define the gradient type
Definition: MWAWGraphicStyle.hxx:177
MWAWGraphicStyle::Pattern::operator=
Pattern & operator=(Pattern &&)=default
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:838
MWAWGraphicStyle::Gradient::m_stopList
std::vector< Stop > m_stopList
the list of gradient limits
Definition: MWAWGraphicStyle.hxx:262
MWAWGraphicStyle::Arrow
a structure used to define an arrow
Definition: MWAWGraphicStyle.hxx:56
MWAWGraphicStyle::J_Miter
@ J_Miter
Definition: MWAWGraphicStyle.hxx:53