BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
a665cf4
Branches
Tags
master
Blinker
src
noarch
CanvasInput.h
first version of canvas module (not yet completely happy with it)
Stefan Schuermans
commited
a665cf4
at 2011-11-19 13:35:10
CanvasInput.h
Blame
History
Raw
/* Blinker Copyright 2011 Stefan Schuermans <stefan@blinkenarea.org> Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html a blinkenarea.org project */ #ifndef CANVASINPUT_H #define CANVASINPUT_H #include <string> #include <BlinkenLib/BlinkenFrame.h> #include "Canvas.h" #include "Directory.h" #include "File.h" #include "Position.h" #include "SettingFile.h" #include "Size.h" #include "StreamMgr.h" #include "StreamRecv.h" namespace Blinker { /// input to canvas class Canvas::Input: public StreamRecv { public: /** * @brief constructor * @param[in] canvas owning canvas * @param[in] dirBase base directory */ Input(Canvas &canvas, const Directory &dirBase); /// virtual destructor virtual ~Input(); private: /// copy constructor disabled Input(const Input &that); /// assignment operator disabled const Input & operator=(const Input &that); public: /// check for update of configuration void updateConfig(); /** * @brief set current frame * @param[in] stream stream name * @param[in] pFrame current frame */ virtual void setFrame(const std::string &stream, stBlinkenFrame *pFrame); /** * @brief set current frame to none * @param[in] stream stream name */ virtual void setNoFrame(const std::string &stream); /** * @brief draw current frame to canvas * @return if a frame was available and it was drawn */ bool draw(); protected: /// get input stream and attach to it void getInStream(); /// detach from input stream and release it void releaseInStream(); /// (re-)get position of stream on canvas void getPosition(); /// (re-)get size of stream on canvas void getSize(); /// (un-)prepare frame based on current frame of stream void updateFrame(); /** * @brief prepare frame (scale it if needed) * @param[in] pFrame frame to prepare */ void prepareFrame(stBlinkenFrame *pFrame); /// throw away prepared frame void unprepareFrame(); protected: Canvas &m_canvas; ///< owning canvas SettingFile m_fileInStream; ///< input stream name file SettingFile m_filePosition; ///< position file SettingFile m_fileSize; ///< size file std::string m_nameInStream; ///< name of input stream bool m_havePosition; ///< if position of stream on canvas is defined Position m_position; ///< position of stream on canvas bool m_haveSize; ///< if size of stream on canvas is defined Size m_size; ///< size of stream on canvas Stream *m_pInStream; ///< input stream bool m_ownFrame; ///< if the frame was allocated ourself stBlinkenFrame *m_pFrame; ///< frame to draw (already scaled to size) }; // class Canvas::Input } // namespace Blinker #endif // #ifndef CANVASINPUT_H