25 #ifndef WGESCREENCAPTURE_H
26 #define WGESCREENCAPTURE_H
30 #include <boost/signals2.hpp>
31 #include <boost/function.hpp>
35 #include <osg/RenderInfo>
37 #include "../common/WSharedObject.h"
38 #include "../common/WCondition.h"
40 #include "WGECamera.h"
42 #include "animation/WGEAnimationFrameTimer.h"
78 typedef osg::ref_ptr< WGEScreenCapture >
RefPtr;
132 virtual void operator()( osg::RenderInfo& renderInfo )
const;
173 virtual void handleImage(
size_t framesLeft,
size_t totalFrames, osg::ref_ptr< osg::Image > image )
const;
180 void record(
size_t frames = std::numeric_limits< size_t >::max() );
std::shared_ptr< const WCondition > ConstSPtr
Const shared pointer type for WCondition.
std::shared_ptr< WGEAnimationFrameTimer > SPtr
Convenience typedef for a shared_ptr.
std::shared_ptr< const WGEAnimationFrameTimer > ConstSPtr
Convenience typedef for a const shared_ptr.
This class is a screen recorder.
void recordStop()
Stops recording.
void record(size_t frames=std::numeric_limits< size_t >::max())
Starts recording.
virtual ~WGEScreenCapture()
Destructor.
SharedRecordingInformation m_recordingInformation
Counts the frames to take.
boost::function< void(size_t, size_t, osg::ref_ptr< osg::Image >) > HandleImageCallbackType
This callback signature is needed to subscribe to the handleImage signal.
osg::ref_ptr< const WGEScreenCapture > ConstRefPtr
Convenience typedef.
WGEAnimationFrameTimer::ConstSPtr getFrameTimer() const
Returns a timer getting ticked on each recorded frame.
WCondition::ConstSPtr getRecordCondition() const
The condition returned here is actually the change condition of the frame counter.
void recordStart()
Starts recording.
osg::ref_ptr< WGEScreenCapture > RefPtr
Convenience typedef.
SharedRecordingInformation::ReadTicket getRecordingInformation() const
Returns the current recording information.
virtual void operator()(osg::RenderInfo &renderInfo) const
The draw callback operator.
WGEAnimationFrameTimer::SPtr m_timer
The frame timer.
void screenshot()
Makes a screenshot with the next frame.
boost::signals2::signal< void(size_t, size_t, osg::ref_ptr< osg::Image >) > HandleImageSignalType
The type of the signal for handleSignal.
WGEScreenCapture()
Creates a screen capture callback.
HandleImageSignalType m_signalHandleImage
The signal emitted on every new grabbed image.
virtual void handleImage(size_t framesLeft, size_t totalFrames, osg::ref_ptr< osg::Image > image) const
The function handles new images.
WSharedObject< RecordingInformation > SharedRecordingInformation
The shared access type to the FrameCounting struct.
void resetFrameCounter()
Resets the frame-counter to 0.
boost::signals2::connection subscribeSignal(HandleImageCallbackType callback)
Subscribes a specified function to the new-image-signal.
bool isRecording()
Checks if there are frames left for recording.
std::shared_ptr< WSharedObjectTicketRead< RecordingInformation > > ReadTicket
Type for read tickets.