37 #ifndef MWAW_PICT_BITMAP
38 # define MWAW_PICT_BITMAP
63 std::uninitialized_fill_n(
m_data, m_size[0] * m_size[1], T());
81 if (diff)
return diff;
83 if (!orig.
m_data)
return -1;
107 T
const &
get(
int i,
int j)
const
122 void set(
int i,
int j, T
const &v)
125 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainer::set: call with bad coordinate %d %d\n", i, j));
136 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainer::setRow: call with bad coordinate %d\n", j));
147 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainer::setColumn: call with bad coordinate %d\n", i));
150 for (
int j = 0, ind=i; j <
m_size[1]; j++, ind+=m_size[0])
m_data[ind] = T(val[i]);
174 if (diff)
return diff;
176 if (!orig.
m_data)
return -1;
179 return m_data[i] ? 1 : -1;
188 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainerBool::setRowPacked: call with bad coordinate %d\n", j));
192 unsigned char v = *(val++);
193 unsigned char mask = 0x80;
194 for (
int p = 0; p < 8 && i < m_size[0]; i++, p++, ind++) {
195 m_data[ind] = ((v&mask) != 0);
196 mask = (
unsigned char)(mask >> 1);
217 virtual bool getBinary(librevenge::RVNGBinaryData &res, std::string &s)
const
219 if (!
valid())
return false;
237 if (diff)
return diff;
242 if (diff)
return (diff < 0) ? -1 : 1;
249 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const = 0;
273 if (diff)
return diff;
304 bool get(
int i,
int j)
const
314 void set(
int i,
int j,
bool v)
336 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
357 if (diff)
return diff;
361 if (diff)
return (diff < 0) ? -1 : 1;
362 for (
size_t c=0; c <
m_colors.size(); c++) {
396 int get(
int i,
int j)
const
407 void set(
int i,
int j,
int v)
412 template <
class U>
void setRow(
int j, U
const *val)
435 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
464 if (diff)
return diff;
523 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
void setColumn(int i, bool const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:329
MWAWPictBitmapColor(MWAWVec2i const &sz, bool useAlphaChannel=false)
the constructor
Definition: MWAWPictBitmap.hxx:477
Definition: MWAWPictBitmap.hxx:207
int numColumns() const
gets the number of column
Definition: MWAWPictBitmap.hxx:101
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:381
void set(int i, int j, MWAWColor const &v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:506
T * m_data
the m_data placed by row ie. d_00, d_10, ... , d_{X-1}0, ..
Definition: MWAWPictBitmap.hxx:160
virtual int cmp(MWAWPict const &a) const
a virtual function used to obtain a strict order, must be redefined in the subs class ...
Definition: MWAWPictBitmap.hxx:234
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:471
virtual int cmp(MWAWPict const &a) const
a virtual function used to obtain a strict order, must be redefined in the subs class ...
Definition: MWAWPictBitmap.hxx:461
Definition: MWAWPictBitmap.hxx:207
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:280
MWAWVec2i m_size
the size
Definition: MWAWPictBitmap.hxx:158
MWAWVec2i const & size() const
return the array size
Definition: MWAWPictBitmap.hxx:91
void setColumn(int i, U const *val)
sets a column of m_data
Definition: MWAWPictBitmap.hxx:144
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:485
void setRow(int j, U const *val)
sets a line of m_data
Definition: MWAWPictBitmap.hxx:133
void set(int i, int j, T const &v)
sets a cell m_data
Definition: MWAWPictBitmap.hxx:122
void setColumn(int i, U const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:417
void setRow(int j, MWAWColor const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:511
virtual SubType getSubType() const =0
returns the picture subtype
Definition: MWAWPictBitmap.hxx:207
the class to store a color
Definition: libmwaw_internal.hxx:177
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:102
T const & get(int i, int j) const
accessor of a cell m_data
Definition: MWAWPictBitmap.hxx:107
a bitmap of MWAWColor to store true color bitmap
Definition: MWAWPictBitmap.hxx:450
int const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:401
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:299
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:294
void setBdBox(MWAWBox2f const &box)
sets the bdbox of the picture
Definition: MWAWPict.hxx:85
a template class to store a 2D array of m_data
Definition: MWAWPictBitmap.hxx:55
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:372
void setRow(int j, bool const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:319
int numRows() const
gets the number of row
Definition: MWAWPictBitmap.hxx:96
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:127
std::vector< MWAWColor > const & getColors() const
returns the array of indexed colors
Definition: MWAWPictBitmap.hxx:423
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:665
a bitmap of bool to store black-white bitmap
Definition: MWAWPictBitmap.hxx:259
bool const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:309
void set(int i, int j, int v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:407
Definition: libmwaw_internal.hxx:145
MWAWPictBitmapIndexed(MWAWVec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:378
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:721
SubType
the picture subtype: blackwhite, indexed, color
Definition: MWAWPictBitmap.hxx:207
a bool container with a function to put packed row
Definition: MWAWPictBitmap.hxx:164
void set(int i, int j, bool v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:314
bool m_hasAlpha
true if the bitmap has alpha color
Definition: MWAWPictBitmap.hxx:529
a bitmap of int to store indexed bitmap
Definition: MWAWPictBitmap.hxx:343
MWAWPictBitmap(MWAWVec2i const &sz)
protected constructor: use check to construct a picture
Definition: MWAWPictBitmap.hxx:252
void setColors(std::vector< MWAWColor > const &cols)
sets the array of indexed colors
Definition: MWAWPictBitmap.hxx:428
MWAWPictBitmapContainer(MWAWVec2i const &sz)
constructor given size
Definition: MWAWPictBitmap.hxx:59
MWAWPictBitmapContainer< int > m_data
the m_data
Definition: MWAWPictBitmap.hxx:438
virtual bool createFileData(librevenge::RVNGBinaryData &result) const
function which creates the result file
Definition: MWAWPictBitmap.cxx:227
Type
the different picture types:
Definition: MWAWPict.hxx:64
int cmp(MWAWPictBitmapContainerBool const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:171
virtual bool getBinary(librevenge::RVNGBinaryData &res, std::string &s) const
returns the final librevenge::RVNGBinary data
Definition: MWAWPictBitmap.hxx:217
MWAWPictBitmapContainer & operator=(MWAWPictBitmapContainer const &orig)
void setRowPacked(int j, unsigned char const *val)
allows to use packed m_data
Definition: MWAWPictBitmap.hxx:185
MWAWColor const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:500
void setRow(int j, U const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:412
virtual bool createFileData(librevenge::RVNGBinaryData &result) const =0
abstract function which creates the result file
virtual ~MWAWPictBitmapContainer()
destructor
Definition: MWAWPictBitmap.hxx:66
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1082
virtual bool createFileData(librevenge::RVNGBinaryData &result) const
the function which creates the result file
Definition: MWAWPictBitmap.cxx:246
Generic class used to construct bitmap.
Definition: MWAWPictBitmap.hxx:203
MWAWPictBitmapBW(MWAWVec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:286
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:490
int cmp(MWAWPictBitmapContainer< T > const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:78
bool ok() const
returns ok, if the m_data is allocated
Definition: MWAWPictBitmap.hxx:72
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:386
T const * getRow(int j) const
accessor of a row m_data
Definition: MWAWPictBitmap.hxx:114
void setColumn(int i, MWAWColor const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:516
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:227
virtual int cmp(MWAWPict const &a) const
a virtual function used to obtain a strict order, must be redefined in the subs class ...
Definition: MWAWPictBitmap.hxx:270
virtual SubType getSubType() const
returns the picture subtype
Definition: MWAWPictBitmap.hxx:263
Definition: MWAWPict.hxx:64
virtual bool createFileData(librevenge::RVNGBinaryData &result) const
the function which creates the result file
Definition: MWAWPictBitmap.cxx:236
std::vector< MWAWColor > m_colors
the colors
Definition: MWAWPictBitmap.hxx:440
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:289
virtual SubType getSubType() const
return the picture subtype
Definition: MWAWPictBitmap.hxx:347
MWAWPictBitmapContainerBool(MWAWVec2i const &sz)
constructor
Definition: MWAWPictBitmap.hxx:168
virtual Type getType() const
returns the picture type
Definition: MWAWPictBitmap.hxx:209
virtual SubType getSubType() const
return the picture subtype
Definition: MWAWPictBitmap.hxx:454
void setRowPacked(int j, unsigned char const *val)
sets all cell contents of a row given packed m_data
Definition: MWAWPictBitmap.hxx:324
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:391
MWAWPictBitmapContainer< MWAWColor > m_data
the data
Definition: MWAWPictBitmap.hxx:526
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:480
Generic function used to define/store a picture.
Definition: MWAWPict.hxx:52
MWAWPictBitmapContainerBool m_data
the data
Definition: MWAWPictBitmap.hxx:339
virtual int cmp(MWAWPict const &a) const
a virtual function used to obtain a strict order, must be redefined in the subs class ...
Definition: MWAWPictBitmap.hxx:354