Go to the documentation of this file.
37 #ifndef MWAW_PICT_BITMAP
38 # define MWAW_PICT_BITMAP
75 return (
m_data !=
nullptr);
82 if (diff)
return diff;
84 if (!orig.
m_data)
return -1;
108 T
const &
get(
int i,
int j)
const
123 void set(
int i,
int j, T
const &v)
126 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainer::set: call with bad coordinate %d %d\n", i, j));
137 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainer::setRow: call with bad coordinate %d\n", j));
148 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainer::setColumn: call with bad coordinate %d\n", i));
179 if (diff)
return diff;
180 if (!
m_data)
return orig.m_data ? 1 : 0;
181 if (!orig.m_data)
return -1;
183 if (
m_data[i] == orig.m_data[i])
continue;
184 return m_data[i] ? 1 : -1;
190 void setRowPacked(
int j,
unsigned char const *val,
unsigned char const *end)
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));
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);
227 if (!
valid())
return false;
229 librevenge::RVNGBinaryData data;
246 if (diff)
return diff;
251 if (diff)
return (diff < 0) ? -1 : 1;
282 if (diff)
return diff;
317 bool get(
int i,
int j)
const
327 void set(
int i,
int j,
bool v)
337 void setRowPacked(
int j,
unsigned char const *val,
unsigned char const *end)
349 bool createFileData(librevenge::RVNGBinaryData &result)
const final;
370 if (diff)
return diff;
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])
378 if (
m_colors[c] > aPict.m_colors[c])
414 int get(
int i,
int j)
const
425 void set(
int i,
int j,
int v)
430 template <
class U>
void setRow(
int j, U
const *val)
453 bool createFileData(librevenge::RVNGBinaryData &result)
const final;
482 if (diff)
return diff;
546 bool createFileData(librevenge::RVNGBinaryData &result)
const final;
int numColumns() const
gets the number of column
Definition: MWAWPictBitmap.hxx:102
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:404
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:236
MWAWPictBitmapContainerBool(MWAWVec2i const &sz)
constructor
Definition: MWAWPictBitmap.hxx:169
void setRowPacked(int j, unsigned char const *val, unsigned char const *end)
allows to use packed m_data
Definition: MWAWPictBitmap.hxx:190
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:312
SubType getSubType() const final
return the picture subtype
Definition: MWAWPictBitmap.hxx:472
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
void set(int i, int j, T const &v)
sets a cell m_data
Definition: MWAWPictBitmap.hxx:123
SubType getSubType() const final
returns the picture subtype
Definition: MWAWPictBitmap.hxx:272
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:842
std::vector< MWAWColor > const & getColors() const
returns the array of indexed colors
Definition: MWAWPictBitmap.hxx:441
void setColors(std::vector< MWAWColor > const &cols)
sets the array of indexed colors
Definition: MWAWPictBitmap.hxx:446
MWAWPictBitmapContainer(MWAWPictBitmapContainer const &orig)=delete
MWAWPictBitmapContainer & operator=(MWAWPictBitmapContainer const &orig)=delete
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:503
void set(int i, int j, int v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:425
@ BW
Definition: MWAWPictBitmap.hxx:215
bool get(int i, int j) const
returns a cell content
Definition: MWAWPictBitmap.hxx:317
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:786
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:409
the class to store a color
Definition: libmwaw_internal.hxx:192
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
@ Indexed
Definition: MWAWPictBitmap.hxx:215
Type
the different picture types:
Definition: MWAWPict.hxx:63
bool m_hasAlpha
true if the bitmap has alpha color
Definition: MWAWPictBitmap.hxx:552
MWAWPictBitmapColor(MWAWVec2i const &sz, bool useAlphaChannel=false)
the constructor
Definition: MWAWPictBitmap.hxx:495
bool getBinary(MWAWEmbeddedObject &picture) const override
returns the final picture
Definition: MWAWPictBitmap.hxx:225
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:513
Generic class used to construct bitmap.
Definition: MWAWPictBitmap.hxx:209
void set(int i, int j, MWAWColor const &v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:529
T const * getRow(int j) const
accessor of a row m_data
Definition: MWAWPictBitmap.hxx:115
bool valid() const final
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:489
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:302
void setRow(int j, MWAWColor const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:534
bool createFileData(librevenge::RVNGBinaryData &result) const final
function which creates the result file
Definition: MWAWPictBitmap.cxx:503
int const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:419
a bool container with a function to put packed row
Definition: MWAWPictBitmap.hxx:166
std::vector< MWAWColor > m_colors
the colors
Definition: MWAWPictBitmap.hxx:458
MWAWPictBitmapBW(MWAWVec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:295
bool ok() const
returns ok, if the m_data is allocated
Definition: MWAWPictBitmap.hxx:73
MWAWPictBitmap(MWAWVec2i const &sz)
protected constructor: use check to construct a picture
Definition: MWAWPictBitmap.hxx:261
MWAWVec2i m_size
the size
Definition: MWAWPictBitmap.hxx:159
a bitmap of bool to store black-white bitmap
Definition: MWAWPictBitmap.hxx:269
@ Color
Definition: MWAWPictBitmap.hxx:215
void setRow(int j, U const *val)
sets a line of m_data
Definition: MWAWPictBitmap.hxx:134
void setColumn(int i, bool const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:342
bool createFileData(librevenge::RVNGBinaryData &result) const final
the function which creates the result file
Definition: MWAWPictBitmap.cxx:530
bool createFileData(librevenge::RVNGBinaryData &result) const final
the function which creates the result file
Definition: MWAWPictBitmap.cxx:516
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() override
destructor
Definition: MWAWPictBitmap.cxx:496
~MWAWPictBitmapContainerBool() final
destructor
Definition: MWAWPictBitmap.cxx:492
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:399
MWAWPictBitmapIndexed(MWAWVec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:391
Generic function used to define/store a picture.
Definition: MWAWPict.hxx:52
MWAWColor const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:523
void setRow(int j, U const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:430
virtual ~MWAWPictBitmapContainer()
destructor
Definition: MWAWPictBitmap.hxx:67
MWAWPictBitmapContainerBool m_data
the data
Definition: MWAWPictBitmap.hxx:352
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1193
int numRows() const
gets the number of row
Definition: MWAWPictBitmap.hxx:97
Type getType() const override
returns the picture type
Definition: MWAWPictBitmap.hxx:217
int cmp(MWAWPictBitmapContainerBool const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:176
int cmp(MWAWPictBitmapContainer< T > const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:79
bool valid() const final
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:289
MWAWVec2i const & size() const
return the array size
Definition: MWAWPictBitmap.hxx:92
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
@ Bitmap
Definition: MWAWPict.hxx:63
void setBdBox(MWAWBox2f const &box)
sets the bdbox of the picture
Definition: MWAWPict.hxx:84
bool valid() const final
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:385
a bitmap of int to store indexed bitmap
Definition: MWAWPictBitmap.hxx:357
void setColumn(int i, U const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:435
virtual SubType getSubType() const =0
returns the picture subtype
MWAWPictBitmapContainer(MWAWVec2i const &sz)
constructor given size
Definition: MWAWPictBitmap.hxx:58
void setColumn(int i, MWAWColor const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:539
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:508
#define MWAW_N_ELEMENTS(m)
Definition: libmwaw_internal.hxx:111
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:307
static void writeU16(unsigned char *buffer, unsigned &position, const unsigned value)
Definition: MWAWPictBitmap.cxx:405
void setRow(int j, bool const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:332
SubType
the picture subtype: blackwhite, indexed, color
Definition: MWAWPictBitmap.hxx:215
MWAWPictBitmapContainer< MWAWColor > m_data
the data
Definition: MWAWPictBitmap.hxx:549
int get(int i, int j) const
returns a cell content
Definition: MWAWPictBitmap.hxx:414
virtual bool createFileData(librevenge::RVNGBinaryData &result) const =0
abstract function which creates the result file
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
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
T * m_data
the m_data placed by row ie. d_00, d_10, ... , d_{X-1}0, ..
Definition: MWAWPictBitmap.hxx:161
bool getPBMData(MWAWPictBitmapContainer< T > const &orig, librevenge::RVNGBinaryData &data, T white)
Internal: helper function to create a PBM.
Definition: MWAWPictBitmap.cxx:314
bool const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:322
a bitmap of MWAWColor to store true color bitmap
Definition: MWAWPictBitmap.hxx:469
static void writeU32(unsigned char *buffer, unsigned &position, const unsigned value)
Definition: MWAWPictBitmap.cxx:411
void set(int i, int j, bool v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:327
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
SubType getSubType() const final
return the picture subtype
Definition: MWAWPictBitmap.hxx:360
Definition: libmwaw_internal.hxx:148
void setColumn(int i, U const *val)
sets a column of m_data
Definition: MWAWPictBitmap.hxx:145
MWAWColor get(int i, int j) const
returns a cell content
Definition: MWAWPictBitmap.hxx:518
Internal: namespace used to define some internal function.
Definition: MWAWPictBitmap.cxx:51
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
uint32_t value() const
return the rgba value
Definition: libmwaw_internal.hxx:259
MWAWPictBitmapContainer< int > m_data
the m_data
Definition: MWAWPictBitmap.hxx:456
T const & get(int i, int j) const
accessor of a cell m_data
Definition: MWAWPictBitmap.hxx:108
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
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
Generated on Fri Sep 18 2020 18:14:52 for libmwaw by
doxygen 1.8.20