37 #ifndef MWAW_PICT_BITMAP
38 # define MWAW_PICT_BITMAP
76 if (diff)
return diff;
78 if (!orig.
m_data)
return -1;
99 T
const &
get(
int i,
int j)
const {
110 void set(
int i,
int j, T
const &v) {
126 for (
int j = 0, ind=i; j <
m_size[1]; j++, ind+=m_size[0])
m_data[ind] = T(val[i]);
149 if (diff)
return diff;
151 if (!orig.
m_data)
return -1;
154 return m_data[i] ? 1 : -1;
163 unsigned char v = *(val++);
164 unsigned char mask = 0x80;
165 for (
int p = 0; p < 8 && i < m_size[0]; i++, p++, ind++) {
166 m_data[ind] = ((v&mask) != 0);
167 mask = (
unsigned char) (mask >> 1);
187 virtual bool getBinary(WPXBinaryData &res, std::string &s)
const {
188 if (!
valid())
return false;
204 if (diff)
return diff;
209 if (diff)
return (diff < 0) ? -1 : 1;
237 if (diff)
return diff;
264 bool get(
int i,
int j)
const {
272 void set(
int i,
int j,
bool v) {
309 if (diff)
return diff;
313 if (diff)
return (diff < 0) ? -1 : 1;
314 for (
size_t c=0; c <
m_colors.size(); c++) {
344 int get(
int i,
int j)
const {
353 void set(
int i,
int j,
int v) {
357 template <
class U>
void setRow(
int j, U
const *val) {
361 template <
class U>
void setColumn(
int i, U
const *val) {
397 if (diff)
return diff;
void setColumn(int i, bool const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:284
Definition: MWAWPictBitmap.hxx:178
int numColumns() const
gets the number of column
Definition: MWAWPictBitmap.hxx:94
void set(int i, int j, MWAWColor const &v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:433
T * m_data
the m_data placed by row ie. d_00, d_10, ... , d_{X-1}0, ..
Definition: MWAWPictBitmap.hxx:136
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:202
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:404
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:395
Definition: MWAWPictBitmap.hxx:178
Vec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:252
Vec2< float > Vec2f
Vec2 of float.
Definition: libmwaw_internal.hxx:596
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:244
void setColumn(int i, U const *val)
sets a column of m_data
Definition: MWAWPictBitmap.hxx:124
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:416
virtual bool createFileData(WPXBinaryData &result) const
function which creates the result file
Definition: MWAWPictBitmap.cxx:134
void setRow(int j, U const *val)
sets a line of m_data
Definition: MWAWPictBitmap.hxx:117
virtual bool createFileData(WPXBinaryData &result) const =0
abstract function which creates the result file
void set(int i, int j, T const &v)
sets a cell m_data
Definition: MWAWPictBitmap.hxx:110
void setColumn(int i, U const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:361
MWAWPictBitmap(Vec2i const &sz)
protected constructor: use check to construct a picture
Definition: MWAWPictBitmap.hxx:219
void setRow(int j, MWAWColor const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:437
virtual SubType getSubType() const =0
returns the picture subtype
Definition: MWAWPictBitmap.hxx:178
Vec2i m_size
the size
Definition: MWAWPictBitmap.hxx:134
Vec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:412
Box2< float > Box2f
Box2 of float.
Definition: libmwaw_internal.hxx:909
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:99
T const & get(int i, int j) const
accessor of a cell m_data
Definition: MWAWPictBitmap.hxx:99
a bitmap of Vec3u to store true color bitmap
Definition: MWAWPictBitmap.hxx:385
int const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:348
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:260
int numRows() const
the number of rows
Definition: MWAWPictBitmap.hxx:256
a template class to store a 2D array of m_data
Definition: MWAWPictBitmap.hxx:56
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.hxx:324
virtual bool createFileData(WPXBinaryData &result) const
the function which creates the result file
Definition: MWAWPictBitmap.cxx:143
void setRow(int j, bool const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:276
int numRows() const
gets the number of row
Definition: MWAWPictBitmap.hxx:90
std::vector< MWAWColor > const & getColors() const
returns the array of indexed colors
Definition: MWAWPictBitmap.hxx:366
virtual bool getBinary(WPXBinaryData &res, std::string &s) const
returns the final WPXBinary data
Definition: MWAWPictBitmap.hxx:187
a bitmap of bool to store black-white bitmap
Definition: MWAWPictBitmap.hxx:225
bool const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:268
void set(int i, int j, int v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:353
SubType
the picture subtype: blackwhite, indexed, color
Definition: MWAWPictBitmap.hxx:178
a bool container with a function to put packed row
Definition: MWAWPictBitmap.hxx:140
void set(int i, int j, bool v)
sets a cell contents
Definition: MWAWPictBitmap.hxx:272
MWAWPictBitmapIndexed(Vec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:329
a bitmap of int to store indexed bitmap
Definition: MWAWPictBitmap.hxx:297
void setColors(std::vector< MWAWColor > const &cols)
sets the array of indexed colors
Definition: MWAWPictBitmap.hxx:370
MWAWPictBitmapContainer< int > m_data
the m_data
Definition: MWAWPictBitmap.hxx:379
void setBdBox(Box2f const &box)
sets the bdbox of the picture
Definition: MWAWPict.hxx:84
Type
the different picture types:
Definition: MWAWPict.hxx:64
int cmp(MWAWPictBitmapContainerBool const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:147
virtual bool createFileData(WPXBinaryData &result) const
the function which creates the result file
Definition: MWAWPictBitmap.cxx:152
int cmpY(Vec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:542
MWAWPictBitmapContainer & operator=(MWAWPictBitmapContainer const &orig)
void setRowPacked(int j, unsigned char const *val)
allows to use packed m_data
Definition: MWAWPictBitmap.hxx:160
MWAWColor const * getRow(int j) const
returns the cells content of a row
Definition: MWAWPictBitmap.hxx:428
void setRow(int j, U const *val)
sets all cell contents of a row
Definition: MWAWPictBitmap.hxx:357
MWAWPictBitmapContainerBool(Vec2i const &sz)
constructor
Definition: MWAWPictBitmap.hxx:144
virtual ~MWAWPictBitmapContainer()
destructor
Definition: MWAWPictBitmap.hxx:64
Generic class used to construct bitmap.
Definition: MWAWPictBitmap.hxx:174
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:420
int cmp(MWAWPictBitmapContainer< T > const &orig) const
a comparison operator
Definition: MWAWPictBitmap.hxx:74
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:336
MWAWPictBitmapColor(Vec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:409
T const * getRow(int j) const
accessor of a row m_data
Definition: MWAWPictBitmap.hxx:104
void setColumn(int i, MWAWColor const *val)
sets all cell contents of a column
Definition: MWAWPictBitmap.hxx:441
virtual bool valid() const
returns true if the picture is valid
Definition: MWAWPictBitmap.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: MWAWPictBitmap.hxx:235
virtual SubType getSubType() const
returns the picture subtype
Definition: MWAWPictBitmap.hxx:229
MWAWPictBitmapContainer(Vec2i const &sz)
constructor given size
Definition: MWAWPictBitmap.hxx:60
Definition: MWAWPict.hxx:64
std::vector< MWAWColor > m_colors
the colors
Definition: MWAWPictBitmap.hxx:381
virtual SubType getSubType() const
return the picture subtype
Definition: MWAWPictBitmap.hxx:301
virtual Type getType() const
returns the picture type
Definition: MWAWPictBitmap.hxx:180
virtual SubType getSubType() const
return the picture subtype
Definition: MWAWPictBitmap.hxx:389
void setRowPacked(int j, unsigned char const *val)
sets all cell contents of a row given packed m_data
Definition: MWAWPictBitmap.hxx:280
int numColumns() const
the number of columns
Definition: MWAWPictBitmap.hxx:340
MWAWPictBitmapContainer< MWAWColor > m_data
the data
Definition: MWAWPictBitmap.hxx:450
Vec2i const & size() const
return the array size
Definition: MWAWPictBitmap.hxx:86
MWAWPictBitmapBW(Vec2i const &sz)
the constructor
Definition: MWAWPictBitmap.hxx:249
Generic function used to define/store a picture.
Definition: MWAWPict.hxx:52
Vec2i const & size() const
the picture size
Definition: MWAWPictBitmap.hxx:332
MWAWPictBitmapContainerBool m_data
the data
Definition: MWAWPictBitmap.hxx:293
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:307