| 238 | } |
| 239 | |
| 240 | void MyFrame::OnSaveResult(wxCommandEvent &event) |
| 241 | { |
| 242 | wxFileDialog saveFileDialog( |
| 243 | this, _("Save PNG file"), "", "", "PNG files (*.png)|*.png", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); |
| 244 | if (saveFileDialog.ShowModal() == wxID_CANCEL) return; // the user changed idea... |
| 245 | |
| 246 | // save the current contents in the file; |
| 247 | // this can be done with e.g. wxWidgets output streams: |
| 248 | wxFileOutputStream output_stream(saveFileDialog.GetPath()); |
| 249 | if (!output_stream.IsOk()) { |
| 250 | wxLogError("Cannot save current contents in file '%s'.", saveFileDialog.GetPath()); |
| 251 | return; |
| 252 | } |
| 253 | |
| 254 | cv::Mat res = drawPane->image().clone(); |
| 255 | cv::cvtColor(drawPane->image(), res, CV_BGR2RGB); |
| 256 | cv::imwrite((const char *)saveFileDialog.GetPath().mb_str(), res); |
| 257 | } |
| 258 | |
| 259 | |
| 260 | //Buttons |
nothing calls this directly
no outgoing calls
no test coverage detected