⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 videomanrenderer.h

📁 VideoMan is a very easy image acquisition library. It is able to manage many video inputs at the sam
💻 H
字号:
#pragma once
#include "VideoInput.h"
#include <list>

typedef struct 
{
	int left, bottom, width, height;
	void init(int aleft, int abottom, int awidth, int aheight)
	{
		left=aleft;
		bottom=abottom;
		width=awidth;
		height=aheight;
	}
}SCREEN_SIZE;

class RendererInput
{
public:
	RendererInput( void );
	virtual ~RendererInput( void );

	VideoInput *videoInput;
	SCREEN_SIZE screenCoords;
	bool updateTexture; //if it is necesary to update the texture
	int width;
	int height;
	int depth;
	int nChannels;
	bool activated; //If the input is activated it will be rendered
	bool supported; //The input format is or not supported
	PIXEL_FORMAT pixelFormat;
	bool verticalFlip; //If the input is displayed vertically fliped
	bool horizontalFlip; //If the input is displayed horizontally fliped
};

class VideoManRenderer
{
public:
	VideoManRenderer(void);
	virtual ~VideoManRenderer(void);

	virtual bool addVideoInput( VideoInput *video ) = 0;
	virtual inline void renderInputs() = 0;
	virtual inline void renderInput( size_t v ) = 0;
	virtual inline void updateTexture( size_t v, const char *image ) = 0;
	virtual inline void updateTexture( size_t v ) = 0;

	virtual void deleteVideoInput( size_t inputIndex ) = 0;
		
	/** \brief Activate all the video inputs. In the next render all the inputs will be shown		
	*/
	virtual void activateAllVideoInputs() = 0;

	/** \brief Activate this video input. In the next render only this input will be shown
		\param v [in] the video input index		
	*/
	virtual void activateVideoInput( size_t v ) = 0;

	/** \brief Deactivate all the video inputs. In the next render any of the inputs will be shown
	*/
	virtual void deactivateAllVideoInputs() = 0;

	/** \brief Deactivate the video input number v. In the next render this input will not be shown
		\param v [in] the video input index
	*/
	virtual void deactivateVideoInput( size_t v ) = 0;

	/** \brief Check if this video input is activated or not
		\param v [in] the video input index
	*/
	virtual bool isActivated( size_t v ) = 0;
	

	/** \brief Notify to the renderer the change of the screen
		\param left [in] the x coordinate of the top left corner of the region where the renderer must draw
		\param up [in] the y coordinate of the top left corner of the region where the renderer must draw
		\param width [in] the width of the region where the renderer must draw
		\param height [in] the height of the region where the renderer must draw
	*/
	virtual void changeScreenSize( int left, int up, int width, int height ) = 0;

	/** \brief Transform screen coordinates to image coordinates
		\param x [in/out] the x coordinate
		\param y [in/out] the y coordinate
		\return the input index or -1
	*/
	virtual int screenToImageCoords( float &x, float &y ) = 0;

	virtual bool imageToScreenCoords( const size_t &v, float &x, float &y ) = 0;	
	virtual bool getScreenCoords( const size_t &v, int &left, int &up, int &width, int &height ) = 0;

	/** \brief Get the coordinates of the input texture
		\param input [in] the video input index
		\param left,up,right,bottom [out] the texture coordinates
	*/
	virtual void getTextureCoords( const size_t &input, float &left, float &bottom, float &right, float &up ) = 0;

	/** \brief Activate the renderer viewport of this video input
		\param v [in] the video input index
	*/
	virtual inline void activateViewport( const size_t &v ) = 0;

	/** \brief Activate the renderer texture of this video input
		\param v [in] the video input index
	*/
	virtual inline void activateTexture( const size_t &v ) = 0;

	virtual void changeVisualizationMode( int vM ) = 0;

	virtual void changeMainVisualizationInput( const size_t &v ) = 0;

	int getMainVisualizationInput();

	virtual void setVerticalFlip( const size_t &v, bool value ) = 0;
	virtual bool getVerticalFlip( const size_t &v ) = 0;
	virtual void setHorizontalFlip( const size_t &v, bool value ) = 0;
	virtual bool getHorizontalFlip( const size_t &v ) = 0;

protected:

	bool supportedFormat( PIXEL_FORMAT pixelFormat );

	std::list<PIXEL_FORMAT> supportedFormats;

	int activatedInputs; //The number of the inputs that are activated

	SCREEN_SIZE screenSize;

	int visualizationMode; 

	size_t mainVisualizationInput;

	std::list<size_t> emptyIndexes;		//The queue of the free empties

};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -