MWAWPictBitmap.hxx Source File documentation

MWAWPictBitmap.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
34 /* This header contains code specific to some bitmap
35 */
36
37 #ifndef MWAW_PICT_BITMAP
38 # define MWAW_PICT_BITMAP
39
40
41 #include <vector>
42
43 #include "libmwaw_internal.hxx"
44 #include "MWAWDebug.hxx"
45 #include "MWAWPict.hxx"
46
48 //
49 // Some container
50 //
52
54 template <class T> class MWAWPictBitmapContainer
55 {
56 public:
58 explicit MWAWPictBitmapContainer(MWAWVec2i const &sz)
59 : m_size(sz)
60 , m_data(nullptr)
61 {
62 if (m_size[0]*m_size[1] == 0) return;
63 m_data = new T[size_t(m_size[0]*m_size[1])];
64 std::uninitialized_fill_n(m_data, m_size[0] * m_size[1], T());
65 }
67 virtual ~MWAWPictBitmapContainer()
68 {
69 if (m_data) delete [] m_data;
70 }
71
73 bool ok() const
74 {
75 return (m_data != nullptr);
76 }
77
79 int cmp(MWAWPictBitmapContainer<T> const &orig) const
80 {
81 int diff = m_size.cmpY(orig.m_size);
82 if (diff) return diff;
83 if (!m_data) return orig.m_data ? 1 : 0;
84 if (!orig.m_data) return -1;
85 for (int i=0; i < m_size[0]*m_size[1]; i++) {
86 if (m_data[i] < orig.m_data[i]) return -1;
87 if (m_data[i] > orig.m_data[i]) return 1;
88 }
89 return 0;
90 }
92 MWAWVec2i const &size() const
93 {
94 return m_size;
95 }
97 int numRows() const
98 {
99 return m_size[0];
100 }
102 int numColumns() const
103 {
104 return m_size[1];
105 }
106
108 T const &get(int i, int j) const
109 {
110 if (m_data == nullptr || i<0 || i >= m_size[0] || j<0 || j >= m_size[1])
111 throw libmwaw::GenericException();
112 return m_data[i+m_size[0]*j];
113 }
115 T const *getRow(int j) const
116 {
117 if (m_data == nullptr || j<0 || j >= m_size[1])
118 throw libmwaw::GenericException();
119 return m_data+m_size[0]*j;
120 }
121
123 void set(int i, int j, T const &v)
124 {
125 if (m_data == nullptr || i<0 || i >= m_size[0] || j<0 || j >= m_size[1]) {
126 MWAW_DEBUG_MSG(("MWAWPictBitmapContainer::set: call with bad coordinate %d %d\n", i, j));
127 return;
128 }
129 m_data[i+j*m_size[0]] = v;
130 }
131
133 template <class U>
134 void setRow(int j, U const *val)
135 {
136 if (m_data == nullptr || j<0 || j >= m_size[1]) {
137 MWAW_DEBUG_MSG(("MWAWPictBitmapContainer::setRow: call with bad coordinate %d\n", j));
138 return;
139 }
140 for (int i = 0, ind=j*m_size[0]; i < m_size[0]; i++, ind++) m_data[ind] = T(val[i]);
141 }
142
144 template <class U>
145 void setColumn(int i, U const *val)
146 {
147 if (m_data == nullptr || i<0 || i >= m_size[0]) {
148 MWAW_DEBUG_MSG(("MWAWPictBitmapContainer::setColumn: call with bad coordinate %d\n", i));
149 return;
150 }
151 for (int j = 0, ind=i; j < m_size[1]; j++, ind+=m_size[0]) m_data[ind] = T(val[i]);
152 }
153
154 private:
155 MWAWPictBitmapContainer(MWAWPictBitmapContainer const &orig) = delete;
156 MWAWPictBitmapContainer &operator=(MWAWPictBitmapContainer const &orig) = delete;
157 protected:
159 MWAWVec2i m_size;
161 T *m_data;
162 };
163
165 class MWAWPictBitmapContainerBool final : public MWAWPictBitmapContainer<bool>
166 {
167 public:
169 explicit MWAWPictBitmapContainerBool(MWAWVec2i const &sz)
170 : MWAWPictBitmapContainer<bool>(sz)
171 {
172 }
174 ~MWAWPictBitmapContainerBool() final;
176 int cmp(MWAWPictBitmapContainerBool const &orig) const
177 {
178 int diff = m_size.cmpY(orig.m_size);
179 if (diff) return diff;
180 if (!m_data) return orig.m_data ? 1 : 0;
181 if (!orig.m_data) return -1;
182 for (int i=0; i < m_size[0]*m_size[1]; i++) {
183 if (m_data[i] == orig.m_data[i]) continue;
184 return m_data[i] ? 1 : -1;
185 }
186 return 0;
187 }
188
190 void setRowPacked(int j, unsigned char const *val, unsigned char const *end)
191 {
192 if (m_data == nullptr || j<0 || j >= m_size[1] || val >= end) {
193 MWAW_DEBUG_MSG(("MWAWPictBitmapContainerBool::setRowPacked: call with bad coordinate %d\n", j));
194 return;
195 }
196 for (int i = 0, ind = j*m_size[0]; i < m_size[0];) {
197 unsigned char v = (val < end) ? *(val++) : 0;
198 unsigned char mask = 0x80;
199 for (int p = 0; p < 8 && i < m_size[0]; i++, p++, ind++) {
200 m_data[ind] = ((v&mask) != 0);
201 mask = static_cast<unsigned char>(mask >> 1);
202 }
203 }
204 }
205 };
206
208 class MWAWPictBitmap : public MWAWPict
209 {
210 public:
212 ~MWAWPictBitmap() override;
213
215 enum SubType { BW, Indexed, Color };
217 Type getType() const override
218 {
219 return MWAWPict::Bitmap;
220 }
222 virtual SubType getSubType() const = 0;
223
225 bool getBinary(MWAWEmbeddedObject &picture) const override
226 {
227 if (!valid()) return false;
228
229 librevenge::RVNGBinaryData data;
230 createFileData(data);
231 picture=MWAWEmbeddedObject(data, "image/pict");
232 return true;
233 }
234
236 virtual bool valid() const
237 {
238 return false;
239 }
240
243 int cmp(MWAWPict const &a) const override
244 {
245 int diff = MWAWPict::cmp(a);
246 if (diff) return diff;
247 auto const &aPict = static_cast<MWAWPictBitmap const &>(a);
248
249 // the type
250 diff = getSubType() - aPict.getSubType();
251 if (diff) return (diff < 0) ? -1 : 1;
252
253 return 0;
254 }
255
256 protected:
258 virtual bool createFileData(librevenge::RVNGBinaryData &result) const = 0;
259
261 explicit MWAWPictBitmap(MWAWVec2i const &sz)
262 {
263 setBdBox(MWAWBox2f(MWAWVec2f(0,0), MWAWVec2f(sz)));
264 }
265 };
266
268 class MWAWPictBitmapBW final : public MWAWPictBitmap
269 {
270 public:
272 SubType getSubType() const final
273 {
274 return BW;
275 }
276
279 int cmp(MWAWPict const &a) const final
280 {
281 int diff = MWAWPictBitmap::cmp(a);
282 if (diff) return diff;
283 auto const &aPict = static_cast<MWAWPictBitmapBW const &>(a);
284
285 return m_data.cmp(aPict.m_data);
286 }
287
289 bool valid() const final
290 {
291 return m_data.ok();
292 }
293
295 explicit MWAWPictBitmapBW(MWAWVec2i const &sz)
296 : MWAWPictBitmap(sz)
297 , m_data(sz)
298 {
299 }
300
302 MWAWVec2i const &size() const
303 {
304 return m_data.size();
305 }
307 int numRows() const
308 {
309 return m_data.numRows();
310 }
312 int numColumns() const
313 {
314 return m_data.numColumns();
315 }
317 bool get(int i, int j) const
318 {
319 return m_data.get(i,j);
320 }
322 bool const *getRow(int j) const
323 {
324 return m_data.getRow(j);
325 }
327 void set(int i, int j, bool v)
328 {
329 m_data.set(i,j, v);
330 }
332 void setRow(int j, bool const *val)
333 {
334 m_data.setRow(j, val);
335 }
337 void setRowPacked(int j, unsigned char const *val, unsigned char const *end)
338 {
339 m_data.setRowPacked(j, val, end);
340 }
342 void setColumn(int i, bool const *val)
343 {
344 m_data.setColumn(i, val);
345 }
346
347 protected:
349 bool createFileData(librevenge::RVNGBinaryData &result) const final;
350
352 MWAWPictBitmapContainerBool m_data;
353 };
354
356 class MWAWPictBitmapIndexed final : public MWAWPictBitmap
357 {
358 public:
360 SubType getSubType() const final
361 {
362 return Indexed;
363 }
364
367 int cmp(MWAWPict const &a) const final
368 {
369 int diff = MWAWPictBitmap::cmp(a);
370 if (diff) return diff;
371 auto const &aPict = static_cast<MWAWPictBitmapIndexed const &>(a);
372
373 diff=int(m_colors.size())-int(aPict.m_colors.size());
374 if (diff) return (diff < 0) ? -1 : 1;
375 for (size_t c=0; c < m_colors.size(); c++) {
376 if (m_colors[c] < aPict.m_colors[c])
377 return 1;
378 if (m_colors[c] > aPict.m_colors[c])
379 return -1;
380 }
381 return m_data.cmp(aPict.m_data);
382 }
383
385 bool valid() const final
386 {
387 return m_data.ok();
388 }
389
391 explicit MWAWPictBitmapIndexed(MWAWVec2i const &sz)
392 : MWAWPictBitmap(sz)
393 , m_data(sz)
394 , m_colors()
395 {
396 }
397
399 MWAWVec2i const &size() const
400 {
401 return m_data.size();
402 }
404 int numRows() const
405 {
406 return m_data.numRows();
407 }
409 int numColumns() const
410 {
411 return m_data.numColumns();
412 }
414 int get(int i, int j) const
415 {
416 return m_data.get(i,j);
417 }
419 int const *getRow(int j) const
420 {
421 return m_data.getRow(j);
422 }
423
425 void set(int i, int j, int v)
426 {
427 m_data.set(i,j, v);
428 }
430 template <class U> void setRow(int j, U const *val)
431 {
432 m_data.setRow(j, val);
433 }
435 template <class U> void setColumn(int i, U const *val)
436 {
437 m_data.setColumn(i, val);
438 }
439
441 std::vector<MWAWColor> const &getColors() const
442 {
443 return m_colors;
444 }
446 void setColors(std::vector<MWAWColor> const &cols)
447 {
448 m_colors = cols;
449 }
450
451 protected:
453 bool createFileData(librevenge::RVNGBinaryData &result) const final;
454
456 MWAWPictBitmapContainer<int> m_data;
458 std::vector<MWAWColor> m_colors;
459 };
460
468 class MWAWPictBitmapColor final : public MWAWPictBitmap
469 {
470 public:
472 SubType getSubType() const final
473 {
474 return Color;
475 }
476
479 int cmp(MWAWPict const &a) const final
480 {
481 int diff = MWAWPictBitmap::cmp(a);
482 if (diff) return diff;
483 auto const &aPict = static_cast<MWAWPictBitmapColor const &>(a);
484
485 return m_data.cmp(aPict.m_data);
486 }
487
489 bool valid() const final
490 {
491 return m_data.ok();
492 }
493
495 MWAWPictBitmapColor(MWAWVec2i const &sz, bool useAlphaChannel=false)
496 : MWAWPictBitmap(sz)
497 , m_data(sz)
498 , m_hasAlpha(useAlphaChannel)
499 {
500 }
501
503 MWAWVec2i const &size() const
504 {
505 return m_data.size();
506 }
508 int numRows() const
509 {
510 return m_data.numRows();
511 }
513 int numColumns() const
514 {
515 return m_data.numColumns();
516 }
518 MWAWColor get(int i, int j) const
519 {
520 return m_data.get(i,j);
521 }
523 MWAWColor const *getRow(int j) const
524 {
525 return m_data.getRow(j);
526 }
527
529 void set(int i, int j, MWAWColor const &v)
530 {
531 m_data.set(i,j, v);
532 }
534 void setRow(int j, MWAWColor const *val)
535 {
536 m_data.setRow(j, val);
537 }
539 void setColumn(int i, MWAWColor const *val)
540 {
541 m_data.setColumn(i, val);
542 }
543
544 protected:
546 bool createFileData(librevenge::RVNGBinaryData &result) const final;
547
549 MWAWPictBitmapContainer<MWAWColor> m_data;
550
552 bool m_hasAlpha;
553 };
554 #endif
555 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWPictBitmapContainer::numColumns
int numColumns() const
gets the number of column
Definition: MWAWPictBitmap.hxx:102
MWAWPictBitmapIndexed::numRows
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:404
MWAWPict.hxx
MWAWPictBitmap::valid
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:236
MWAWPictBitmapContainerBool::MWAWPictBitmapContainerBool
MWAWPictBitmapContainerBool(MWAWVec2i const &sz)
constructor
Definition: MWAWPictBitmap.hxx:169
MWAWPictBitmapContainerBool::setRowPacked
void setRowPacked(int j, unsigned char const *val, unsigned char const *end)
allows to use packed m_data
Definition: MWAWPictBitmap.hxx:190
MWAWPictBitmapBW::numColumns
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:312
MWAWPictBitmapColor::getSubType
SubType getSubType() const final
return the picture subtype
Definition: MWAWPictBitmap.hxx:472
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
MWAWPictBitmapContainer::set
void set(int i, int j, T const &v)
sets a cell m_data
Definition: MWAWPictBitmap.hxx:123
MWAWPictBitmapBW::getSubType
SubType getSubType() const final
returns the picture subtype
Definition: MWAWPictBitmap.hxx:272
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:842
MWAWPictBitmapIndexed::getColors
std::vector< MWAWColor > const & getColors() const
returns the array of indexed colors
Definition: MWAWPictBitmap.hxx:441
MWAWPictBitmapIndexed::setColors
void setColors(std::vector< MWAWColor > const &cols)
sets the array of indexed colors
Definition: MWAWPictBitmap.hxx:446
MWAWPictBitmapContainer::MWAWPictBitmapContainer
MWAWPictBitmapContainer(MWAWPictBitmapContainer const &orig)=delete
MWAWPictBitmapContainer::operator=
MWAWPictBitmapContainer & operator=(MWAWPictBitmapContainer const &orig)=delete
MWAWPictBitmapColor::size
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:503
MWAWPictBitmapIndexed::set
void set(int i, int j, int v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:425
MWAWPictBitmap::BW
@ BW
Definition: MWAWPictBitmap.hxx:215
MWAWPictBitmapBW::get
bool get(int i, int j) const
returns a cell content
Definition: MWAWPictBitmap.hxx:317
MWAWVec2::cmpY
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:786
MWAWPictBitmapIndexed::numColumns
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:409
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
MWAWPictBitmap::Indexed
@ Indexed
Definition: MWAWPictBitmap.hxx:215
MWAWPict::Type
Type
the different picture types:
Definition: MWAWPict.hxx:63
MWAWPictBitmapColor::m_hasAlpha
bool m_hasAlpha
true if the bitmap has alpha color
Definition: MWAWPictBitmap.hxx:552
MWAWPictBitmapColor::MWAWPictBitmapColor
MWAWPictBitmapColor(MWAWVec2i const &sz, bool useAlphaChannel=false)
the constructor
Definition: MWAWPictBitmap.hxx:495
MWAWPictBitmap::getBinary
bool getBinary(MWAWEmbeddedObject &picture) const override
returns the final picture
Definition: MWAWPictBitmap.hxx:225
MWAWPictBitmapColor::numColumns
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:513
MWAWPictBitmap
Generic class used to construct bitmap.
Definition: MWAWPictBitmap.hxx:209
MWAWPictBitmapColor::set
void set(int i, int j, MWAWColor const &v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:529
MWAWPictBitmapContainer::getRow
T const * getRow(int j) const
accessor of a row m_data
Definition: MWAWPictBitmap.hxx:115
MWAWPictBitmapContainer< MWAWColor >
MWAWPictBitmapColor::valid
bool valid() const final
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:489
MWAWPictBitmapBW::size
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:302
MWAWPictBitmapColor::setRow
void setRow(int j, MWAWColor const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:534
MWAWPictBitmapBW::createFileData
bool createFileData(librevenge::RVNGBinaryData &result) const final
function which creates the result file
Definition: MWAWPictBitmap.cxx:503
MWAWPictBitmapIndexed::getRow
int const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:419
MWAWPictBitmapContainerBool
a bool container with a function to put packed row
Definition: MWAWPictBitmap.hxx:166
MWAWPictBitmapIndexed::m_colors
std::vector< MWAWColor > m_colors
the colors
Definition: MWAWPictBitmap.hxx:458
MWAWPictBitmapBW::MWAWPictBitmapBW
MWAWPictBitmapBW(MWAWVec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:295
MWAWPictBitmapContainer::ok
bool ok() const
returns ok, if the m_data is allocated
Definition: MWAWPictBitmap.hxx:73
MWAWPictBitmap::MWAWPictBitmap
MWAWPictBitmap(MWAWVec2i const &sz)
protected constructor: use check to construct a picture
Definition: MWAWPictBitmap.hxx:261
MWAWPictBitmapContainer::m_size
MWAWVec2i m_size
the size
Definition: MWAWPictBitmap.hxx:159
MWAWPictBitmapBW
a bitmap of bool to store black-white bitmap
Definition: MWAWPictBitmap.hxx:269
MWAWPictBitmap::Color
@ Color
Definition: MWAWPictBitmap.hxx:215
libmwaw_internal.hxx
MWAWPictBitmapContainer::setRow
void setRow(int j, U const *val)
sets a line of m_data
Definition: MWAWPictBitmap.hxx:134
MWAWPictBitmapBW::setColumn
void setColumn(int i, bool const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:342
MWAWPictBitmapIndexed::createFileData
bool createFileData(librevenge::RVNGBinaryData &result) const final
the function which creates the result file
Definition: MWAWPictBitmap.cxx:530
MWAWPictBitmapColor::createFileData
bool createFileData(librevenge::RVNGBinaryData &result) const final
the function which creates the result file
Definition: MWAWPictBitmap.cxx:516
MWAWPictBitmapBW::setRowPacked
void setRowPacked(int j, unsigned char const *val, unsigned char const *end)
sets all cell contents of a row given packed m_data
Definition: MWAWPictBitmap.hxx:337
MWAWPictBitmap::~MWAWPictBitmap
~MWAWPictBitmap() override
destructor
Definition: MWAWPictBitmap.cxx:496
MWAWPictBitmapContainerBool::~MWAWPictBitmapContainerBool
~MWAWPictBitmapContainerBool() final
destructor
Definition: MWAWPictBitmap.cxx:492
MWAWPictBitmapIndexed::size
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:399
MWAWPictBitmapIndexed::MWAWPictBitmapIndexed
MWAWPictBitmapIndexed(MWAWVec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:391
MWAWPict
Generic function used to define/store a picture.
Definition: MWAWPict.hxx:52
MWAWPictBitmapColor::getRow
MWAWColor const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:523
MWAWVec2< int >
MWAWPictBitmapIndexed::setRow
void setRow(int j, U const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:430
MWAWDebug.hxx
MWAWPictBitmapContainer::~MWAWPictBitmapContainer
virtual ~MWAWPictBitmapContainer()
destructor
Definition: MWAWPictBitmap.hxx:67
MWAWPictBitmapBW::m_data
MWAWPictBitmapContainerBool m_data
the data
Definition: MWAWPictBitmap.hxx:352
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1193
MWAWPictBitmapContainer::numRows
int numRows() const
gets the number of row
Definition: MWAWPictBitmap.hxx:97
MWAWPictBitmap::getType
Type getType() const override
returns the picture type
Definition: MWAWPictBitmap.hxx:217
MWAWPictBitmapContainerBool::cmp
int cmp(MWAWPictBitmapContainerBool const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:176
MWAWPictBitmapContainer::cmp
int cmp(MWAWPictBitmapContainer< T > const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:79
MWAWPictBitmapBW::valid
bool valid() const final
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:289
MWAWPictBitmapContainer::size
MWAWVec2i const & size() const
return the array size
Definition: MWAWPictBitmap.hxx:92
MWAWPictBitmap::cmp
int cmp(MWAWPict const &a) const override
a virtual function used to obtain a strict order, must be redefined in the subs class
Definition: MWAWPictBitmap.hxx:243
MWAWPict::Bitmap
@ Bitmap
Definition: MWAWPict.hxx:63
MWAWPict::setBdBox
void setBdBox(MWAWBox2f const &box)
sets the bdbox of the picture
Definition: MWAWPict.hxx:84
MWAWPictBitmapIndexed::valid
bool valid() const final
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:385
MWAWPictBitmapIndexed
a bitmap of int to store indexed bitmap
Definition: MWAWPictBitmap.hxx:357
MWAWPictBitmapIndexed::setColumn
void setColumn(int i, U const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:435
MWAWPictBitmap::getSubType
virtual SubType getSubType() const =0
returns the picture subtype
MWAWPictBitmapContainer::MWAWPictBitmapContainer
MWAWPictBitmapContainer(MWAWVec2i const &sz)
constructor given size
Definition: MWAWPictBitmap.hxx:58
MWAWPictBitmapColor::setColumn
void setColumn(int i, MWAWColor const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:539
MWAWPictBitmapColor::numRows
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:508
MWAW_N_ELEMENTS
#define MWAW_N_ELEMENTS(m)
Definition: libmwaw_internal.hxx:111
MWAWPictBitmapBW::numRows
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:307
MWAWPictBitmapInternal::writeU16
static void writeU16(unsigned char *buffer, unsigned &position, const unsigned value)
Definition: MWAWPictBitmap.cxx:405
MWAWPictBitmapBW::setRow
void setRow(int j, bool const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:332
MWAWPictBitmap::SubType
SubType
the picture subtype: blackwhite, indexed, color
Definition: MWAWPictBitmap.hxx:215
MWAWPictBitmapColor::m_data
MWAWPictBitmapContainer< MWAWColor > m_data
the data
Definition: MWAWPictBitmap.hxx:549
MWAWPictBitmapIndexed::get
int get(int i, int j) const
returns a cell content
Definition: MWAWPictBitmap.hxx:414
MWAWPictBitmap::createFileData
virtual bool createFileData(librevenge::RVNGBinaryData &result) const =0
abstract function which creates the result file
MWAWPictBitmap.hxx
MWAWPict::cmp
virtual int cmp(MWAWPict const &a) const
a virtual function used to obtain a strict order, must be redefined in the subs class
Definition: MWAWPict.hxx:101
MWAWPictBitmapIndexed::cmp
int cmp(MWAWPict const &a) const final
a virtual function used to obtain a strict order, must be redefined in the subs class
Definition: MWAWPictBitmap.hxx:367
MWAWPictBitmapContainer::m_data
T * m_data
the m_data placed by row ie. d_00, d_10, ... , d_{X-1}0, ..
Definition: MWAWPictBitmap.hxx:161
MWAWPictBitmapInternal::getPBMData
bool getPBMData(MWAWPictBitmapContainer< T > const &orig, librevenge::RVNGBinaryData &data, T white)
Internal: helper function to create a PBM.
Definition: MWAWPictBitmap.cxx:314
MWAWPictBitmapBW::getRow
bool const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:322
MWAWPictBitmapColor
a bitmap of MWAWColor to store true color bitmap
Definition: MWAWPictBitmap.hxx:469
MWAWPictBitmapInternal::writeU32
static void writeU32(unsigned char *buffer, unsigned &position, const unsigned value)
Definition: MWAWPictBitmap.cxx:411
MWAWPictBitmapBW::set
void set(int i, int j, bool v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:327
MWAWPictBitmapInternal::getBMPData
static bool getBMPData(MWAWPictBitmapContainer< MWAWColor > const &orig, librevenge::RVNGBinaryData &data)
Internal: helper function to create a BMP for a color bitmap (freely inspired from libpwg::WPGBitmap....
Definition: MWAWPictBitmap.cxx:420
MWAWPictBitmapIndexed::getSubType
SubType getSubType() const final
return the picture subtype
Definition: MWAWPictBitmap.hxx:360
libmwaw::GenericException
Definition: libmwaw_internal.hxx:148
MWAWPictBitmapContainer::setColumn
void setColumn(int i, U const *val)
sets a column of m_data
Definition: MWAWPictBitmap.hxx:145
MWAWPictBitmapColor::get
MWAWColor get(int i, int j) const
returns a cell content
Definition: MWAWPictBitmap.hxx:518
MWAWPictBitmapInternal
Internal: namespace used to define some internal function.
Definition: MWAWPictBitmap.cxx:51
MWAWPictBitmapInternal::getPPMData
bool getPPMData(MWAWPictBitmapContainer< T > const &orig, librevenge::RVNGBinaryData &data, std::vector< MWAWColor > const &indexedColor)
Internal: helper function to create a PPM.
Definition: MWAWPictBitmap.cxx:344
MWAWColor::value
uint32_t value() const
return the rgba value
Definition: libmwaw_internal.hxx:259
MWAWPictBitmapIndexed::m_data
MWAWPictBitmapContainer< int > m_data
the m_data
Definition: MWAWPictBitmap.hxx:456
MWAWPictBitmapContainer::get
T const & get(int i, int j) const
accessor of a cell m_data
Definition: MWAWPictBitmap.hxx:108
MWAWPictBitmapColor::cmp
int cmp(MWAWPict const &a) const final
a virtual function used to obtain a strict order, must be redefined in the subs class
Definition: MWAWPictBitmap.hxx:479
MWAWPictBitmapBW::cmp
int cmp(MWAWPict const &a) const final
a virtual function used to obtain a strict order, must be redefined in the subs class
Definition: MWAWPictBitmap.hxx:279