37 #ifndef MWAW_PICT_BITMAP
38 # define MWAW_PICT_BITMAP
62 std::uninitialized_fill_n(
m_data, m_size[0] * m_size[1], T());
80 if (diff)
return diff;
82 if (!orig.
m_data)
return -1;
106 T
const &
get(
int i,
int j)
const
121 void set(
int i,
int j, T
const &v)
124 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainer::set: call with bad coordinate %d %d\n", i, j));
135 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainer::setRow: call with bad coordinate %d\n", j));
146 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainer::setColumn: call with bad coordinate %d\n", i));
149 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;
185 void setRowPacked(
int j,
unsigned char const *val,
unsigned char const *end)
187 if (
m_data == 0L || j<0 || j >=
m_size[1] || val >= end) {
188 MWAW_DEBUG_MSG((
"MWAWPictBitmapContainerBool::setRowPacked: call with bad coordinate %d\n", j));
192 unsigned char v = (val < end) ? *(val++) : 0;
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 =
static_cast<unsigned char>(mask >> 1);
222 if (!
valid())
return false;
224 librevenge::RVNGBinaryData data;
241 if (diff)
return diff;
246 if (diff)
return (diff < 0) ? -1 : 1;
253 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const = 0;
277 if (diff)
return diff;
308 bool get(
int i,
int j)
const
318 void set(
int i,
int j,
bool v)
328 void setRowPacked(
int j,
unsigned char const *val,
unsigned char const *end)
340 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
361 if (diff)
return diff;
365 if (diff)
return (diff < 0) ? -1 : 1;
366 for (
size_t c=0; c <
m_colors.size(); c++) {
400 int get(
int i,
int j)
const
411 void set(
int i,
int j,
int v)
416 template <
class U>
void setRow(
int j, U
const *val)
439 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
468 if (diff)
return diff;
527 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
void setColumn(int i, bool const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:333
MWAWPictBitmapColor(MWAWVec2i const &sz, bool useAlphaChannel=false)
the constructor
Definition: MWAWPictBitmap.hxx:481
Definition: MWAWPictBitmap.hxx:210
int numColumns() const
gets the number of column
Definition: MWAWPictBitmap.hxx:100
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:385
void set(int i, int j, MWAWColor const &v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:510
T * m_data
the m_data placed by row ie. d_00, d_10, ... , d_{X-1}0, ..
Definition: MWAWPictBitmap.hxx:159
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:238
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:475
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:465
Definition: MWAWPictBitmap.hxx:210
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:284
MWAWVec2i m_size
the size
Definition: MWAWPictBitmap.hxx:157
MWAWVec2i const & size() const
return the array size
Definition: MWAWPictBitmap.hxx:90
void setColumn(int i, U const *val)
sets a column of m_data
Definition: MWAWPictBitmap.hxx:143
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:489
void setRow(int j, U const *val)
sets a line of m_data
Definition: MWAWPictBitmap.hxx:132
void set(int i, int j, T const &v)
sets a cell m_data
Definition: MWAWPictBitmap.hxx:121
void setColumn(int i, U const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:421
void setRow(int j, MWAWColor const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:515
virtual SubType getSubType() const =0
returns the picture subtype
~MWAWPictBitmapContainerBool()
destructor
Definition: MWAWPictBitmap.cxx:230
Definition: MWAWPictBitmap.hxx:210
virtual ~MWAWPictBitmap()
destructor
Definition: MWAWPictBitmap.cxx:234
the class to store a color
Definition: libmwaw_internal.hxx:196
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
T const & get(int i, int j) const
accessor of a cell m_data
Definition: MWAWPictBitmap.hxx:106
a bitmap of MWAWColor to store true color bitmap
Definition: MWAWPictBitmap.hxx:454
int const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:405
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:303
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:298
void setBdBox(MWAWBox2f const &box)
sets the bdbox of the picture
Definition: MWAWPict.hxx:84
a template class to store a 2D array of m_data
Definition: MWAWPictBitmap.hxx:54
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:376
void setRow(int j, bool const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:323
int numRows() const
gets the number of row
Definition: MWAWPictBitmap.hxx:95
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:141
std::vector< MWAWColor > const & getColors() const
returns the array of indexed colors
Definition: MWAWPictBitmap.hxx:427
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:743
a bitmap of bool to store black-white bitmap
Definition: MWAWPictBitmap.hxx:263
bool const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:313
void set(int i, int j, int v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:411
Definition: libmwaw_internal.hxx:159
MWAWPictBitmapIndexed(MWAWVec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:382
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:799
SubType
the picture subtype: blackwhite, indexed, color
Definition: MWAWPictBitmap.hxx:210
a bool container with a function to put packed row
Definition: MWAWPictBitmap.hxx:163
void set(int i, int j, bool v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:318
bool m_hasAlpha
true if the bitmap has alpha color
Definition: MWAWPictBitmap.hxx:533
a bitmap of int to store indexed bitmap
Definition: MWAWPictBitmap.hxx:347
MWAWPictBitmap(MWAWVec2i const &sz)
protected constructor: use check to construct a picture
Definition: MWAWPictBitmap.hxx:256
void setColors(std::vector< MWAWColor > const &cols)
sets the array of indexed colors
Definition: MWAWPictBitmap.hxx:432
MWAWPictBitmapContainer(MWAWVec2i const &sz)
constructor given size
Definition: MWAWPictBitmap.hxx:58
MWAWPictBitmapContainer< int > m_data
the m_data
Definition: MWAWPictBitmap.hxx:442
virtual bool createFileData(librevenge::RVNGBinaryData &result) const
function which creates the result file
Definition: MWAWPictBitmap.cxx:241
Type
the different picture types:
Definition: MWAWPict.hxx:63
small class use to define a embedded object
Definition: libmwaw_internal.hxx:439
int cmp(MWAWPictBitmapContainerBool const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:171
MWAWPictBitmapContainer & operator=(MWAWPictBitmapContainer const &orig)
MWAWColor const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:504
virtual bool getBinary(MWAWEmbeddedObject &picture) const
returns the final picture
Definition: MWAWPictBitmap.hxx:220
void setRow(int j, U const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:416
virtual bool createFileData(librevenge::RVNGBinaryData &result) const =0
abstract function which creates the result file
virtual ~MWAWPictBitmapContainer()
destructor
Definition: MWAWPictBitmap.hxx:65
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1148
virtual bool createFileData(librevenge::RVNGBinaryData &result) const
the function which creates the result file
Definition: MWAWPictBitmap.cxx:260
Generic class used to construct bitmap.
Definition: MWAWPictBitmap.hxx:203
MWAWPictBitmapBW(MWAWVec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:290
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:494
int cmp(MWAWPictBitmapContainer< T > const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:77
bool ok() const
returns ok, if the m_data is allocated
Definition: MWAWPictBitmap.hxx:71
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:390
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:328
T const * getRow(int j) const
accessor of a row m_data
Definition: MWAWPictBitmap.hxx:113
void setColumn(int i, MWAWColor const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:520
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:231
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:274
virtual SubType getSubType() const
returns the picture subtype
Definition: MWAWPictBitmap.hxx:267
Definition: MWAWPict.hxx:63
virtual bool createFileData(librevenge::RVNGBinaryData &result) const
the function which creates the result file
Definition: MWAWPictBitmap.cxx:250
std::vector< MWAWColor > m_colors
the colors
Definition: MWAWPictBitmap.hxx:444
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:293
virtual SubType getSubType() const
return the picture subtype
Definition: MWAWPictBitmap.hxx:351
MWAWPictBitmapContainerBool(MWAWVec2i const &sz)
constructor
Definition: MWAWPictBitmap.hxx:167
virtual Type getType() const
returns the picture type
Definition: MWAWPictBitmap.hxx:212
virtual SubType getSubType() const
return the picture subtype
Definition: MWAWPictBitmap.hxx:458
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:395
MWAWPictBitmapContainer< MWAWColor > m_data
the data
Definition: MWAWPictBitmap.hxx:530
MWAWVec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:484
Generic function used to define/store a picture.
Definition: MWAWPict.hxx:51
void setRowPacked(int j, unsigned char const *val, unsigned char const *end)
allows to use packed m_data
Definition: MWAWPictBitmap.hxx:185
MWAWPictBitmapContainerBool m_data
the data
Definition: MWAWPictBitmap.hxx:343
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:358