6 #ifndef CNOID_UTIL_IMAGE_H
7 #define CNOID_UTIL_IMAGE_H
12 #include "exportdecl.h"
26 bool empty()
const {
return pixels_.empty(); }
28 unsigned char*
pixels() {
return &pixels_.front(); }
29 const unsigned char*
pixels()
const {
return &pixels_.front(); }
31 int width()
const {
return width_; }
32 int height()
const {
return height_; }
36 void setSize(
int width,
int height,
int nComponents);
37 void setSize(
int width,
int height);
40 void applyVerticalFlip();
42 bool load(
const std::string& filename, std::ostream& os =
nullout());
43 bool save(
const std::string& filename, std::ostream& os =
nullout())
const;
46 std::vector<unsigned char> pixels_;