25 #ifndef __GuiBase_hh__
26 #define __GuiBase_hh__
28 #include <bias_config.h>
29 #ifndef BIAS_HAVE_PTHREADS
30 # error BIAS_HAVE_PTHREADS not defined. But BIAS::GuiBase needs pthreads (on Unix and Win32). Please enable USE_PTHREADS in CMake configure step.
37 #include <Base/Debug/Debug.hh>
38 #include <Base/Debug/Error.hh>
39 #include <Base/Image/Image.hh>
40 #include <Image/PyramidImage.hh>
43 #define D_GUI_DESTRUCT 0x0001
44 #define D_GUI_MAIN 0x0002
45 #define D_GUI_SIGNAL 0x0004
46 #define D_GUI_KEY 0x0008
47 #define D_GUI_MUTEX 0x0010
48 #define D_GUI_MOUSE_BUTTON 0x0020
51 #ifdef BIAS_MUTEX_DEBUG
52 #define BIAS_MUTEX_LOCK(arg)\
53 cerr <<__FILE__<<":"<<__LINE__<<" attempting to lock mutex .. "<<#arg;\
55 pthread_mutex_lock(arg);\
56 cerr <<" .. got lock\n";
58 #define BIAS_MUTEX_UNLOCK(arg)\
59 cerr <<__FILE__<<":"<<__LINE__<<" unlocking mutex .. "<<#arg;\
61 pthread_mutex_unlock(arg);\
62 cerr <<" .. unlocked\n";
64 # define BIAS_MUTEX_LOCK(arg) pthread_mutex_lock(arg);
65 # define BIAS_MUTEX_UNLOCK(arg) pthread_mutex_unlock(arg);
78 GuiBase(
bool ShowMousePos =
true);
81 GuiBase(std::string
const& Title,
bool ShowMousePos =
true);
87 virtual void SetTitle(std::string
const& Title);
92 virtual int DestroyWindow();
99 virtual int ShowImage(
ImageBase &image,
float min=0.0,
float max=255.0);
108 virtual char CheckForKeyEvent();
113 virtual char WaitForKeyEvent();
124 virtual void WaitForMouseButtonEvent(
bool& Pressed,
int& Button,
125 int& Xpos,
int& Ypos);
129 virtual bool CheckForMouseButtonEvent(
bool& Pressed,
int& Button,
130 int& Xpos,
int& Ypos);
135 virtual void WaitForEvent(
bool& KeyEvent,
char& key,
bool& Pressed,
136 int& Button,
int& Xpos,
int& Ypos);
139 virtual bool CheckForEvent(
bool& KeyEvent,
char& key,
bool& Pressed,
140 int& Button,
int& Xpos,
int& Ypos);
145 virtual bool CheckForEvent(
char& key,
bool& Pressed,
int& Button,
146 int& Xpos,
int& Ypos);
154 virtual void SetFactorOffset(
int xoffset,
int yoffset,
int factor);
161 virtual void GetFactorOffset(
int& xoffset,
int& yoffset,
int& factor);
165 {
return !WindowCreated_; }
173 virtual void Init_(
bool ShowMousePos);
210 template <
class PixelType>
218 {
return ( ( Width_ == image.
GetWidth() ) &&
unsigned int Pyramid0Width_
static pthread_mutex_t MouseButtonMutex_
Gui is a simple windowing environment...
unsigned int GetWidth() const
bool TestImage_(Image< unsigned char > &image)
test if internal variables Width_, Height_ and nChannels_ are set correct for image these 3 variables...
unsigned int Pyramid0Height_
ImageBase OrigPicture_
This is the original representation of the picture.
static bool BaseInitialized_
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
unsigned int GetHeight() const
bool Closed()
returns true if window is closed by user via x button
unsigned int Width_
if the following 3 variables are set , Buffer_ is already allocated
unsigned int PyramidLevels_
This is the base class for images in BIAS.