25 #include <bias_config.h>
29 #include "ExampleImageCanvasGLBase.hh"
32 #include <Gui/ConsoleRedirectIO.hh>
33 #include <Base/Image/Image.hh>
34 #include <Base/Image/ImageIO.hh>
51 IMPLEMENT_APP(ExampleImageCanvasGLBaseApp)
55 bool ExampleImageCanvasGLBaseApp::OnInit()
60 cout<<
"Hello cout"<<endl;
61 cout<<
"Hello cerr"<<endl;
63 MyFrame *frame =
new MyFrame( wxT(
"ExampleImageCanvasGLBase"), wxPoint(0,0), wxSize(640,480) );
72 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
73 EVT_MENU(ID_QUIT, MyFrame::OnQuit)
74 EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
75 EVT_MENU(ID_MODECHANGE, MyFrame::OnModeChange)
76 EVT_MENU(ID_LOADIMAGE, MyFrame::OnLoadImage)
81 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
82 : wxFrame((wxFrame *)NULL, -1, title, pos, size)
87 wxMenu *menuFile =
new wxMenu;
88 menuFile->Append( ID_ABOUT, wxT(
"&About...") );
89 menuFile->Append( ID_LOADIMAGE, wxT(
"&Load Image...\tCtrl-L") );
91 menuFile->AppendSeparator();
92 menuFile->Append( ID_QUIT, wxT(
"E&xit") );
94 wxMenuBar *menuBar =
new wxMenuBar;
95 menuBar->Append(menuFile, wxT(
"&File"));
107 wxBoxSizer * sizer =
new wxBoxSizer(wxHORIZONTAL);
108 sizer->Add( p_canvas1 ,1,wxEXPAND|wxALL);
109 #if wxCHECK_VERSION(2, 6, 2)
112 sizer->Add(p_canvas2 ,1,wxEXPAND|wxALL);
115 sizer->SetItemMinSize(p_canvas1, 200,100);
116 sizer->SetItemMinSize(p_canvas2, 200,100);
117 sizer->SetSizeHints(
this);
120 SetSizerAndFit(sizer);
124 p_canvas1->EnableMipMapping(
true);
139 void MyFrame::OnQuit(wxCommandEvent& ){
144 void MyFrame::OnAbout(wxCommandEvent& )
146 wxString title(wxT(
"About"));
148 msg<<wxT(
"About - ")<<
AsciiToWx(FUNCNAME)<<wxT(
"\n");
149 msg<<wxT(
"author: Jan Woetzel (c) 2003-2005\n");
151 msg<<wxT(
"from ")<<
AsciiToWx(__FILE__)<<wxT(
"\n");
152 msg<<wxT(
"GUI using: ")<<wxVERSION_STRING<<wxT(
"\n");
155 wxMessageBox(msg, title, wxICON_INFORMATION | wxOK );
159 void MyFrame::OnModeChange(wxCommandEvent& )
168 void MyFrame::LoadImages()
174 string filename(BIAS_TESTS_DATA
"r4.jpg");
176 BIASERR(
"could not load image"<<filename);
179 cout<<
"loaded "<<filename<<
" for display "<<endl;
182 if (p_canvas1!=NULL) {
186 BIASERR(
"p_canvas1 is NULL");
189 if (p_canvas2!=NULL) {
193 BIASERR(
"p_canvas2 is NULL");
196 COUT(FUNCNAME<<
" done."<<endl);
201 void MyFrame::OnLoadImage(wxCommandEvent& )
void BIASGui_EXPORT ConsoleRedirectIO(std::string name=std::string(""))
Extra Console for WIN32 WinMain gui applications.
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
static int Load(const std::string &FileName, ImageBase &img)
first tries a call to Read MIP image and if that fails, tries to Import Image with all other availabl...
2D image display canvas using OpenGL rendering internally.