37 #ifndef MWAW_PICT_BITMAP
38 # define MWAW_PICT_BITMAP
78 if (diff)
return diff;
80 if (!orig.
m_data)
return -1;
104 T
const &
get(
int i,
int j)
const
117 void set(
int i,
int j, T
const &v)
136 for (
int j = 0, ind=i; j <
m_size[1]; j++, ind+=m_size[0])
m_data[ind] = T(val[i]);
160 if (diff)
return diff;
162 if (!orig.
m_data)
return -1;
165 return m_data[i] ? 1 : -1;
175 unsigned char v = *(val++);
176 unsigned char mask = 0x80;
177 for (
int p = 0; p < 8 && i < m_size[0]; i++, p++, ind++) {
178 m_data[ind] = ((v&mask) != 0);
179 mask = (
unsigned char)(mask >> 1);
200 virtual bool getBinary(librevenge::RVNGBinaryData &res, std::string &s)
const
202 if (!
valid())
return false;
220 if (diff)
return diff;
225 if (diff)
return (diff < 0) ? -1 : 1;
232 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const = 0;
256 if (diff)
return diff;
287 bool get(
int i,
int j)
const
297 void set(
int i,
int j,
bool v)
319 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
340 if (diff)
return diff;
344 if (diff)
return (diff < 0) ? -1 : 1;
345 for (
size_t c=0; c <
m_colors.size(); c++) {
379 int get(
int i,
int j)
const
390 void set(
int i,
int j,
int v)
395 template <
class U>
void setRow(
int j, U
const *val)
418 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
441 if (diff)
return diff;
500 virtual bool createFileData(librevenge::RVNGBinaryData &result)
const;
void setColumn(int i, bool const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:312
Definition: MWAWPictBitmap.hxx:190
int numColumns() const
gets the number of column
Definition: MWAWPictBitmap.hxx:98
void set(int i, int j, MWAWColor const &v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:483
T * m_data
the m_data placed by row ie. d_00, d_10, ... , d_{X-1}0, ..
Definition: MWAWPictBitmap.hxx:146
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:217
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:448
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:438
Definition: MWAWPictBitmap.hxx:190
Vec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:272
Vec2< float > Vec2f
Vec2 of float.
Definition: libmwaw_internal.hxx:660
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:263
void setColumn(int i, U const *val)
sets a column of m_data
Definition: MWAWPictBitmap.hxx:133
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:462
void setRow(int j, U const *val)
sets a line of m_data
Definition: MWAWPictBitmap.hxx:125
void set(int i, int j, T const &v)
sets a cell m_data
Definition: MWAWPictBitmap.hxx:117
void setColumn(int i, U const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:400
MWAWPictBitmap(Vec2i const &sz)
protected constructor: use check to construct a picture
Definition: MWAWPictBitmap.hxx:235
void setRow(int j, MWAWColor const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:488
virtual SubType getSubType() const =0
returns the picture subtype
Definition: MWAWPictBitmap.hxx:190
Vec2i m_size
the size
Definition: MWAWPictBitmap.hxx:144
Vec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:457
Box2< float > Box2f
Box2 of float.
Definition: libmwaw_internal.hxx:1022
the class to store a color
Definition: libmwaw_internal.hxx:166
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:104
a bitmap of Vec3u to store true color bitmap
Definition: MWAWPictBitmap.hxx:427
int const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:384
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:282
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:277
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:355
void setRow(int j, bool const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:302
int numRows() const
gets the number of row
Definition: MWAWPictBitmap.hxx:93
std::vector< MWAWColor > const & getColors() const
returns the array of indexed colors
Definition: MWAWPictBitmap.hxx:406
a bitmap of bool to store black-white bitmap
Definition: MWAWPictBitmap.hxx:242
bool const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:292
void set(int i, int j, int v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:390
SubType
the picture subtype: blackwhite, indexed, color
Definition: MWAWPictBitmap.hxx:190
a bool container with a function to put packed row
Definition: MWAWPictBitmap.hxx:150
void set(int i, int j, bool v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:297
MWAWPictBitmapIndexed(Vec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:361
a bitmap of int to store indexed bitmap
Definition: MWAWPictBitmap.hxx:326
void setColors(std::vector< MWAWColor > const &cols)
sets the array of indexed colors
Definition: MWAWPictBitmap.hxx:411
MWAWPictBitmapContainer< int > m_data
the m_data
Definition: MWAWPictBitmap.hxx:421
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:134
Type
the different picture types:
Definition: MWAWPict.hxx:64
int cmp(MWAWPictBitmapContainerBool const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:157
virtual bool getBinary(librevenge::RVNGBinaryData &res, std::string &s) const
returns the final librevenge::RVNGBinary data
Definition: MWAWPictBitmap.hxx:200
int cmpY(Vec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:604
MWAWPictBitmapContainer & operator=(MWAWPictBitmapContainer const &orig)
void setRowPacked(int j, unsigned char const *val)
allows to use packed m_data
Definition: MWAWPictBitmap.hxx:171
MWAWColor const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:477
void setRow(int j, U const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:395
virtual bool createFileData(librevenge::RVNGBinaryData &result) const =0
abstract function which creates the result file
MWAWPictBitmapContainerBool(Vec2i const &sz)
constructor
Definition: MWAWPictBitmap.hxx:154
virtual ~MWAWPictBitmapContainer()
destructor
Definition: MWAWPictBitmap.hxx:63
virtual bool createFileData(librevenge::RVNGBinaryData &result) const
the function which creates the result file
Definition: MWAWPictBitmap.cxx:152
Generic class used to construct bitmap.
Definition: MWAWPictBitmap.hxx:186
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:467
int cmp(MWAWPictBitmapContainer< T > const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:75
bool ok() const
returns ok, if the m_data is allocated
Definition: MWAWPictBitmap.hxx:69
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:369
MWAWPictBitmapColor(Vec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:454
T const * getRow(int j) const
accessor of a row m_data
Definition: MWAWPictBitmap.hxx:110
void setColumn(int i, MWAWColor const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:493
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:210
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:253
virtual SubType getSubType() const
returns the picture subtype
Definition: MWAWPictBitmap.hxx:246
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:143
std::vector< MWAWColor > m_colors
the colors
Definition: MWAWPictBitmap.hxx:423
virtual SubType getSubType() const
return the picture subtype
Definition: MWAWPictBitmap.hxx:330
virtual Type getType() const
returns the picture type
Definition: MWAWPictBitmap.hxx:192
virtual SubType getSubType() const
return the picture subtype
Definition: MWAWPictBitmap.hxx:431
void setRowPacked(int j, unsigned char const *val)
sets all cell contents of a row given packed m_data
Definition: MWAWPictBitmap.hxx:307
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:374
MWAWPictBitmapContainer< MWAWColor > m_data
the data
Definition: MWAWPictBitmap.hxx:503
Vec2i const & size() const
return the array size
Definition: MWAWPictBitmap.hxx:88
MWAWPictBitmapBW(Vec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:269
Generic function used to define/store a picture.
Definition: MWAWPict.hxx:52
Vec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:364
MWAWPictBitmapContainerBool m_data
the data
Definition: MWAWPictBitmap.hxx:322
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:337