Skip to content
Snippets Groups Projects
Commit bff654a0 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Add screen capture functionality

parent 5f7dabe6
No related branches found
No related tags found
No related merge requests found
......@@ -208,6 +208,21 @@ typedef double Color [4];
/// \param input nodeName : name of the node.
/// \param input lightingMode : lighting mode can be "ON" or "OFF".
boolean setLightingMode(in string nodeName, in string lightingMode) raises (Error);
/// Start capturing a window into image files.
/// \param windowId the ID of the window
/// \param filename, extension image files will be
/// '<filename>_<sequence_number>.<extension>'
///
/// \note To make a movie from the sequence of images, you can run:
/// \code
/// ffmpeg -r 25 -b 1800 -i capture_0_%d.jpeg video.mp4
/// \endcode
boolean startCapture (in unsigned long windowId, in string filename,
in string extension) raises (Error);
/// Stop the running capture of a window.
boolean stopCapture (in unsigned long windowId) raises (Error);
};
};
};
......@@ -200,6 +200,9 @@ namespace graphics {
it != newNodeConfigurations_.end (); it++) {
(*it).node->applyConfiguration ( (*it).position, (*it).quat);
}
for (WindowManagers_t::iterator it = windowManagers_.begin ();
it!=windowManagers_.end (); ++it)
(*it)->frame ();
mtx_.unlock ();
newNodeConfigurations_.clear ();
} catch (const std::exception& exc) {
......@@ -803,6 +806,44 @@ namespace graphics {
throw Error (exc.what ());
}
}
bool GraphicalInterface::startCapture (const WindowID windowId, const char* filename,
const char* extension)
throw (Error)
{
try {
if (windowId >= 0 || windowId < windowManagers_.size ()) {
windowManagers_[windowId]->startCapture
(std::string (filename), std::string (extension));
return true;
}
else {
std::cout << "Window ID " << windowId
<< " doesn't exist." << std::endl;
return false;
}
} catch (const std::exception& exc) {
throw Error (exc.what ());
}
}
bool GraphicalInterface::stopCapture (const WindowID windowId)
throw (Error)
{
try {
if (windowId >= 0 || windowId < windowManagers_.size ()) {
windowManagers_[windowId]->stopCapture ();
return true;
}
else {
std::cout << "Window ID " << windowId
<< " doesn't exist." << std::endl;
return false;
}
} catch (const std::exception& exc) {
throw Error (exc.what ());
}
}
} //end namespace impl
} //end namespace corbaServer
} //end namespace graphics
......@@ -133,6 +133,9 @@ public:
virtual bool setWireFrameMode(const char* nodeNameCorba, const char* wireFrameModeCorba) throw (Error);
virtual bool setLightingMode(const char* nodeNameCorba, const char* lightingModeCorba) throw (Error);
virtual bool startCapture (const WindowID windowId, const char* filename,
const char* extension) throw (Error);
virtual bool stopCapture (const WindowID windowId) throw (Error);
}; // end of class
} /* namespace impl */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment