44 Mask(
int dx ,
int dy ,
const std::string & file = std::string() ,
bool create =
false ) ;
58 void scale(
int factor ) ;
61 void up(
int x ,
int y ,
bool shift ,
bool control ) ;
64 void move(
int x ,
int y ) ;
67 void down(
int x ,
int y ,
bool shift ,
bool control ) ;
70 bool masked(
int x ,
int y )
const ;
73 bool masked(
size_t )
const ;
83 void operator=(
const Mask & ) ;
84 int clip_x(
int )
const ;
85 int clip_y(
int )
const ;
86 bool fill( std::vector<bool>& ,
int ,
int ,
int ,
int ,
bool ) ;
88 void findOrCreate(
bool ) ;
89 void open( std::ifstream & file ) ;
97 std::vector<bool> m_map ;
98 std::vector<bool> m_map_current ;
111 return m_map[offset] ;
117 const size_t offset = y * m_dx + x ;
118 if( m_down && m_down_shift )
119 return m_map[offset] && !m_map_current[offset] ;
121 return m_map[offset] || m_map_current[offset] ;
A subsecond-resolution timestamp based on a time_t.
A holder for image data, having eight bits per sample and one or three channels.
void scale(int factor)
Scales down.
Implements a binary mask over an image that can be edited by mouse actions, and that can be stored on...
void up(int x, int y, bool shift, bool control)
Called on mouse-up. Commits any down()/move() edits.
void move(int x, int y)
Called on mouse-move. Modifies the current edit.
bool empty() const
Returns true if empty.
G::EpochTime time() const
Returns the timestamp on the mask file at construction, not affected by any calls to write()...
bool update()
Updates the mask from the file. Returns true if updated.
void write(const G::Path &filename) const
Writes to file.
Mask(int dx, int dy, const std::string &file=std::string(), bool create=false)
Constructor, optionally reading the mask from an existing file.
void down(int x, int y, bool shift, bool control)
Called on mouse-down. Starts an edit.
A structure holding portable-anymap metadata.
bool masked(int x, int y) const
Returns true if the pixel is masked.
A Path object represents a file system path.