MCPcopy Create free account
hub / github.com/SSARCandy/Coherent-Line-Drawing / OnSaveResult

Method OnSaveResult

src/gui.cpp:240–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240void 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected