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
119 void set(
int i,
int j, T
const &v)
138 for (
int j = 0, ind=i; j <
m_size[1]; j++, ind+=m_size[0])
m_data[ind] = T(val[i]);
162 if (diff)
return diff;
164 if (!orig.
m_data)
return -1;
167 return m_data[i] ? 1 : -1;
177 unsigned char v = *(val++);
178 unsigned char mask = 0x80;
179 for (
int p = 0; p < 8 && i < m_size[0]; i++, p++, ind++) {
180 m_data[ind] = ((v&mask) != 0);
181 mask = (
unsigned char)(mask >> 1);
202 virtual bool getBinary(librevenge::RVNGBinaryData &res, std::string &s)
const
204 if (!
valid())
return false;
222 if (diff)
return diff;
227 if (diff)
return (diff < 0) ? -1 : 1;
234 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const = 0;
258 if (diff)
return diff;
289 bool get(
int i,
int j)
const
299 void set(
int i,
int j,
bool v)
321 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
342 if (diff)
return diff;
346 if (diff)
return (diff < 0) ? -1 : 1;
347 for (
size_t c=0; c <
m_colors.size(); c++) {
381 int get(
int i,
int j)
const
392 void set(
int i,
int j,
int v)
397 template <
class U>
void setRow(
int j, U
const *val)
420 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
449 if (diff)
return diff;
508 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
void setColumn(int i, bool const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:314
Definition: MWAWPictBitmap.hxx:192
int numColumns() const
gets the number of column
Definition: MWAWPictBitmap.hxx:100
void set(int i, int j, MWAWColor const &v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:491
T * m_data
the m_data placed by row ie. d_00, d_10, ... , d_{X-1}0, ..
Definition: MWAWPictBitmap.hxx:148
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:219
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:456
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:446
Definition: MWAWPictBitmap.hxx:192
Vec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:274
Vec2< float > Vec2f
Vec2 of float.
Definition: libmwaw_internal.hxx:711
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:265
void setColumn(int i, U const *val)
sets a column of m_data
Definition: MWAWPictBitmap.hxx:135
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:470
void setRow(int j, U const *val)
sets a line of m_data
Definition: MWAWPictBitmap.hxx:127
void set(int i, int j, T const &v)
sets a cell m_data
Definition: MWAWPictBitmap.hxx:119
virtual bool createFileData(librevenge::RVNGBinaryData &result) const =0
abstract function which creates the result file
void setColumn(int i, U const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:402
virtual SubType getSubType() const =0
returns the picture subtype
MWAWPictBitmap(Vec2i const &sz)
protected constructor: use check to construct a picture
Definition: MWAWPictBitmap.hxx:237
void setRow(int j, MWAWColor const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:496
Definition: MWAWPictBitmap.hxx:192
Vec2i m_size
the size
Definition: MWAWPictBitmap.hxx:146
Vec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:465
Box2< float > Box2f
Box2 of float.
Definition: libmwaw_internal.hxx:1072
the class to store a color
Definition: libmwaw_internal.hxx:167
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:106
a bitmap of MWAWColor to store true color bitmap
Definition: MWAWPictBitmap.hxx:435
int const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:386
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:284
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:279
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:357
void setRow(int j, bool const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:304
int numRows() const
gets the number of row
Definition: MWAWPictBitmap.hxx:95
std::vector< MWAWColor > const & getColors() const
returns the array of indexed colors
Definition: MWAWPictBitmap.hxx:408
a bitmap of bool to store black-white bitmap
Definition: MWAWPictBitmap.hxx:244
bool const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:294
void set(int i, int j, int v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:392
SubType
the picture subtype: blackwhite, indexed, color
Definition: MWAWPictBitmap.hxx:192
a bool container with a function to put packed row
Definition: MWAWPictBitmap.hxx:152
void set(int i, int j, bool v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:299
MWAWPictBitmapIndexed(Vec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:363
bool m_hasAlpha
true if the bitmap has alpha color
Definition: MWAWPictBitmap.hxx:514
a bitmap of int to store indexed bitmap
Definition: MWAWPictBitmap.hxx:328
void setColors(std::vector< MWAWColor > const &cols)
sets the array of indexed colors
Definition: MWAWPictBitmap.hxx:413
MWAWPictBitmapColor(Vec2i const &sz, bool useAlphaChannel=false)
the constructor
Definition: MWAWPictBitmap.hxx:462
MWAWPictBitmapContainer< int > m_data
the m_data
Definition: MWAWPictBitmap.hxx:423
void setBdBox(Box2f const &box)
sets the bdbox of the picture
Definition: MWAWPict.hxx:85
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:159
virtual bool getBinary(librevenge::RVNGBinaryData &res, std::string &s) const
returns the final librevenge::RVNGBinary data
Definition: MWAWPictBitmap.hxx:202
int cmpY(Vec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:655
MWAWPictBitmapContainer & operator=(MWAWPictBitmapContainer const &orig)
void setRowPacked(int j, unsigned char const *val)
allows to use packed m_data
Definition: MWAWPictBitmap.hxx:173
MWAWColor const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:485
void setRow(int j, U const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:397
MWAWPictBitmapContainerBool(Vec2i const &sz)
constructor
Definition: MWAWPictBitmap.hxx:156
virtual ~MWAWPictBitmapContainer()
destructor
Definition: MWAWPictBitmap.hxx:65
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:188
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:475
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:371
T const * getRow(int j) const
accessor of a row m_data
Definition: MWAWPictBitmap.hxx:112
void setColumn(int i, MWAWColor const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:501
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:212
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:255
virtual SubType getSubType() const
returns the picture subtype
Definition: MWAWPictBitmap.hxx:248
MWAWPictBitmapContainer(Vec2i const &sz)
constructor given size
Definition: MWAWPictBitmap.hxx:58
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:425
virtual SubType getSubType() const
return the picture subtype
Definition: MWAWPictBitmap.hxx:332
virtual Type getType() const
returns the picture type
Definition: MWAWPictBitmap.hxx:194
virtual SubType getSubType() const
return the picture subtype
Definition: MWAWPictBitmap.hxx:439
void setRowPacked(int j, unsigned char const *val)
sets all cell contents of a row given packed m_data
Definition: MWAWPictBitmap.hxx:309
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:376
MWAWPictBitmapContainer< MWAWColor > m_data
the data
Definition: MWAWPictBitmap.hxx:511
Vec2i const & size() const
return the array size
Definition: MWAWPictBitmap.hxx:90
MWAWPictBitmapBW(Vec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:271
Generic function used to define/store a picture.
Definition: MWAWPict.hxx:52
Vec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:366
MWAWPictBitmapContainerBool m_data
the data
Definition: MWAWPictBitmap.hxx:324
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:339