/src/libmwaw/src/lib/ClarisDrawStyleManager.cxx
Line | Count | Source |
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 | | |
34 | | #include <cmath> |
35 | | #include <iomanip> |
36 | | #include <iostream> |
37 | | #include <limits> |
38 | | #include <sstream> |
39 | | |
40 | | #include <librevenge/librevenge.h> |
41 | | |
42 | | #include "MWAWFont.hxx" |
43 | | #include "MWAWFontConverter.hxx" |
44 | | #include "MWAWGraphicListener.hxx" |
45 | | #include "MWAWGraphicShape.hxx" |
46 | | #include "MWAWGraphicStyle.hxx" |
47 | | #include "MWAWHeader.hxx" |
48 | | #include "MWAWParagraph.hxx" |
49 | | #include "MWAWPictBitmap.hxx" |
50 | | #include "MWAWPictData.hxx" |
51 | | #include "MWAWPrinter.hxx" |
52 | | #include "MWAWPosition.hxx" |
53 | | #include "MWAWRSRCParser.hxx" |
54 | | #include "MWAWSubDocument.hxx" |
55 | | |
56 | | #include "ClarisDrawParser.hxx" |
57 | | |
58 | | #include "ClarisDrawStyleManager.hxx" |
59 | | |
60 | | /** Internal: the structures of a ClarisDrawStyleManager */ |
61 | | namespace ClarisDrawStyleManagerInternal |
62 | | { |
63 | | // gradient of ClarisDrawStyleManagerInternal |
64 | | struct Gradient { |
65 | | //! construtor |
66 | | explicit Gradient(int type=0, int nColor=0, int angle=0, float decal=0) |
67 | 619k | : m_type(type) |
68 | 619k | , m_numColors(nColor) |
69 | 619k | , m_angle(angle) |
70 | 619k | , m_decal(decal) |
71 | 619k | , m_box() |
72 | 619k | { |
73 | 619k | m_colors[0]=MWAWColor::black(); |
74 | 619k | m_colors[1]=MWAWColor::white(); |
75 | 619k | } |
76 | | //! check if the gradient is valid |
77 | | bool ok() const |
78 | 371k | { |
79 | 371k | return m_type>=0 && m_type<=2 && m_numColors>=2 && m_numColors<=4; |
80 | 371k | } |
81 | | //! update the style |
82 | | bool update(MWAWGraphicStyle &style) const; |
83 | | //! operator<< |
84 | | friend std::ostream &operator<<(std::ostream &o, Gradient const &gr) |
85 | 0 | { |
86 | 0 | switch (gr.m_type) { |
87 | 0 | case 0: |
88 | 0 | o << "linear,"; |
89 | 0 | break; |
90 | 0 | case 1: |
91 | 0 | o << "radial,"; |
92 | 0 | break; |
93 | 0 | case 2: |
94 | 0 | o << "rectangle,"; |
95 | 0 | break; |
96 | 0 | default: |
97 | 0 | o << "#type=" << gr.m_type << ","; |
98 | 0 | break; |
99 | 0 | } |
100 | 0 | if (gr.m_angle) |
101 | 0 | o << "angle=" << gr.m_angle << ","; |
102 | 0 | if (gr.m_decal>0) |
103 | 0 | o << "decal=" << gr.m_decal << ","; |
104 | 0 | o << "col=["; |
105 | 0 | for (int c=0; c < gr.m_numColors; ++c) { |
106 | 0 | if (c>=4) break; |
107 | 0 | o << gr.m_colors[c] << ","; |
108 | 0 | } |
109 | 0 | o << "],"; |
110 | 0 | if (gr.m_box!=MWAWBox2i(MWAWVec2i(0,0),MWAWVec2i(0,0))) |
111 | 0 | o << "center=" << gr.m_box << ","; |
112 | 0 | return o; |
113 | 0 | } |
114 | | //! the type |
115 | | int m_type; |
116 | | //! the number of color |
117 | | int m_numColors; |
118 | | //! the color |
119 | | MWAWColor m_colors[4]; |
120 | | //! the angle |
121 | | int m_angle; |
122 | | //! the decal |
123 | | float m_decal; |
124 | | //! the center bdbox |
125 | | MWAWBox2i m_box; |
126 | | }; |
127 | | bool Gradient::update(MWAWGraphicStyle &style) const |
128 | 370k | { |
129 | 370k | if (!ok()) return false; |
130 | 370k | auto &finalGrad=style.m_gradient; |
131 | 370k | finalGrad.m_stopList.resize(0); |
132 | 370k | if (m_type==1 || m_type==2) { |
133 | 57.5k | finalGrad.m_type=m_type==1 ? MWAWGraphicStyle::Gradient::G_Radial : MWAWGraphicStyle::Gradient::G_Rectangular; |
134 | 203k | for (int c=0; c < m_numColors; ++c) |
135 | 145k | finalGrad.m_stopList.push_back(MWAWGraphicStyle::Gradient::Stop(float(c)/float(m_numColors-1), m_colors[c])); |
136 | 57.5k | finalGrad.m_percentCenter=MWAWVec2f(float(m_box.center()[1])/100.f, float(m_box.center()[0])/100.f); |
137 | 57.5k | return true; |
138 | 57.5k | } |
139 | 313k | finalGrad.m_angle=float(m_angle+90); |
140 | 313k | if (m_decal>=0.5f-0.1e-3f && m_decal<=0.5f+0.1e-3f) { |
141 | 25.0k | finalGrad.m_type= MWAWGraphicStyle::Gradient::G_Axial; |
142 | 75.2k | for (int c=0; c < m_numColors; ++c) |
143 | 50.1k | finalGrad.m_stopList.push_back(MWAWGraphicStyle::Gradient::Stop(float(c)/float(m_numColors-1), m_colors[m_numColors-1-c])); |
144 | 25.0k | return true; |
145 | 25.0k | } |
146 | 287k | finalGrad.m_type= MWAWGraphicStyle::Gradient::G_Linear; |
147 | 287k | if (m_decal <= 0.05f) { |
148 | 878k | for (int c=0; c < m_numColors; ++c) |
149 | 623k | finalGrad.m_stopList.push_back(MWAWGraphicStyle::Gradient::Stop(float(c)/float(m_numColors-1), m_colors[m_numColors-1-c])); |
150 | 254k | return true; |
151 | 254k | } |
152 | 33.0k | if (m_decal >=0.95f) { |
153 | 62.9k | for (int c=0; c < m_numColors; ++c) |
154 | 45.4k | finalGrad.m_stopList.push_back(MWAWGraphicStyle::Gradient::Stop(float(c)/float(m_numColors-1), m_colors[c])); |
155 | 17.5k | return true; |
156 | 17.5k | } |
157 | 60.4k | for (int c=-m_numColors+1; c<m_numColors; ++c) { |
158 | | // checkme: look almost good |
159 | 60.4k | float pos=float(c)/float(m_numColors-1)+m_decal/2.f; |
160 | 60.4k | if (pos < 0) { |
161 | 22.4k | if (c!=m_numColors-1 && float(c+1)/float(m_numColors-1)+(1-m_decal)/2.f>=0) |
162 | 15.5k | continue; |
163 | 6.89k | pos=0; |
164 | 6.89k | } |
165 | 44.9k | finalGrad.m_stopList.push_back(MWAWGraphicStyle::Gradient::Stop(pos>1?1:pos, m_colors[m_numColors-1+(c<0?c:-c)])); |
166 | 44.9k | if (pos>=1) |
167 | 15.5k | break; |
168 | 44.9k | } |
169 | 15.5k | return true; |
170 | 33.0k | } |
171 | | |
172 | | //////////////////////////////////////// |
173 | | //! Internal: the state of a ClarisDrawStyleManager |
174 | | struct State { |
175 | | //! constructor |
176 | | State() |
177 | 67.9k | : m_documentSize() |
178 | 67.9k | , m_numColors(0) |
179 | 67.9k | , m_numBWPatterns(0) |
180 | 67.9k | , m_numGradients(0) |
181 | 67.9k | , m_colorList() |
182 | 67.9k | , m_dashList() |
183 | 67.9k | , m_fontList() |
184 | 67.9k | , m_paragraphList() |
185 | 67.9k | , m_BWPatternList() |
186 | 67.9k | , m_gradientList() |
187 | 67.9k | { |
188 | 407k | for (auto &numStyle : m_numStyleZones) numStyle=0; |
189 | 67.9k | } |
190 | | //! init the black and white patterns list |
191 | | void initBWPatterns(); |
192 | | //! init the colors list |
193 | | void initColors(); |
194 | | //! init the dashs list |
195 | | void initDashs(); |
196 | | //! init the gradient list |
197 | | void initGradients(); |
198 | | //! the document size (in point) |
199 | | MWAWVec2f m_documentSize; |
200 | | //! the number of zones |
201 | | int m_numStyleZones[6]; |
202 | | //! the number of color |
203 | | int m_numColors; |
204 | | //! the number of BW pattern |
205 | | int m_numBWPatterns; |
206 | | //! the number of gradient |
207 | | int m_numGradients; |
208 | | //! the color list |
209 | | std::vector<MWAWColor> m_colorList; |
210 | | //! the list of dash |
211 | | std::vector< std::vector<float> > m_dashList; |
212 | | //! the list of font |
213 | | std::vector<MWAWFont> m_fontList; |
214 | | //! the list of paragraph |
215 | | std::vector<MWAWParagraph> m_paragraphList; |
216 | | |
217 | | //! the patterns list |
218 | | std::vector<MWAWGraphicStyle::Pattern> m_BWPatternList; |
219 | | //! the gradient list |
220 | | std::vector<Gradient> m_gradientList; |
221 | | }; |
222 | | |
223 | | void State::initColors() |
224 | 5.66M | { |
225 | 5.66M | if (!m_colorList.empty()) return; |
226 | 18.2k | if (m_numColors==168) { // the 168 palettes has more than 168 colors... |
227 | 840 | uint32_t const defCol[186] = { |
228 | 840 | 0xffffff,0x000000,0x777777,0x555555,0xffff00,0xff6600,0xdd0000,0xff0099, |
229 | 840 | 0x660099,0x0000dd,0x0099ff,0x00ee00,0x006600,0x663300,0x996633,0xbbbbbb, |
230 | 840 | 0x0c0c0c,0x191919,0x262626,0x333333,0x404040,0x4c4c4c,0x595959,0x666666, |
231 | 840 | 0x737373,0x808080,0x8c8c8c,0x999999,0xa6a6a6,0xb3b3b3,0xbfbfbf,0xcccccc, |
232 | 840 | 0xd9d9d9,0xe6e6e6,0xf3f3f3,0x660000,0x661900,0x663300,0x664c00,0x665900, |
233 | 840 | 0x666600,0x336600,0x006600,0x006633,0x00664c,0x006666,0x005966,0x004c66, |
234 | 840 | 0x004066,0x003366,0x001f66,0x000066,0x330066,0x660066,0x660044,0x66002a, |
235 | 840 | 0x990000,0x992600,0x994c00,0x997300,0x998600,0x999900,0x4c9900,0x009900, |
236 | 840 | 0x00994c,0x009973,0x009999,0x008699,0x007399,0x006099,0x004c99,0x002e99, |
237 | 840 | 0x000099,0x4c0099,0x990099,0x990066,0x990040,0xcc0000,0xcc3300,0xcc6600, |
238 | 840 | 0xcc9900,0xccb300,0xcccc00,0x66cc00,0x00cc00,0x00cc66,0x00cc99,0x00cccc, |
239 | 840 | 0x00b3cc,0x0099cc,0x007fcc,0x0066cc,0x003ecc,0x0000cc,0x6600cc,0xcc00cc, |
240 | 840 | 0xcc0088,0xcc0055,0xff0000,0xff4000,0xff7f00,0xffc000,0xffdf00,0xffff00, |
241 | 840 | 0x80ff00,0x00ff00,0x00ff7f,0x00ffc0,0x00ffff,0x00e0ff,0x00c0ff,0x00a0ff, |
242 | 840 | 0x0080ff,0x004eff,0x0000ff,0x7f00ff,0xff00ff,0xff00aa,0xff006a,0xff4c4c, |
243 | 840 | 0xff794c,0xffa64c,0xffd34c,0xffe94c,0xffff4c,0xa6ff4c,0x4cff4c,0x4cffa6, |
244 | 840 | 0x4cffd3,0x4cffff,0x4ce9ff,0x4cd3ff,0x4cbcff,0x4ca6ff,0x4c83ff,0x4c4cff, |
245 | 840 | 0xa64cff,0xff4cff,0xff4cc4,0xff4c97,0xff9999,0xffb399,0xffcc99,0xffe699, |
246 | 840 | 0xfff399,0xffff99,0xccff99,0x99ff99,0x99ffcc,0x99ffe6,0x99ffff,0x99f3ff, |
247 | 840 | 0x99e6ff,0x99d9ff,0x99ccff,0x99b8ff,0x9999ff,0xcc99ff,0xff99ff,0xff99dd, |
248 | 840 | 0xff99c4,0xffcccc,0xffd9cc,0xffe6cc,0xfff3cc,0xfff9cc,0xffffcc,0xe6ffcc, |
249 | 840 | 0xccffcc,0xccffe6,0xccfff3,0xccffff,0xccf9ff,0xccf3ff,0xccecff,0xcce6ff, |
250 | 840 | 0xccdcff,0xccccff,0xe6ccff,0xffccff,0xffccee,0xffcce2,0x000000,0x000000, |
251 | 840 | }; |
252 | 840 | m_colorList.resize(186); |
253 | 157k | for (size_t i = 0; i < 186; i++) |
254 | 156k | m_colorList[i] = defCol[i]; |
255 | 840 | return; |
256 | 840 | } |
257 | 17.3k | uint32_t const defCol[256] = { |
258 | 17.3k | 0xffffff,0x000000,0x777777,0x555555,0xffff00,0xff6600,0xdd0000,0xff0099, |
259 | 17.3k | 0x660099,0x0000dd,0x0099ff,0x00ee00,0x006600,0x663300,0x996633,0xbbbbbb, |
260 | 17.3k | 0xffffcc,0xffff99,0xffff66,0xffff33,0xffccff,0xffcccc,0xffcc99,0xffcc66, |
261 | 17.3k | 0xffcc33,0xffcc00,0xff99ff,0xff99cc,0xff9999,0xff9966,0xff9933,0xff9900, |
262 | 17.3k | 0xff66ff,0xff66cc,0xff6699,0xff6666,0xff6633,0xff33ff,0xff33cc,0xff3399, |
263 | 17.3k | 0xff3366,0xff3333,0xff3300,0xff00ff,0xff00cc,0xff0066,0xff0033,0xff0000, |
264 | 17.3k | 0xccffff,0xccffcc,0xccff99,0xccff66,0xccff33,0xccff00,0xccccff,0xcccccc, |
265 | 17.3k | 0xcccc99,0xcccc66,0xcccc33,0xcccc00,0xcc99ff,0xcc99cc,0xcc9999,0xcc9966, |
266 | 17.3k | 0xcc9933,0xcc9900,0xcc66ff,0xcc66cc,0xcc6699,0xcc6666,0xcc6633,0xcc6600, |
267 | 17.3k | 0xcc33ff,0xcc33cc,0xcc3399,0xcc3366,0xcc3333,0xcc3300,0xcc00ff,0xcc00cc, |
268 | 17.3k | 0xcc0099,0xcc0066,0xcc0033,0xcc0000,0x99ffff,0x99ffcc,0x99ff99,0x99ff66, |
269 | 17.3k | 0x99ff33,0x99ff00,0x99ccff,0x99cccc,0x99cc99,0x99cc66,0x99cc33,0x99cc00, |
270 | 17.3k | 0x9999ff,0x9999cc,0x999999,0x999966,0x999933,0x999900,0x9966ff,0x9966cc, |
271 | 17.3k | 0x996699,0x996666,0x996600,0x9933ff,0x9933cc,0x993399,0x993366,0x993333, |
272 | 17.3k | 0x993300,0x9900ff,0x9900cc,0x990099,0x990066,0x990033,0x990000,0x66ffff, |
273 | 17.3k | 0x66ffcc,0x66ff99,0x66ff66,0x66ff33,0x66ff00,0x66ccff,0x66cccc,0x66cc99, |
274 | 17.3k | 0x66cc66,0x66cc33,0x66cc00,0x6699ff,0x6699cc,0x669999,0x669966,0x669933, |
275 | 17.3k | 0x669900,0x6666ff,0x6666cc,0x666699,0x666666,0x666633,0x666600,0x6633ff, |
276 | 17.3k | 0x6633cc,0x663399,0x663366,0x663333,0x6600ff,0x6600cc,0x660066,0x660033, |
277 | 17.3k | 0x660000,0x33ffff,0x33ffcc,0x33ff99,0x33ff66,0x33ff33,0x33ff00,0x33ccff, |
278 | 17.3k | 0x33cccc,0x33cc99,0x33cc66,0x33cc33,0x33cc00,0x3399ff,0x3399cc,0x339999, |
279 | 17.3k | 0x339966,0x339933,0x339900,0x3366ff,0x3366cc,0x336699,0x336666,0x336633, |
280 | 17.3k | 0x336600,0x3333ff,0x3333cc,0x333399,0x333366,0x333333,0x333300,0x3300ff, |
281 | 17.3k | 0x3300cc,0x330099,0x330066,0x330033,0x330000,0x00ffff,0x00ffcc,0x00ff99, |
282 | 17.3k | 0x00ff66,0x00ff33,0x00ff00,0x00ccff,0x00cccc,0x00cc99,0x00cc66,0x00cc33, |
283 | 17.3k | 0x00cc00,0x0099cc,0x009999,0x009966,0x009933,0x009900,0x0066ff,0x0066cc, |
284 | 17.3k | 0x006699,0x006666,0x006633,0x0033ff,0x0033cc,0x003399,0x003366,0x003333, |
285 | 17.3k | 0x003300,0x0000ff,0x0000cc,0x000099,0x000066,0x000033,0xee0000,0xbb0000, |
286 | 17.3k | 0xaa0000,0x880000,0x770000,0x550000,0x440000,0x220000,0x110000,0x00dd00, |
287 | 17.3k | 0x00bb00,0x00aa00,0x008800,0x007700,0x005500,0x004400,0x002200,0x001100, |
288 | 17.3k | 0x0000ee,0x0000bb,0x0000aa,0x000088,0x000077,0x000055,0x000044,0x000022, |
289 | 17.3k | 0x000011,0xeeeeee,0xdddddd,0xaaaaaa,0x888888,0x444444,0x222222,0x111111, |
290 | 17.3k | }; |
291 | 17.3k | if (m_numColors==0) |
292 | 16.4k | m_numColors=256; |
293 | 916 | else if (m_numColors!=256) { |
294 | | /* there also exist a 81 color palettes */ |
295 | 4 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::initColors: unimplemented number of color %d\n", m_numColors)); |
296 | 4 | } |
297 | 17.3k | m_colorList.resize(256); |
298 | 4.46M | for (size_t i = 0; i < 256; i++) |
299 | 4.44M | m_colorList[i] = defCol[i]; |
300 | 17.3k | } |
301 | | |
302 | | void State::initDashs() |
303 | 767 | { |
304 | 767 | if (!m_dashList.empty()) return; |
305 | 767 | std::vector<float> dash; |
306 | | // 1: 9x9 |
307 | 767 | dash.push_back(9); |
308 | 767 | dash.push_back(9); |
309 | 767 | m_dashList.push_back(dash); |
310 | | // 2: 27x9 |
311 | 767 | dash[0]=27; |
312 | 767 | m_dashList.push_back(dash); |
313 | | // 3: 18x18 |
314 | 767 | dash[0]=dash[1]=18; |
315 | 767 | m_dashList.push_back(dash); |
316 | | // 4: 54x18 |
317 | 767 | dash[0]=54; |
318 | 767 | m_dashList.push_back(dash); |
319 | | // 5: 72x9, 9x9 |
320 | 767 | dash.resize(4,9); |
321 | 767 | dash[0]=72; |
322 | 767 | dash[1]=9; |
323 | 767 | m_dashList.push_back(dash); |
324 | | // 6: 72x9, 9x9, 9x9 |
325 | 767 | dash.resize(6,9); |
326 | 767 | m_dashList.push_back(dash); |
327 | 767 | } |
328 | | |
329 | | void State::initGradients() |
330 | 9.56k | { |
331 | 9.56k | if (!m_gradientList.empty()) return; |
332 | 9.56k | Gradient grad; |
333 | 9.56k | if (m_numGradients==32) { // checkme |
334 | | // grad0 |
335 | 76 | grad=Gradient(0,2,0,1); |
336 | 76 | m_gradientList.push_back(grad); |
337 | | // grad1 |
338 | 76 | grad=Gradient(0,2,180,1); |
339 | 76 | m_gradientList.push_back(grad); |
340 | | // grad2 |
341 | 76 | grad=Gradient(0,2,90,0); |
342 | 76 | m_gradientList.push_back(grad); |
343 | | // grad3 |
344 | 76 | grad=Gradient(0,2,315,1); |
345 | 76 | m_gradientList.push_back(grad); |
346 | | // grad4 |
347 | 76 | grad=Gradient(0,2,225,1); |
348 | 76 | m_gradientList.push_back(grad); |
349 | | // grad5 |
350 | 76 | grad=Gradient(2,2,0,0); |
351 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(79,80),MWAWVec2i(79,80)); |
352 | 76 | m_gradientList.push_back(grad); |
353 | | // grad6 |
354 | 76 | grad=Gradient(2,2,0,0); |
355 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(81,20),MWAWVec2i(81,20)); |
356 | 76 | m_gradientList.push_back(grad); |
357 | | // grad7 |
358 | 76 | grad=Gradient(2,2,0,0); |
359 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(50,50),MWAWVec2i(50,50)); |
360 | 76 | m_gradientList.push_back(grad); |
361 | | // grad8 |
362 | 76 | grad=Gradient(0,2,90,1); |
363 | 76 | m_gradientList.push_back(grad); |
364 | | // grad9 |
365 | 76 | grad=Gradient(0,2,270,0.979172f); |
366 | 76 | m_gradientList.push_back(grad); |
367 | | // grad10 |
368 | 76 | grad=Gradient(0,2,0,0); |
369 | 76 | m_gradientList.push_back(grad); |
370 | | // grad11 |
371 | 76 | grad=Gradient(0,2,45,1); |
372 | 76 | m_gradientList.push_back(grad); |
373 | | // grad12 |
374 | 76 | grad=Gradient(0,2,135,1); |
375 | 76 | m_gradientList.push_back(grad); |
376 | | // grad13 |
377 | 76 | grad=Gradient(2,2,0,0); |
378 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(22,77),MWAWVec2i(23,77)); |
379 | 76 | m_gradientList.push_back(grad); |
380 | | // grad14 |
381 | 76 | grad=Gradient(2,2,0,0); |
382 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(22,22),MWAWVec2i(22,22)); |
383 | 76 | m_gradientList.push_back(grad); |
384 | | // grad15 |
385 | 76 | grad=Gradient(1,2,0,0); |
386 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(51,50),MWAWVec2i(51,50)); |
387 | 76 | m_gradientList.push_back(grad); |
388 | | // grad16 |
389 | 76 | grad=Gradient(2,3,0,0); |
390 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(79,15),MWAWVec2i(86,22)); |
391 | 76 | grad.m_colors[1]=MWAWColor(0xaa0000); |
392 | 76 | grad.m_colors[2]=MWAWColor(0xcc3300); |
393 | 76 | m_gradientList.push_back(grad); |
394 | | // grad17 |
395 | 76 | grad=Gradient(0,4,0,1); |
396 | 76 | grad.m_colors[0]=MWAWColor(0xff33cc); |
397 | 76 | grad.m_colors[1]=MWAWColor(0xdd0000); |
398 | 76 | grad.m_colors[2]=MWAWColor(0xdd0000); |
399 | 76 | grad.m_colors[3]=MWAWColor(0x000000); |
400 | 76 | m_gradientList.push_back(grad); |
401 | | // grad18 |
402 | 76 | grad=Gradient(0,3,112,0.80835f); |
403 | 76 | grad.m_colors[0]=MWAWColor(0x0000dd); |
404 | 76 | grad.m_colors[1]=MWAWColor(0x000077); |
405 | 76 | grad.m_colors[2]=MWAWColor(0xff3333); |
406 | 76 | m_gradientList.push_back(grad); |
407 | | // grad19 |
408 | 76 | grad=Gradient(1,4,332,0); |
409 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(77,71),MWAWVec2i(77,71)); |
410 | 76 | grad.m_colors[0]=MWAWColor(0xffff00); |
411 | 76 | grad.m_colors[1]=MWAWColor(0xff3300); |
412 | 76 | grad.m_colors[2]=MWAWColor(0x9900cc); |
413 | 76 | grad.m_colors[3]=MWAWColor(0x0000dd); |
414 | 76 | m_gradientList.push_back(grad); |
415 | | // grad20 |
416 | 76 | grad=Gradient(0,3,270,0.625f); |
417 | 76 | grad.m_colors[1]=MWAWColor(0x0000dd); |
418 | 76 | grad.m_colors[2]=MWAWColor(0x00cccc); |
419 | 76 | m_gradientList.push_back(grad); |
420 | | // grad21 |
421 | 76 | grad=Gradient(0,2,270,0.229172f); |
422 | 76 | grad.m_colors[0]=MWAWColor(0x0000aa); |
423 | 76 | grad.m_colors[1]=MWAWColor(0xdddddd); |
424 | 76 | m_gradientList.push_back(grad); |
425 | | // grad22 |
426 | 76 | grad=Gradient(0,3,90,0.729172f); |
427 | 76 | grad.m_colors[0]=MWAWColor(0xffffff); |
428 | 76 | grad.m_colors[2]=MWAWColor(0x9999ff); |
429 | 76 | m_gradientList.push_back(grad); |
430 | | // grad23 |
431 | 76 | grad=Gradient(2,4,0,0); |
432 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(41,40),MWAWVec2i(62,62)); |
433 | 76 | grad.m_colors[0]=MWAWColor(0xffffff); |
434 | 76 | grad.m_colors[1]=MWAWColor(0xccffff); |
435 | 76 | grad.m_colors[2]=MWAWColor(0x99ffff); |
436 | 76 | grad.m_colors[3]=MWAWColor(0x66ffff); |
437 | 76 | m_gradientList.push_back(grad); |
438 | | // grad24 |
439 | 76 | grad=Gradient(0,3,90,0.854172f); |
440 | 76 | grad.m_colors[1]=MWAWColor(0xdd0000); |
441 | 76 | grad.m_colors[2]=MWAWColor(0xffcc00); |
442 | 76 | m_gradientList.push_back(grad); |
443 | | // grad25 |
444 | 76 | grad=Gradient(0,4,315,0.633453f); |
445 | 76 | grad.m_colors[0]=MWAWColor(0xcc3300); |
446 | 76 | grad.m_colors[1]=MWAWColor(0xff6600); |
447 | 76 | grad.m_colors[2]=MWAWColor(0xffcc00); |
448 | 76 | grad.m_colors[3]=MWAWColor(0xffff00); |
449 | 76 | m_gradientList.push_back(grad); |
450 | | // grad26 |
451 | 76 | grad=Gradient(0,3,45,0.721832f); |
452 | 76 | grad.m_colors[1]=MWAWColor(0x0000dd); |
453 | 76 | grad.m_colors[2]=MWAWColor(0xff0099); |
454 | 76 | m_gradientList.push_back(grad); |
455 | | // grad27 |
456 | 76 | grad=Gradient(0,3,180,1); |
457 | 76 | grad.m_colors[1]=MWAWColor(0x0000dd); |
458 | 76 | grad.m_colors[2]=MWAWColor(0x9900cc); |
459 | 76 | m_gradientList.push_back(grad); |
460 | | // grad28 |
461 | 76 | grad=Gradient(0,4,90,0.81987f); |
462 | 76 | grad.m_colors[1]=MWAWColor(0x9900cc); |
463 | 76 | grad.m_colors[2]=MWAWColor(0x9933ff); |
464 | 76 | grad.m_colors[3]=MWAWColor(0x66ffff); |
465 | 76 | m_gradientList.push_back(grad); |
466 | | // grad29 |
467 | 76 | grad=Gradient(0,4,270,0.916672f); |
468 | 76 | grad.m_colors[0]=MWAWColor(0x0066ff); |
469 | 76 | grad.m_colors[1]=MWAWColor(0x00ccff); |
470 | 76 | grad.m_colors[2]=MWAWColor(0xffffcc); |
471 | 76 | grad.m_colors[3]=MWAWColor(0xff6633); |
472 | 76 | m_gradientList.push_back(grad); |
473 | | // grad30 |
474 | 76 | grad=Gradient(2,2,0,0); |
475 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(0,88),MWAWVec2i(12,100)); |
476 | 76 | grad.m_colors[0]=MWAWColor(0xff6600); |
477 | 76 | grad.m_colors[1]=MWAWColor(0xffff00); |
478 | 76 | m_gradientList.push_back(grad); |
479 | | // grad31 |
480 | 76 | grad=Gradient(2,4,0,0); |
481 | 76 | grad.m_box=MWAWBox2i(MWAWVec2i(99,52),MWAWVec2i(100,54)); |
482 | 76 | grad.m_colors[0]=MWAWColor(0xffffff); |
483 | 76 | grad.m_colors[1]=MWAWColor(0xffffcc); |
484 | 76 | grad.m_colors[2]=MWAWColor(0xffff66); |
485 | 76 | grad.m_colors[3]=MWAWColor(0xffcc00); |
486 | 76 | m_gradientList.push_back(grad); |
487 | 76 | return; |
488 | 76 | } |
489 | 9.48k | if (m_numGradients==0) |
490 | 8.41k | m_numGradients=64; |
491 | 9.48k | if (m_numGradients!=64) { |
492 | 0 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::initGradients: unimplemented number of color %d\n", m_numGradients)); |
493 | 0 | } |
494 | | // grad0 |
495 | 9.48k | grad=Gradient(0,2,0,0); |
496 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
497 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
498 | 9.48k | m_gradientList.push_back(grad); |
499 | | // grad1 |
500 | 9.48k | grad=Gradient(0,2,180,0); |
501 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
502 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
503 | 9.48k | m_gradientList.push_back(grad); |
504 | | // grad2 |
505 | 9.48k | grad=Gradient(0,2,90,0.5f); |
506 | 9.48k | grad.m_colors[0]=MWAWColor(0x000000); |
507 | 9.48k | grad.m_colors[1]=MWAWColor(0xffffff); |
508 | 9.48k | m_gradientList.push_back(grad); |
509 | | // grad3 |
510 | 9.48k | grad=Gradient(0,2,315,0); |
511 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
512 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
513 | 9.48k | m_gradientList.push_back(grad); |
514 | | // grad4 |
515 | 9.48k | grad=Gradient(0,2,225,0); |
516 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
517 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
518 | 9.48k | m_gradientList.push_back(grad); |
519 | | // grad5 |
520 | 9.48k | grad=Gradient(2,2,0,0); |
521 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
522 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
523 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(79,80),MWAWVec2i(79,80)); |
524 | 9.48k | m_gradientList.push_back(grad); |
525 | | // grad6 |
526 | 9.48k | grad=Gradient(2,2,0,0); |
527 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
528 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
529 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(81,20),MWAWVec2i(81,20)); |
530 | 9.48k | m_gradientList.push_back(grad); |
531 | | // grad7 |
532 | 9.48k | grad=Gradient(2,2,0,0); |
533 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
534 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
535 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(50,50),MWAWVec2i(50,50)); |
536 | 9.48k | m_gradientList.push_back(grad); |
537 | | // grad8 |
538 | 9.48k | grad=Gradient(0,2,90,0); |
539 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
540 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
541 | 9.48k | m_gradientList.push_back(grad); |
542 | | // grad9 |
543 | 9.48k | grad=Gradient(0,2,270,0.989578f); |
544 | 9.48k | grad.m_colors[0]=MWAWColor(0x000000); |
545 | 9.48k | grad.m_colors[1]=MWAWColor(0xffffff); |
546 | 9.48k | m_gradientList.push_back(grad); |
547 | | // grad10 |
548 | 9.48k | grad=Gradient(0,2,0,0.5f); |
549 | 9.48k | grad.m_colors[0]=MWAWColor(0x000000); |
550 | 9.48k | grad.m_colors[1]=MWAWColor(0xffffff); |
551 | 9.48k | m_gradientList.push_back(grad); |
552 | | // grad11 |
553 | 9.48k | grad=Gradient(0,2,45,0); |
554 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
555 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
556 | 9.48k | m_gradientList.push_back(grad); |
557 | | // grad12 |
558 | 9.48k | grad=Gradient(0,2,135,0); |
559 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
560 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
561 | 9.48k | m_gradientList.push_back(grad); |
562 | | // grad13 |
563 | 9.48k | grad=Gradient(2,2,0,0); |
564 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
565 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
566 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(22,77),MWAWVec2i(23,77)); |
567 | 9.48k | m_gradientList.push_back(grad); |
568 | | // grad14 |
569 | 9.48k | grad=Gradient(2,2,0,0); |
570 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
571 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
572 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(22,22),MWAWVec2i(22,22)); |
573 | 9.48k | m_gradientList.push_back(grad); |
574 | | // grad15 |
575 | 9.48k | grad=Gradient(1,2,180,0); |
576 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
577 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
578 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(0,1),MWAWVec2i(0,0)); |
579 | 9.48k | m_gradientList.push_back(grad); |
580 | | // grad16 |
581 | 9.48k | grad=Gradient(0,4,0,0); |
582 | 9.48k | grad.m_colors[0]=MWAWColor(0x00ff00); |
583 | 9.48k | grad.m_colors[1]=MWAWColor(0xffff00); |
584 | 9.48k | grad.m_colors[2]=MWAWColor(0xff7f00); |
585 | 9.48k | grad.m_colors[3]=MWAWColor(0xff0000); |
586 | 9.48k | m_gradientList.push_back(grad); |
587 | | // grad17 |
588 | 9.48k | grad=Gradient(0,4,0,0); |
589 | 9.48k | grad.m_colors[0]=MWAWColor(0x0000ff); |
590 | 9.48k | grad.m_colors[1]=MWAWColor(0x00a0ff); |
591 | 9.48k | grad.m_colors[2]=MWAWColor(0x00ffc0); |
592 | 9.48k | grad.m_colors[3]=MWAWColor(0x00ff00); |
593 | 9.48k | m_gradientList.push_back(grad); |
594 | | // grad18 |
595 | 9.48k | grad=Gradient(0,4,0,0); |
596 | 9.48k | grad.m_colors[0]=MWAWColor(0xff0000); |
597 | 9.48k | grad.m_colors[1]=MWAWColor(0xff00aa); |
598 | 9.48k | grad.m_colors[2]=MWAWColor(0x7f00ff); |
599 | 9.48k | grad.m_colors[3]=MWAWColor(0x0000ff); |
600 | 9.48k | m_gradientList.push_back(grad); |
601 | | // grad19 |
602 | 9.48k | grad=Gradient(0,3,135,0); |
603 | 9.48k | grad.m_colors[0]=MWAWColor(0x4cbcff); |
604 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
605 | 9.48k | grad.m_colors[2]=MWAWColor(0x660066); |
606 | 9.48k | m_gradientList.push_back(grad); |
607 | | // grad20 |
608 | 9.48k | grad=Gradient(0,3,225,0); |
609 | 9.48k | grad.m_colors[0]=MWAWColor(0xa64cff); |
610 | 9.48k | grad.m_colors[1]=MWAWColor(0x4c4cff); |
611 | 9.48k | grad.m_colors[2]=MWAWColor(0xff00ff); |
612 | 9.48k | m_gradientList.push_back(grad); |
613 | | // grad21 |
614 | 9.48k | grad=Gradient(2,3,0,0); |
615 | 9.48k | grad.m_colors[0]=MWAWColor(0xffcc66); |
616 | 9.48k | grad.m_colors[1]=MWAWColor(0x993300); |
617 | 9.48k | grad.m_colors[2]=MWAWColor(0x111111); |
618 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(23,22),MWAWVec2i(27,24)); |
619 | 9.48k | m_gradientList.push_back(grad); |
620 | | // grad22 |
621 | 9.48k | grad=Gradient(2,3,0,0); |
622 | 9.48k | grad.m_colors[0]=MWAWColor(0x3300ff); |
623 | 9.48k | grad.m_colors[1]=MWAWColor(0x3300ff); |
624 | 9.48k | grad.m_colors[2]=MWAWColor(0x0c0c0c); |
625 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(28,26),MWAWVec2i(28,31)); |
626 | 9.48k | m_gradientList.push_back(grad); |
627 | | // grad23 |
628 | 9.48k | grad=Gradient(1,4,135,0); |
629 | 9.48k | grad.m_colors[0]=MWAWColor(0x000000); |
630 | 9.48k | grad.m_colors[1]=MWAWColor(0x0000ff); |
631 | 9.48k | grad.m_colors[2]=MWAWColor(0x000000); |
632 | 9.48k | grad.m_colors[3]=MWAWColor(0x000000); |
633 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(255,247),MWAWVec2i(255,250)); |
634 | 9.48k | m_gradientList.push_back(grad); |
635 | | // grad24 |
636 | 9.48k | grad=Gradient(0,3,270,0.998474f); |
637 | 9.48k | grad.m_colors[0]=MWAWColor(0x000000); |
638 | 9.48k | grad.m_colors[1]=MWAWColor(0x330099); |
639 | 9.48k | grad.m_colors[2]=MWAWColor(0xffc000); |
640 | 9.48k | m_gradientList.push_back(grad); |
641 | | // grad25 |
642 | 9.48k | grad=Gradient(0,3,270,0); |
643 | 9.48k | grad.m_colors[0]=MWAWColor(0x000000); |
644 | 9.48k | grad.m_colors[1]=MWAWColor(0x4c4cff); |
645 | 9.48k | grad.m_colors[2]=MWAWColor(0x660044); |
646 | 9.48k | m_gradientList.push_back(grad); |
647 | | // grad26 |
648 | 9.48k | grad=Gradient(0,3,180,0); |
649 | 9.48k | grad.m_colors[0]=MWAWColor(0x666666); |
650 | 9.48k | grad.m_colors[1]=MWAWColor(0x33cc33); |
651 | 9.48k | grad.m_colors[2]=MWAWColor(0xcc00ff); |
652 | 9.48k | m_gradientList.push_back(grad); |
653 | | // grad27 |
654 | 9.48k | grad=Gradient(0,2,45,0); |
655 | 9.48k | grad.m_colors[0]=MWAWColor(0xff0000); |
656 | 9.48k | grad.m_colors[1]=MWAWColor(0x664c00); |
657 | 9.48k | m_gradientList.push_back(grad); |
658 | | // grad28 |
659 | 9.48k | grad=Gradient(0,4,145,0); |
660 | 9.48k | grad.m_colors[0]=MWAWColor(0x006099); |
661 | 9.48k | grad.m_colors[1]=MWAWColor(0x00e0ff); |
662 | 9.48k | grad.m_colors[2]=MWAWColor(0x00cc99); |
663 | 9.48k | grad.m_colors[3]=MWAWColor(0x006633); |
664 | 9.48k | m_gradientList.push_back(grad); |
665 | | // grad29 |
666 | 9.48k | grad=Gradient(2,3,0,0); |
667 | 9.48k | grad.m_colors[0]=MWAWColor(0xcccc33); |
668 | 9.48k | grad.m_colors[1]=MWAWColor(0x666600); |
669 | 9.48k | grad.m_colors[2]=MWAWColor(0x111111); |
670 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(23,21),MWAWVec2i(23,21)); |
671 | 9.48k | m_gradientList.push_back(grad); |
672 | | // grad30 |
673 | 9.48k | grad=Gradient(2,3,0,0); |
674 | 9.48k | grad.m_colors[0]=MWAWColor(0x00cc33); |
675 | 9.48k | grad.m_colors[1]=MWAWColor(0x005500); |
676 | 9.48k | grad.m_colors[2]=MWAWColor(0x0c0c0c); |
677 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(19,21),MWAWVec2i(22,26)); |
678 | 9.48k | m_gradientList.push_back(grad); |
679 | | // grad31 |
680 | 9.48k | grad=Gradient(1,3,45,0); |
681 | 9.48k | grad.m_colors[0]=MWAWColor(0xff4c4c); |
682 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
683 | 9.48k | grad.m_colors[2]=MWAWColor(0x66002a); |
684 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(255,224),MWAWVec2i(255,237)); |
685 | 9.48k | m_gradientList.push_back(grad); |
686 | | // grad32 |
687 | 9.48k | grad=Gradient(0,3,180,0); |
688 | 9.48k | grad.m_colors[0]=MWAWColor(0xff00ff); |
689 | 9.48k | grad.m_colors[1]=MWAWColor(0x6666cc); |
690 | 9.48k | grad.m_colors[2]=MWAWColor(0x9999ff); |
691 | 9.48k | m_gradientList.push_back(grad); |
692 | | // grad33 |
693 | 9.48k | grad=Gradient(0,2,177,0.660599f); |
694 | 9.48k | grad.m_colors[0]=MWAWColor(0x00cc00); |
695 | 9.48k | grad.m_colors[1]=MWAWColor(0xffdf00); |
696 | 9.48k | m_gradientList.push_back(grad); |
697 | | // grad34 |
698 | 9.48k | grad=Gradient(0,4,270,0.576279f); |
699 | 9.48k | grad.m_colors[0]=MWAWColor(0x66002a); |
700 | 9.48k | grad.m_colors[1]=MWAWColor(0x990066); |
701 | 9.48k | grad.m_colors[2]=MWAWColor(0x990099); |
702 | 9.48k | grad.m_colors[3]=MWAWColor(0xcc00cc); |
703 | 9.48k | m_gradientList.push_back(grad); |
704 | | // grad35 |
705 | 9.48k | grad=Gradient(0,2,155,0.712677f); |
706 | 9.48k | grad.m_colors[0]=MWAWColor(0xff0000); |
707 | 9.48k | grad.m_colors[1]=MWAWColor(0xffff00); |
708 | 9.48k | m_gradientList.push_back(grad); |
709 | | // grad36 |
710 | 9.48k | grad=Gradient(0,4,45,0); |
711 | 9.48k | grad.m_colors[0]=MWAWColor(0x004066); |
712 | 9.48k | grad.m_colors[1]=MWAWColor(0x00e0ff); |
713 | 9.48k | grad.m_colors[2]=MWAWColor(0xffffcc); |
714 | 9.48k | grad.m_colors[3]=MWAWColor(0xff4c4c); |
715 | 9.48k | m_gradientList.push_back(grad); |
716 | | // grad37 |
717 | 9.48k | grad=Gradient(2,3,0,0); |
718 | 9.48k | grad.m_colors[0]=MWAWColor(0xff9999); |
719 | 9.48k | grad.m_colors[1]=MWAWColor(0x990000); |
720 | 9.48k | grad.m_colors[2]=MWAWColor(0x262626); |
721 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(17,19),MWAWVec2i(23,26)); |
722 | 9.48k | m_gradientList.push_back(grad); |
723 | | // grad38 |
724 | 9.48k | grad=Gradient(2,3,0,0); |
725 | 9.48k | grad.m_colors[0]=MWAWColor(0x0099cc); |
726 | 9.48k | grad.m_colors[1]=MWAWColor(0x0033cc); |
727 | 9.48k | grad.m_colors[2]=MWAWColor(0x111111); |
728 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(18,18),MWAWVec2i(22,21)); |
729 | 9.48k | m_gradientList.push_back(grad); |
730 | | // grad39 |
731 | 9.48k | grad=Gradient(1,2,214,0); |
732 | 9.48k | grad.m_colors[0]=MWAWColor(0xffdf00); |
733 | 9.48k | grad.m_colors[1]=MWAWColor(0x0000cc); |
734 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(0,24),MWAWVec2i(255,232)); |
735 | 9.48k | m_gradientList.push_back(grad); |
736 | | // grad40 |
737 | 9.48k | grad=Gradient(0,3,0,0); |
738 | 9.48k | grad.m_colors[0]=MWAWColor(0x330033); |
739 | 9.48k | grad.m_colors[1]=MWAWColor(0x006666); |
740 | 9.48k | grad.m_colors[2]=MWAWColor(0x660033); |
741 | 9.48k | m_gradientList.push_back(grad); |
742 | | // grad41 |
743 | 9.48k | grad=Gradient(0,2,90,0); |
744 | 9.48k | grad.m_colors[0]=MWAWColor(0x005966); |
745 | 9.48k | grad.m_colors[1]=MWAWColor(0xff4c4c); |
746 | 9.48k | m_gradientList.push_back(grad); |
747 | | // grad42 |
748 | 9.48k | grad=Gradient(0,3,180,0); |
749 | 9.48k | grad.m_colors[0]=MWAWColor(0x000000); |
750 | 9.48k | grad.m_colors[1]=MWAWColor(0x0080ff); |
751 | 9.48k | grad.m_colors[2]=MWAWColor(0x000000); |
752 | 9.48k | m_gradientList.push_back(grad); |
753 | | // grad43 |
754 | 9.48k | grad=Gradient(0,3,45,0); |
755 | 9.48k | grad.m_colors[0]=MWAWColor(0x004066); |
756 | 9.48k | grad.m_colors[1]=MWAWColor(0x4c4cff); |
757 | 9.48k | grad.m_colors[2]=MWAWColor(0x6600cc); |
758 | 9.48k | m_gradientList.push_back(grad); |
759 | | // grad44 |
760 | 9.48k | grad=Gradient(0,4,135,0); |
761 | 9.48k | grad.m_colors[0]=MWAWColor(0x330066); |
762 | 9.48k | grad.m_colors[1]=MWAWColor(0xa64cff); |
763 | 9.48k | grad.m_colors[2]=MWAWColor(0xffff99); |
764 | 9.48k | grad.m_colors[3]=MWAWColor(0xccccff); |
765 | 9.48k | m_gradientList.push_back(grad); |
766 | | // grad45 |
767 | 9.48k | grad=Gradient(2,2,0,0); |
768 | 9.48k | grad.m_colors[0]=MWAWColor(0x7f00ff); |
769 | 9.48k | grad.m_colors[1]=MWAWColor(0x990066); |
770 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(70,24),MWAWVec2i(78,30)); |
771 | 9.48k | m_gradientList.push_back(grad); |
772 | | // grad46 |
773 | 9.48k | grad=Gradient(2,2,0,0); |
774 | 9.48k | grad.m_colors[0]=MWAWColor(0x7f00ff); |
775 | 9.48k | grad.m_colors[1]=MWAWColor(0xff0000); |
776 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(70,24),MWAWVec2i(78,30)); |
777 | 9.48k | m_gradientList.push_back(grad); |
778 | | // grad47 |
779 | 9.48k | grad=Gradient(1,3,166,0); |
780 | 9.48k | grad.m_colors[0]=MWAWColor(0x008699); |
781 | 9.48k | grad.m_colors[1]=MWAWColor(0x4c9900); |
782 | 9.48k | grad.m_colors[2]=MWAWColor(0x990066); |
783 | 9.48k | m_gradientList.push_back(grad); |
784 | | // grad48 |
785 | 9.48k | grad=Gradient(0,3,180,0); |
786 | 9.48k | grad.m_colors[0]=MWAWColor(0xcc99ff); |
787 | 9.48k | grad.m_colors[1]=MWAWColor(0xff7f00); |
788 | 9.48k | grad.m_colors[2]=MWAWColor(0xff0000); |
789 | 9.48k | m_gradientList.push_back(grad); |
790 | | // grad49 |
791 | 9.48k | grad=Gradient(0,2,180,0); |
792 | 9.48k | grad.m_colors[0]=MWAWColor(0xffffff); |
793 | 9.48k | grad.m_colors[1]=MWAWColor(0xffff00); |
794 | 9.48k | m_gradientList.push_back(grad); |
795 | | // grad50 |
796 | 9.48k | grad=Gradient(0,4,270,0); |
797 | 9.48k | grad.m_colors[0]=MWAWColor(0x000000); |
798 | 9.48k | grad.m_colors[1]=MWAWColor(0xa64cff); |
799 | 9.48k | grad.m_colors[2]=MWAWColor(0x330066); |
800 | 9.48k | grad.m_colors[3]=MWAWColor(0x0000dd); |
801 | 9.48k | m_gradientList.push_back(grad); |
802 | | // grad51 |
803 | 9.48k | grad=Gradient(0,3,315,0); |
804 | 9.48k | grad.m_colors[0]=MWAWColor(0x4cff4c); |
805 | 9.48k | grad.m_colors[1]=MWAWColor(0x4cffd3); |
806 | 9.48k | grad.m_colors[2]=MWAWColor(0x005966); |
807 | 9.48k | m_gradientList.push_back(grad); |
808 | | // grad52 |
809 | 9.48k | grad=Gradient(0,2,225,0); |
810 | 9.48k | grad.m_colors[0]=MWAWColor(0x990066); |
811 | 9.48k | grad.m_colors[1]=MWAWColor(0x0000ff); |
812 | 9.48k | m_gradientList.push_back(grad); |
813 | | // grad53 |
814 | 9.48k | grad=Gradient(2,4,0,0); |
815 | 9.48k | grad.m_colors[0]=MWAWColor(0xfff399); |
816 | 9.48k | grad.m_colors[1]=MWAWColor(0xffc000); |
817 | 9.48k | grad.m_colors[2]=MWAWColor(0xff0000); |
818 | 9.48k | grad.m_colors[3]=MWAWColor(0x661900); |
819 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(90,43),MWAWVec2i(100,50)); |
820 | 9.48k | m_gradientList.push_back(grad); |
821 | | // grad54 |
822 | 9.48k | grad=Gradient(2,2,0,0); |
823 | 9.48k | grad.m_colors[0]=MWAWColor(0xffff4c); |
824 | 9.48k | grad.m_colors[1]=MWAWColor(0xff00aa); |
825 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(0,0),MWAWVec2i(7,7)); |
826 | 9.48k | m_gradientList.push_back(grad); |
827 | | // grad55 |
828 | 9.48k | grad=Gradient(1,4,360,0); |
829 | 9.48k | grad.m_colors[0]=MWAWColor(0x003ecc); |
830 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
831 | 9.48k | grad.m_colors[2]=MWAWColor(0x00ffc0); |
832 | 9.48k | grad.m_colors[3]=MWAWColor(0x990066); |
833 | 9.48k | m_gradientList.push_back(grad); |
834 | | // grad56 |
835 | 9.48k | grad=Gradient(0,3,270,0); |
836 | 9.48k | grad.m_colors[0]=MWAWColor(0x0c0c0c); |
837 | 9.48k | grad.m_colors[1]=MWAWColor(0x6633ff); |
838 | 9.48k | grad.m_colors[2]=MWAWColor(0x666600); |
839 | 9.48k | m_gradientList.push_back(grad); |
840 | | // grad57 |
841 | 9.48k | grad=Gradient(0,4,90,0); |
842 | 9.48k | grad.m_colors[0]=MWAWColor(0x00ff7f); |
843 | 9.48k | grad.m_colors[1]=MWAWColor(0x000000); |
844 | 9.48k | grad.m_colors[2]=MWAWColor(0x000000); |
845 | 9.48k | grad.m_colors[3]=MWAWColor(0xff0000); |
846 | 9.48k | m_gradientList.push_back(grad); |
847 | | // grad58 |
848 | 9.48k | grad=Gradient(0,4,0,0); |
849 | 9.48k | grad.m_colors[0]=MWAWColor(0xff794c); |
850 | 9.48k | grad.m_colors[1]=MWAWColor(0xff9999); |
851 | 9.48k | grad.m_colors[2]=MWAWColor(0x00ffff); |
852 | 9.48k | grad.m_colors[3]=MWAWColor(0x6600cc); |
853 | 9.48k | m_gradientList.push_back(grad); |
854 | | // grad59 |
855 | 9.48k | grad=Gradient(0,2,45,0.958786f); |
856 | 9.48k | grad.m_colors[0]=MWAWColor(0xffff00); |
857 | 9.48k | grad.m_colors[1]=MWAWColor(0xff00aa); |
858 | 9.48k | m_gradientList.push_back(grad); |
859 | | // grad60 |
860 | 9.48k | grad=Gradient(0,4,135,0); |
861 | 9.48k | grad.m_colors[0]=MWAWColor(0x660066); |
862 | 9.48k | grad.m_colors[1]=MWAWColor(0x006099); |
863 | 9.48k | grad.m_colors[2]=MWAWColor(0xff00ff); |
864 | 9.48k | grad.m_colors[3]=MWAWColor(0xff006a); |
865 | 9.48k | m_gradientList.push_back(grad); |
866 | | // grad61 |
867 | 9.48k | grad=Gradient(2,3,0,0); |
868 | 9.48k | grad.m_colors[0]=MWAWColor(0xf3f3f3); |
869 | 9.48k | grad.m_colors[1]=MWAWColor(0x99ffff); |
870 | 9.48k | grad.m_colors[2]=MWAWColor(0xff99c4); |
871 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(18,58),MWAWVec2i(25,89)); |
872 | 9.48k | m_gradientList.push_back(grad); |
873 | | // grad62 |
874 | 9.48k | grad=Gradient(2,3,0,0); |
875 | 9.48k | grad.m_colors[0]=MWAWColor(0xff006a); |
876 | 9.48k | grad.m_colors[1]=MWAWColor(0x660044); |
877 | 9.48k | grad.m_colors[2]=MWAWColor(0x001f66); |
878 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(0,0),MWAWVec2i(7,100)); |
879 | 9.48k | m_gradientList.push_back(grad); |
880 | | // grad63 |
881 | 9.48k | grad=Gradient(1,2,294,0); |
882 | 9.48k | grad.m_colors[0]=MWAWColor(0x0000ff); |
883 | 9.48k | grad.m_colors[1]=MWAWColor(0xccccff); |
884 | 9.48k | grad.m_box=MWAWBox2i(MWAWVec2i(0,13),MWAWVec2i(0,29)); |
885 | 9.48k | m_gradientList.push_back(grad); |
886 | 9.48k | } |
887 | | |
888 | | void State::initBWPatterns() |
889 | 2.36M | { |
890 | 2.36M | if (!m_BWPatternList.empty()) return; |
891 | 13.7k | m_BWPatternList.resize(64); |
892 | 896k | for (size_t i = 0; i < 64; i++) { |
893 | 882k | static uint16_t const s_pattern[4*64] = { |
894 | 882k | 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x7fff, 0xffff, 0xf7ff, 0xffff, 0x7fff, 0xf7ff, 0x7fff, 0xf7ff, |
895 | 882k | 0xffee, 0xffbb, 0xffee, 0xffbb, 0x77dd, 0x77dd, 0x77dd, 0x77dd, 0xaa55, 0xaa55, 0xaa55, 0xaa55, 0x8822, 0x8822, 0x8822, 0x8822, |
896 | 882k | 0xaa00, 0xaa00, 0xaa00, 0xaa00, 0xaa00, 0x4400, 0xaa00, 0x1100, 0x8800, 0xaa00, 0x8800, 0xaa00, 0x8800, 0x2200, 0x8800, 0x2200, |
897 | 882k | 0x8000, 0x0800, 0x8000, 0x0800, 0x8800, 0x0000, 0x8800, 0x0000, 0x8000, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, |
898 | 882k | 0xeedd, 0xbb77, 0xeedd, 0xbb77, 0x3366, 0xcc99, 0x3366, 0xcc99, 0x1122, 0x4488, 0x1122, 0x4488, 0x8307, 0x0e1c, 0x3870, 0xe0c1, |
899 | 882k | 0x0306, 0x0c18, 0x3060, 0xc081, 0x0102, 0x0408, 0x1020, 0x4080, 0xffff, 0x0000, 0x0000, 0x0000, 0xff00, 0x0000, 0x0000, 0x0000, |
900 | 882k | 0x77bb, 0xddee, 0x77bb, 0xddee, 0x99cc, 0x6633, 0x99cc, 0x6633, 0x8844, 0x2211, 0x8844, 0x2211, 0xe070, 0x381c, 0x0e07, 0x83c1, |
901 | 882k | 0xc060, 0x3018, 0x0c06, 0x0381, 0x8040, 0x2010, 0x0804, 0x0201, 0xc0c0, 0xc0c0, 0xc0c0, 0xc0c0, 0x8080, 0x8080, 0x8080, 0x8080, |
902 | 882k | 0xffaa, 0xffaa, 0xffaa, 0xffaa, 0xe4e4, 0xe4e4, 0xe4e4, 0xe4e4, 0xffff, 0xff00, 0x00ff, 0x0000, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, |
903 | 882k | 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0x0000, 0xff00, 0x0000, 0x8888, 0x8888, 0x8888, 0x8888, 0xff80, 0x8080, 0x8080, 0x8080, |
904 | 882k | 0x4ecf, 0xfce4, 0x273f, 0xf372, 0x6006, 0x36b1, 0x8118, 0x1b63, 0x2004, 0x4002, 0x1080, 0x0801, 0x9060, 0x0609, 0x9060, 0x0609, |
905 | 882k | 0x8814, 0x2241, 0x8800, 0xaa00, 0x2050, 0x8888, 0x8888, 0x0502, 0xaa00, 0x8000, 0x8800, 0x8000, 0x2040, 0x8000, 0x0804, 0x0200, |
906 | 882k | 0xf0f0, 0xf0f0, 0x0f0f, 0x0f0f, 0x0077, 0x7777, 0x0077, 0x7777, 0xff88, 0x8888, 0xff88, 0x8888, 0xaa44, 0xaa11, 0xaa44, 0xaa11, |
907 | 882k | 0x8244, 0x2810, 0x2844, 0x8201, 0x8080, 0x413e, 0x0808, 0x14e3, 0x8142, 0x2418, 0x1020, 0x4080, 0x40a0, 0x0000, 0x040a, 0x0000, |
908 | 882k | 0x7789, 0x8f8f, 0x7798, 0xf8f8, 0xf1f8, 0x6cc6, 0x8f1f, 0x3663, 0xbf00, 0xbfbf, 0xb0b0, 0xb0b0, 0xff80, 0x8080, 0xff08, 0x0808, |
909 | 882k | 0x1020, 0x54aa, 0xff02, 0x0408, 0x0008, 0x142a, 0x552a, 0x1408, 0x55a0, 0x4040, 0x550a, 0x0404, 0x8244, 0x3944, 0x8201, 0x0101 |
910 | 882k | }; |
911 | 882k | MWAWGraphicStyle::Pattern pat; |
912 | 882k | pat.m_dim=MWAWVec2i(8,8); |
913 | 882k | pat.m_data.resize(8); |
914 | 882k | pat.m_colors[0]=MWAWColor::white(); |
915 | 882k | pat.m_colors[1]=MWAWColor::black(); |
916 | | |
917 | 882k | uint16_t const *patPtr=&s_pattern[4*i]; |
918 | 4.41M | for (size_t j=0; j<8; j+=2, ++patPtr) { |
919 | 3.53M | pat.m_data[j]=uint8_t((*patPtr)>>8); |
920 | 3.53M | pat.m_data[j+1]=uint8_t((*patPtr)&0xFF); |
921 | 3.53M | } |
922 | 882k | m_BWPatternList[i]=pat; |
923 | 882k | } |
924 | 13.7k | } |
925 | | |
926 | | } |
927 | | |
928 | | //////////////////////////////////////////////////////////// |
929 | | // constructor/destructor, ... |
930 | | //////////////////////////////////////////////////////////// |
931 | | ClarisDrawStyleManager::ClarisDrawStyleManager(ClarisDrawParser &parser) |
932 | 67.9k | : m_parser(parser) |
933 | 67.9k | , m_parserState(parser.getParserState()) |
934 | 67.9k | , m_state(new ClarisDrawStyleManagerInternal::State) |
935 | 67.9k | { |
936 | 67.9k | } |
937 | | |
938 | | ClarisDrawStyleManager::~ClarisDrawStyleManager() |
939 | 67.9k | { |
940 | 67.9k | } |
941 | | |
942 | | void ClarisDrawStyleManager::setDefaultNumbers(int nColors, int nGradients) |
943 | 5.24k | { |
944 | 5.24k | if (nColors==81||nColors==168||nColors==256) { |
945 | 1.90k | m_state->m_numColors=nColors; |
946 | | // reset the color, as default font can have create some font |
947 | 1.90k | m_state->m_colorList.clear(); |
948 | 1.90k | } |
949 | 3.34k | else if (nColors) { |
950 | 2.07k | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::setDefaultNumbers: the number of colors seems bad\n")); |
951 | 2.07k | } |
952 | 5.24k | if (nGradients==32||nGradients==64) |
953 | 1.98k | m_state->m_numGradients=nGradients; |
954 | 3.26k | else if (nGradients) { |
955 | 2.33k | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::setDefaultNumbers: the number of gradient seems bad\n")); |
956 | 2.33k | } |
957 | 5.24k | } |
958 | | //////////////////////////////////////////////////////////// |
959 | | // |
960 | | // Interface |
961 | | // |
962 | | //////////////////////////////////////////////////////////// |
963 | | bool ClarisDrawStyleManager::getColor(int cId, MWAWColor &color) const |
964 | 5.66M | { |
965 | 5.66M | m_state->initColors(); |
966 | 5.66M | if (cId<0||cId>=int(m_state->m_colorList.size())) { |
967 | 34.6k | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::getColor: can not find color %d\n", cId)); |
968 | 34.6k | return false; |
969 | 34.6k | } |
970 | 5.62M | color=m_state->m_colorList[size_t(cId)]; |
971 | 5.62M | return true; |
972 | 5.66M | } |
973 | | |
974 | | bool ClarisDrawStyleManager::getFont(int fId, MWAWFont &font) const |
975 | 0 | { |
976 | 0 | if (fId==0) return false; // none |
977 | 0 | if (fId<=0||fId>int(m_state->m_fontList.size())) { |
978 | 0 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::getFont: can not find font %d\n", fId)); |
979 | 0 | return false; |
980 | 0 | } |
981 | 0 | font=m_state->m_fontList[size_t(fId-1)]; |
982 | 0 | return true; |
983 | 0 | } |
984 | | |
985 | | bool ClarisDrawStyleManager::getParagraph(int fId, MWAWParagraph ¶) const |
986 | 0 | { |
987 | 0 | if (fId<0||fId>=int(m_state->m_paragraphList.size())) { |
988 | 0 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::getParagraph: can not find paragraph %d\n", fId)); |
989 | 0 | return false; |
990 | 0 | } |
991 | 0 | para=m_state->m_paragraphList[size_t(fId)]; |
992 | 0 | return true; |
993 | 0 | } |
994 | | |
995 | | bool ClarisDrawStyleManager::getDash(int dId, std::vector<float> &dash) const |
996 | 6.92k | { |
997 | 6.92k | if (dId==0) // a solid line |
998 | 0 | return false; |
999 | 6.92k | if (m_state->m_dashList.empty()) |
1000 | 767 | m_state->initDashs(); |
1001 | 6.92k | if (dId<=0||dId>int(m_state->m_dashList.size())) { |
1002 | 4.24k | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::getDash: can not find dash %d\n", dId)); |
1003 | 4.24k | return false; |
1004 | 4.24k | } |
1005 | 2.67k | dash=m_state->m_dashList[size_t(dId-1)]; |
1006 | 2.67k | return true; |
1007 | 6.92k | } |
1008 | | |
1009 | | bool ClarisDrawStyleManager::getPattern(int pId, MWAWGraphicStyle::Pattern &pattern) const |
1010 | 4.16M | { |
1011 | 4.16M | if (pId==0) // no pattern |
1012 | 1.79M | return false; |
1013 | | |
1014 | 2.36M | m_state->initBWPatterns(); |
1015 | 2.36M | if (pId<=0||pId>int(m_state->m_BWPatternList.size())) { |
1016 | 984k | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::getPattern: can not find BW pattern %d\n", pId)); |
1017 | 984k | return false; |
1018 | 984k | } |
1019 | 1.38M | pattern=m_state->m_BWPatternList[size_t(pId-1)]; |
1020 | | |
1021 | 1.38M | return true; |
1022 | 2.36M | } |
1023 | | |
1024 | | bool ClarisDrawStyleManager::updateGradient(int gId, MWAWGraphicStyle &style) const |
1025 | 548k | { |
1026 | 548k | if (m_state->m_gradientList.empty()) |
1027 | 8.66k | m_state->initGradients(); |
1028 | 548k | if (gId<0 || gId>=int(m_state->m_gradientList.size())) { |
1029 | 177k | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::updateGradient: can not find gradient %d\n", gId)); |
1030 | 177k | return false; |
1031 | 177k | } |
1032 | 370k | auto const &gradient=m_state->m_gradientList[size_t(gId)]; |
1033 | 370k | if (!gradient.update(style)) return false; |
1034 | | // try to update the color list |
1035 | 370k | auto &finalGrad=style.m_gradient; |
1036 | 370k | size_t numColors=finalGrad.m_stopList.size(); |
1037 | 370k | if (numColors<=1) return true; |
1038 | 370k | float f=1.f/float(numColors); |
1039 | 370k | MWAWColor col=MWAWColor::barycenter(f,finalGrad.m_stopList[0].m_color,f,finalGrad.m_stopList[1].m_color); |
1040 | 539k | for (size_t c=2; c<numColors; c++) |
1041 | 168k | col=MWAWColor::barycenter(1,col,f,finalGrad.m_stopList[c].m_color); |
1042 | 370k | style.setSurfaceColor(col); |
1043 | 370k | return true; |
1044 | 370k | } |
1045 | | |
1046 | | //////////////////////////////////////////////////////////// |
1047 | | // |
1048 | | // Intermediate level |
1049 | | // |
1050 | | //////////////////////////////////////////////////////////// |
1051 | | bool ClarisDrawStyleManager::readFontNames() |
1052 | 18.4k | { |
1053 | 18.4k | MWAWInputStreamPtr &input= m_parserState->m_input; |
1054 | 18.4k | long pos=input->tell(); |
1055 | 18.4k | if (!input->checkPosition(pos+8)) return false; |
1056 | 18.4k | libmwaw::DebugFile &ascFile = m_parserState->m_asciiFile; |
1057 | 18.4k | libmwaw::DebugStream f; |
1058 | 18.4k | f << "Entries(FNTM):"; |
1059 | 18.4k | ClarisWksStruct::Struct header; |
1060 | 18.4k | if (input->readULong(4) != 0x464e544d || !header.readHeader(input,true)) |
1061 | 12.6k | return false; |
1062 | 5.79k | if (header.m_size==0) { |
1063 | 3.96k | ascFile.addPos(pos); |
1064 | 3.96k | ascFile.addNote("_"); |
1065 | 3.96k | return true; |
1066 | 3.96k | } |
1067 | 1.82k | long endPos=pos+4+header.m_size; |
1068 | 1.82k | f << header; |
1069 | 1.82k | ascFile.addPos(pos); |
1070 | 1.82k | ascFile.addNote(f.str().c_str()); |
1071 | | |
1072 | 1.82k | pos=input->tell(); |
1073 | 1.82k | if (header.m_headerSize) { |
1074 | 547 | ascFile.addDelimiter(input->tell(),'|'); |
1075 | 547 | input->seek(header.m_headerSize, librevenge::RVNG_SEEK_CUR); |
1076 | 547 | } |
1077 | 1.82k | if (header.m_dataSize!=72) { |
1078 | 1.49k | input->seek(endPos, librevenge::RVNG_SEEK_SET); |
1079 | 1.49k | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readFontNames: no sure how to read the data\n")); |
1080 | 1.49k | ascFile.addPos(pos); |
1081 | 1.49k | ascFile.addNote("FNTM-data:###"); |
1082 | 1.49k | return true; |
1083 | 1.49k | } |
1084 | | |
1085 | 1.16k | for (int i=0; i<int(header.m_numData); ++i) { |
1086 | 836 | pos=input->tell(); |
1087 | 836 | f.str(""); |
1088 | 836 | f << "FNTM-" << i << ":"; |
1089 | 836 | auto fId=static_cast<int>(input->readULong(2)); |
1090 | 836 | f << "fId=" << fId << ","; |
1091 | 836 | auto val=static_cast<int>(input->readULong(2)); // always fId? |
1092 | 836 | if (val!=fId) f << "fId2=" << val << ","; |
1093 | 2.50k | for (int j=0; j<2; ++j) { // always 0? |
1094 | 1.67k | val=static_cast<int>(input->readLong(2)); |
1095 | 1.67k | if (val) f << "f" << j << "=" << val << ","; |
1096 | 1.67k | } |
1097 | 836 | auto sSz=static_cast<int>(input->readULong(1)); |
1098 | 836 | if (!sSz || sSz+9>header.m_dataSize) { // sSz==0 is probably normal |
1099 | 156 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readFontNames: the string size seems bad\n")); |
1100 | 156 | f << "###"; |
1101 | 156 | } |
1102 | 680 | else { |
1103 | 680 | std::string name(""); |
1104 | 8.83k | for (int s=0; s<sSz; ++s) name+=char(input->readULong(1)); |
1105 | 680 | f << "'" << name << "'"; |
1106 | 680 | m_parserState->m_fontConverter->setCorrespondance(fId, name); |
1107 | 680 | } |
1108 | 836 | input->seek(pos+header.m_dataSize, librevenge::RVNG_SEEK_SET); |
1109 | 836 | ascFile.addPos(pos); |
1110 | 836 | ascFile.addNote(f.str().c_str()); |
1111 | 836 | } |
1112 | 332 | return true; |
1113 | 1.82k | } |
1114 | | |
1115 | | bool ClarisDrawStyleManager::readFontStyles() |
1116 | 2.05k | { |
1117 | 2.05k | MWAWInputStreamPtr input = m_parserState->m_input; |
1118 | 2.05k | long pos = input->tell(); |
1119 | 2.05k | ClarisWksStruct::Struct header; |
1120 | 2.05k | if (!header.readHeader(input,false) || (header.m_size && header.m_dataSize!=40)) { |
1121 | 106 | input->seek(pos, librevenge::RVNG_SEEK_SET); |
1122 | 106 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readFontStyles: can not read header\n")); |
1123 | 106 | return false; |
1124 | 106 | } |
1125 | 1.95k | libmwaw::DebugFile &ascFile = m_parserState->m_asciiFile; |
1126 | 1.95k | libmwaw::DebugStream f; |
1127 | 1.95k | if (header.m_size==0) { |
1128 | 0 | ascFile.addPos(pos); |
1129 | 0 | ascFile.addNote("_"); |
1130 | 0 | return true; |
1131 | 0 | } |
1132 | | |
1133 | 1.95k | long endPos = pos+4+header.m_size; |
1134 | 1.95k | f << "Entries(FontStyle):" << header; |
1135 | 1.95k | if (header.m_headerSize) { |
1136 | 174 | ascFile.addDelimiter(input->tell(),'|'); |
1137 | 174 | input->seek(header.m_headerSize, librevenge::RVNG_SEEK_CUR); |
1138 | 174 | } |
1139 | 1.95k | ascFile.addPos(pos); |
1140 | 1.95k | ascFile.addNote(f.str().c_str()); |
1141 | | |
1142 | 1.95k | long debPos=input->tell(); |
1143 | 51.4k | for (int i = 0; i < int(header.m_numData); i++) { |
1144 | 49.4k | input->seek(debPos, librevenge::RVNG_SEEK_SET); |
1145 | 49.4k | f.str(""); |
1146 | 49.4k | f << "FontStyle-" << i << ":"; |
1147 | 49.4k | auto fId=static_cast<int>(input->readULong(2)); |
1148 | 49.4k | f << "fId=" << fId << ","; |
1149 | 49.4k | auto val=static_cast<int>(input->readULong(2)); // always fId? |
1150 | 49.4k | if (val!=fId) f << "fId2=" << val << ","; |
1151 | 49.4k | val=static_cast<int>(input->readULong(2)); |
1152 | 49.4k | if (val) f << "size=" << val << ","; |
1153 | 49.4k | val=static_cast<int>(input->readULong(2)); |
1154 | 49.4k | if (val!=0x2001) |
1155 | 39.0k | f << "fl=" << std::hex << val << std::dec << ","; |
1156 | 49.4k | auto sSz=static_cast<int>(input->readULong(1)); |
1157 | 49.4k | if (!sSz || sSz+9>header.m_dataSize) { |
1158 | 28.3k | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readFontStyles: the string size seems bad\n")); |
1159 | 28.3k | f << "###"; |
1160 | 28.3k | } |
1161 | 21.1k | else { |
1162 | 21.1k | std::string name(""); |
1163 | 190k | for (int s=0; s<sSz; ++s) name+=char(input->readULong(1)); |
1164 | 21.1k | f << "'" << name << "'"; |
1165 | 21.1k | } |
1166 | 49.4k | ascFile.addPos(debPos); |
1167 | 49.4k | ascFile.addNote(f.str().c_str()); |
1168 | 49.4k | debPos += header.m_dataSize; |
1169 | 49.4k | } |
1170 | 1.95k | input->seek(endPos,librevenge::RVNG_SEEK_SET); |
1171 | 1.95k | return true; |
1172 | 1.95k | } |
1173 | | |
1174 | | //////////////////////////////////////////////////////////// |
1175 | | // styles/settings present in data/rsrc fork |
1176 | | //////////////////////////////////////////////////////////// |
1177 | | |
1178 | | bool ClarisDrawStyleManager::readArrows() |
1179 | 1.85k | { |
1180 | 1.85k | MWAWInputStreamPtr input = m_parserState->m_input; |
1181 | 1.85k | long pos=input->tell(); |
1182 | 1.85k | ClarisWksStruct::Struct header; |
1183 | 1.85k | libmwaw::DebugFile &ascFile = m_parserState->m_asciiFile; |
1184 | 1.85k | libmwaw::DebugStream f; |
1185 | 1.85k | f << "Entries(Arrow):"; |
1186 | 1.85k | if (!header.readHeader(input,false) || (header.m_size && header.m_dataSize!=20)) { |
1187 | 144 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readArrows: the data size seems bad\n")); |
1188 | 144 | input->seek(pos, librevenge::RVNG_SEEK_SET); |
1189 | 144 | f << "###"; |
1190 | 144 | ascFile.addPos(pos); |
1191 | 144 | ascFile.addNote(f.str().c_str()); |
1192 | 144 | return false; |
1193 | 144 | } |
1194 | | |
1195 | 1.71k | if (header.m_dataSize==0) { |
1196 | 0 | ascFile.addPos(pos); |
1197 | 0 | ascFile.addNote("_"); |
1198 | 0 | return true; |
1199 | 0 | } |
1200 | 1.71k | long endPos=pos+4+header.m_size; |
1201 | 1.71k | f << header; |
1202 | 1.71k | if (header.m_headerSize) { |
1203 | 4 | ascFile.addDelimiter(input->tell(),'|'); |
1204 | 4 | input->seek(header.m_headerSize, librevenge::RVNG_SEEK_CUR); |
1205 | 4 | } |
1206 | | |
1207 | 1.71k | ascFile.addPos(pos); |
1208 | 1.71k | ascFile.addNote(f.str().c_str()); |
1209 | 5.11k | for (int i=0; i<int(header.m_numData); ++i) { |
1210 | 3.39k | pos=input->tell(); |
1211 | 3.39k | f.str(""); |
1212 | 3.39k | f << "Arrow-A" << i+1 << ","; |
1213 | 3.39k | double value; |
1214 | 3.39k | bool isNAN; |
1215 | 3.39k | if (!input->readDouble8(value, isNAN)) |
1216 | 3 | f << "###,"; |
1217 | 3.39k | else |
1218 | 3.39k | f << value << ","; |
1219 | 3.39k | long val=input->readLong(4); |
1220 | 3.39k | if (val) f<<"id=" << val << ","; |
1221 | 3.39k | float pt[2]; // position of the symetric point in the arrow head |
1222 | 6.79k | for (auto &p : pt) p=float(input->readULong(4))/256.f; |
1223 | 3.39k | f << "pt=" << pt[1] << "x" << pt[0] << ","; |
1224 | 3.39k | ascFile.addPos(pos); |
1225 | 3.39k | ascFile.addNote(f.str().c_str()); |
1226 | 3.39k | } |
1227 | 1.71k | input->seek(endPos, librevenge::RVNG_SEEK_SET); |
1228 | 1.71k | return true; |
1229 | 1.71k | } |
1230 | | |
1231 | | bool ClarisDrawStyleManager::readDashs() |
1232 | 1.83k | { |
1233 | 1.83k | MWAWInputStreamPtr input = m_parserState->m_input; |
1234 | 1.83k | long pos=input->tell(); |
1235 | 1.83k | libmwaw::DebugFile &ascFile = m_parserState->m_asciiFile; |
1236 | 1.83k | libmwaw::DebugStream f; |
1237 | 1.83k | f << "Entries(Dash):"; |
1238 | 1.83k | ClarisWksStruct::Struct header; |
1239 | 1.83k | if (!header.readHeader(input,false) || (header.m_size && header.m_dataSize!=28)) { |
1240 | 137 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readDashs: the data size seems bad\n")); |
1241 | 137 | input->seek(pos, librevenge::RVNG_SEEK_SET); |
1242 | 137 | f << "###"; |
1243 | 137 | ascFile.addPos(pos); |
1244 | 137 | ascFile.addNote(f.str().c_str()); |
1245 | 137 | return false; |
1246 | 137 | } |
1247 | 1.69k | if (header.m_size==0) { |
1248 | 0 | ascFile.addPos(pos); |
1249 | 0 | ascFile.addNote("_"); |
1250 | 0 | return true; |
1251 | 0 | } |
1252 | 1.69k | long endPos=pos+4+header.m_size; |
1253 | 1.69k | f << header; |
1254 | 1.69k | if (header.m_headerSize) { |
1255 | 3 | ascFile.addDelimiter(input->tell(),'|'); |
1256 | 3 | input->seek(header.m_headerSize, librevenge::RVNG_SEEK_CUR); |
1257 | 3 | } |
1258 | 1.69k | ascFile.addPos(pos); |
1259 | 1.69k | ascFile.addNote(f.str().c_str()); |
1260 | | |
1261 | 12.6k | for (int i=0; i<int(header.m_numData); ++i) { |
1262 | 10.9k | pos=input->tell(); |
1263 | 10.9k | f.str(""); |
1264 | 10.9k | f << "Dash-D" << i+1 << ","; |
1265 | 10.9k | long val=input->readLong(4); |
1266 | 10.9k | if (val!=1) f<<"numUsed=" << val << ","; |
1267 | 10.9k | f << "dash=["; |
1268 | 10.9k | std::vector<float> dash; |
1269 | 43.6k | for (int k=0; k<3; ++k) { |
1270 | 32.7k | auto solid=long(input->readULong(4)); |
1271 | 32.7k | auto empty=long(input->readULong(4)); |
1272 | 32.7k | if (!solid && !empty) continue; |
1273 | 15.9k | dash.push_back(float(solid)/65536.f); |
1274 | 15.9k | dash.push_back(float(empty)/65536.f); |
1275 | 15.9k | f << double(solid)/65536. << "x" << double(empty)/65536. << ","; |
1276 | 15.9k | } |
1277 | 10.9k | m_state->m_dashList.push_back(dash); |
1278 | 10.9k | f << "],"; |
1279 | 10.9k | ascFile.addPos(pos); |
1280 | 10.9k | ascFile.addNote(f.str().c_str()); |
1281 | 10.9k | } |
1282 | 1.69k | input->seek(endPos, librevenge::RVNG_SEEK_SET); |
1283 | 1.69k | return true; |
1284 | 1.69k | } |
1285 | | |
1286 | | bool ClarisDrawStyleManager::readRulers() |
1287 | 1.81k | { |
1288 | 1.81k | MWAWInputStreamPtr input = m_parserState->m_input; |
1289 | 1.81k | long pos=input->tell(); |
1290 | 1.81k | ClarisWksStruct::Struct header; |
1291 | 1.81k | libmwaw::DebugFile &ascFile = m_parserState->m_asciiFile; |
1292 | 1.81k | libmwaw::DebugStream f; |
1293 | 1.81k | f << "Entries(RulerStyle):"; |
1294 | 1.81k | if (!header.readHeader(input,false) || (header.m_size && header.m_dataSize!=28)) { |
1295 | 186 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readRulers: the data size seems bad\n")); |
1296 | 186 | input->seek(pos, librevenge::RVNG_SEEK_SET); |
1297 | 186 | f << "###"; |
1298 | 186 | ascFile.addPos(pos); |
1299 | 186 | ascFile.addNote(f.str().c_str()); |
1300 | 186 | return false; |
1301 | 186 | } |
1302 | 1.63k | if (header.m_dataSize==0) { |
1303 | 0 | ascFile.addPos(pos); |
1304 | 0 | ascFile.addNote("_"); |
1305 | 0 | return true; |
1306 | 0 | } |
1307 | 1.63k | long endPos=pos+4+header.m_size; |
1308 | 1.63k | f << header; |
1309 | 1.63k | if (header.m_headerSize) { |
1310 | 1 | ascFile.addDelimiter(input->tell(),'|'); |
1311 | 1 | input->seek(header.m_headerSize, librevenge::RVNG_SEEK_CUR); |
1312 | 1 | } |
1313 | 1.63k | ascFile.addPos(pos); |
1314 | 1.63k | ascFile.addNote(f.str().c_str()); |
1315 | 11.3k | for (int i=0; i<int(header.m_numData); ++i) { |
1316 | 9.75k | pos=input->tell(); |
1317 | 9.75k | f.str(""); |
1318 | 9.75k | f << "RulerStyle-R" << i+1 << ":"; |
1319 | 9.75k | auto numUsed=static_cast<int>(input->readULong(4)); |
1320 | 9.75k | if (numUsed!=1) f << "numUsed=" << numUsed << ","; |
1321 | 29.2k | for (int j=0; j<2; ++j) { |
1322 | 19.5k | double value; |
1323 | 19.5k | bool isNAN; |
1324 | 19.5k | if (!input->readDouble10(value, isNAN)) |
1325 | 11 | f << "###,"; |
1326 | 19.4k | else |
1327 | 19.4k | f << value << ","; |
1328 | 19.5k | } |
1329 | 9.75k | f << "num[subd]=" << input->readULong(2) << ","; |
1330 | 9.75k | f << "fl=" << std::hex << input->readULong(2) << std::dec << ","; |
1331 | 9.75k | ascFile.addPos(pos); |
1332 | 9.75k | ascFile.addNote(f.str().c_str()); |
1333 | 9.75k | } |
1334 | 1.63k | input->seek(endPos, librevenge::RVNG_SEEK_SET); |
1335 | 1.63k | return true; |
1336 | 1.63k | } |
1337 | | |
1338 | | //////////////////////////////////////////////////////////// |
1339 | | // read file main structure |
1340 | | //////////////////////////////////////////////////////////// |
1341 | | bool ClarisDrawStyleManager::readColorList() |
1342 | 1.02k | { |
1343 | 1.02k | MWAWInputStreamPtr &input= m_parserState->m_input; |
1344 | 1.02k | long pos=input->tell(); |
1345 | 1.02k | libmwaw::DebugFile &ascFile = m_parserState->m_asciiFile; |
1346 | 1.02k | libmwaw::DebugStream f; |
1347 | 1.02k | f << "Entries(ColorList):"; |
1348 | 1.02k | ClarisWksStruct::Struct header; |
1349 | 1.02k | if (!header.readHeader(input,false) || (header.m_size && header.m_dataSize!=6)) { |
1350 | 151 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readColorList: the data size seems bad\n")); |
1351 | 151 | input->seek(pos, librevenge::RVNG_SEEK_SET); |
1352 | 151 | f << "###"; |
1353 | 151 | ascFile.addPos(pos); |
1354 | 151 | ascFile.addNote(f.str().c_str()); |
1355 | 151 | return false; |
1356 | 151 | } |
1357 | 873 | if (header.m_size==0) { |
1358 | 0 | ascFile.addPos(pos); |
1359 | 0 | ascFile.addNote("_"); |
1360 | 0 | return true; |
1361 | 0 | } |
1362 | 873 | long endPos=pos+4+header.m_size; |
1363 | 873 | f << header; |
1364 | 873 | if (header.m_headerSize) { |
1365 | 6 | ascFile.addDelimiter(input->tell(),'|'); |
1366 | 6 | input->seek(header.m_headerSize, librevenge::RVNG_SEEK_CUR); |
1367 | 6 | ascFile.addDelimiter(input->tell(),'|'); |
1368 | 6 | } |
1369 | | // only set color if the color numbering is unknown: ie. something this set is not the final set... |
1370 | 873 | bool setColor=m_state->m_numColors==0; |
1371 | 873 | if (setColor) |
1372 | 339 | m_state->m_colorList.clear(); |
1373 | 220k | for (int i=0; i < int(header.m_numData); ++i) { |
1374 | 219k | unsigned char color[3]; |
1375 | 659k | for (auto &col : color) col = static_cast<unsigned char>(input->readULong(2)/256); |
1376 | 219k | MWAWColor col(color[0], color[1],color[2]); |
1377 | 219k | f << col << ","; |
1378 | 219k | if (setColor) |
1379 | 83.2k | m_state->m_colorList.push_back(col); |
1380 | 219k | } |
1381 | 873 | ascFile.addPos(pos); |
1382 | 873 | ascFile.addNote(f.str().c_str()); |
1383 | 873 | input->seek(endPos,librevenge::RVNG_SEEK_SET); |
1384 | 873 | return true; |
1385 | 873 | } |
1386 | | |
1387 | | bool ClarisDrawStyleManager::readPatternList() |
1388 | 407 | { |
1389 | 407 | MWAWInputStreamPtr &input= m_parserState->m_input; |
1390 | 407 | long pos=input->tell(); |
1391 | 407 | libmwaw::DebugFile &ascFile = m_parserState->m_asciiFile; |
1392 | 407 | libmwaw::DebugStream f; |
1393 | 407 | f << "Entries(PatternList):"; |
1394 | 407 | ClarisWksStruct::Struct header; |
1395 | 407 | if (!header.readHeader(input,false) || (header.m_size && header.m_dataSize!=8)) { |
1396 | 363 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readPatternList: the data size seems bad\n")); |
1397 | 363 | input->seek(pos, librevenge::RVNG_SEEK_SET); |
1398 | 363 | f << "###"; |
1399 | 363 | ascFile.addPos(pos); |
1400 | 363 | ascFile.addNote(f.str().c_str()); |
1401 | 363 | return false; |
1402 | 363 | } |
1403 | 44 | if (header.m_size==0) { |
1404 | 0 | ascFile.addPos(pos); |
1405 | 0 | ascFile.addNote("_"); |
1406 | 0 | return true; |
1407 | 0 | } |
1408 | 44 | long endPos=pos+4+header.m_size; |
1409 | 44 | f << header; |
1410 | 44 | if (header.m_headerSize) { |
1411 | 11 | ascFile.addDelimiter(input->tell(),'|'); |
1412 | 11 | input->seek(header.m_headerSize, librevenge::RVNG_SEEK_CUR); |
1413 | 11 | ascFile.addDelimiter(input->tell(),'|'); |
1414 | 11 | } |
1415 | 44 | m_state->initBWPatterns(); |
1416 | 1.61k | for (int i=0; i < int(header.m_numData); ++i) { |
1417 | 1.56k | MWAWGraphicStyle::Pattern pattern; |
1418 | 1.56k | pattern.m_colors[0]=MWAWColor::white(); |
1419 | 1.56k | pattern.m_colors[1]=MWAWColor::black(); |
1420 | 1.56k | pattern.m_dim=MWAWVec2i(8,8); |
1421 | 1.56k | pattern.m_data.resize(8); |
1422 | 12.5k | for (auto &data : pattern.m_data) data=static_cast<uint8_t>(input->readULong(1)); |
1423 | 1.56k | m_state->m_BWPatternList.push_back(pattern); |
1424 | 1.56k | f << "pat" << i+64 << "=[" << pattern << "],"; |
1425 | 1.56k | } |
1426 | 44 | ascFile.addPos(pos); |
1427 | 44 | ascFile.addNote(f.str().c_str()); |
1428 | 44 | input->seek(endPos,librevenge::RVNG_SEEK_SET); |
1429 | 44 | return true; |
1430 | 44 | } |
1431 | | |
1432 | | bool ClarisDrawStyleManager::readGradientList() |
1433 | 1.17k | { |
1434 | 1.17k | MWAWInputStreamPtr &input= m_parserState->m_input; |
1435 | 1.17k | long pos=input->tell(); |
1436 | 1.17k | libmwaw::DebugFile &ascFile = m_parserState->m_asciiFile; |
1437 | 1.17k | libmwaw::DebugStream f; |
1438 | 1.17k | f << "Entries(GradientList):"; |
1439 | 1.17k | ClarisWksStruct::Struct header; |
1440 | 1.17k | if (!header.readHeader(input,false) || (header.m_size && header.m_dataSize!=0x28)) { |
1441 | 272 | f << "###"; |
1442 | 272 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readGradientList: can read pattern size\n")); |
1443 | 272 | ascFile.addPos(pos); |
1444 | 272 | ascFile.addNote(f.str().c_str()); |
1445 | 272 | input->seek(pos,librevenge::RVNG_SEEK_SET); |
1446 | 272 | return false; |
1447 | 272 | } |
1448 | 907 | if (header.m_size==0) { |
1449 | 0 | ascFile.addPos(pos); |
1450 | 0 | ascFile.addNote("_"); |
1451 | 0 | return true; |
1452 | 0 | } |
1453 | 907 | long endPos=pos+4+header.m_size; |
1454 | 907 | f << header; |
1455 | 907 | auto const numDefGrad=int(header.m_headerSize/2); |
1456 | 907 | if (numDefGrad!=32 && numDefGrad!=64) { |
1457 | 11 | f << "###"; |
1458 | 11 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readGradientList: unexpected pattern size\n")); |
1459 | 11 | ascFile.addDelimiter(input->tell(),'|'); |
1460 | 11 | ascFile.addPos(pos); |
1461 | 11 | ascFile.addNote(f.str().c_str()); |
1462 | 11 | input->seek(endPos,librevenge::RVNG_SEEK_SET); |
1463 | 11 | return true; |
1464 | 11 | } |
1465 | 58.2k | for (int i=0; i < numDefGrad; ++i) { |
1466 | 57.3k | auto val= int(input->readLong(2)); |
1467 | 57.3k | if (val!=i) f << "grad" << i << "=" << val << ","; |
1468 | 57.3k | } |
1469 | | |
1470 | 896 | ascFile.addPos(pos); |
1471 | 896 | ascFile.addNote(f.str().c_str()); |
1472 | 896 | m_state->m_numGradients=numDefGrad; |
1473 | 896 | m_state->initGradients(); |
1474 | 1.75k | for (int i=0; i < int(header.m_numData); ++i) { |
1475 | 894 | pos=input->tell(); |
1476 | 894 | f.str(""); |
1477 | 894 | f << "GradientList-" << numDefGrad+i << ":"; |
1478 | 894 | ClarisDrawStyleManagerInternal::Gradient grad; |
1479 | 3.57k | for (auto &j : grad.m_colors) { |
1480 | 3.57k | unsigned char color[3]; |
1481 | 10.7k | for (auto &col : color) col = static_cast<unsigned char>(input->readULong(2)/256); |
1482 | 3.57k | j= MWAWColor(color[0], color[1],color[2]); |
1483 | 3.57k | } |
1484 | 894 | grad.m_numColors=static_cast<int>(input->readLong(1)); |
1485 | 894 | grad.m_type=static_cast<int>(input->readLong(1)); |
1486 | 894 | grad.m_angle=static_cast<int>(input->readLong(2)); |
1487 | 894 | grad.m_decal=float(input->readLong(4))/65536.f; |
1488 | 894 | int dim[4]; |
1489 | 3.57k | for (auto &d : dim) d=static_cast<int>(input->readLong(2)); |
1490 | 894 | grad.m_box=MWAWBox2i(MWAWVec2i(dim[0],dim[1]),MWAWVec2i(dim[2],dim[3])); |
1491 | 894 | f << grad; |
1492 | 894 | if (!grad.ok()) { |
1493 | 32 | f << "##"; |
1494 | 32 | MWAW_DEBUG_MSG(("ClarisDrawStyleManager::readGradientList: can read the number of color or type\n")); |
1495 | 32 | ascFile.addPos(pos); |
1496 | 32 | ascFile.addNote(f.str().c_str()); |
1497 | 32 | input->seek(endPos,librevenge::RVNG_SEEK_SET); |
1498 | 32 | return true; |
1499 | 32 | } |
1500 | 862 | m_state->m_gradientList.push_back(grad); |
1501 | 862 | ascFile.addPos(pos); |
1502 | 862 | ascFile.addNote(f.str().c_str()); |
1503 | 862 | input->seek(pos+40, librevenge::RVNG_SEEK_SET); |
1504 | 862 | } |
1505 | 864 | input->seek(endPos,librevenge::RVNG_SEEK_SET); |
1506 | 864 | return true; |
1507 | 896 | } |
1508 | | |
1509 | | |
1510 | | |
1511 | | // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: |