示例#1
0
	std::string getConnectedClipFullName() const
	{
		if( isOutput() || !isConnected() || _connectedClip->getFullName().size() == 0 )
		{
			BOOST_THROW_EXCEPTION( exception::Logic()
			    << exception::user( "Input clip " + getFullName() + " is not connected !" ) );
		}
		return _connectedClip->getFullName();
	}
示例#2
0
	/// @warning HACK ! to keep the connection
	/// @todo remove this !!!!
	void setConnectedClip( const ClipImage& other )
	{
		if( isOutput() )
		{
			BOOST_THROW_EXCEPTION( exception::Logic()
			    << exception::user( "You can't connect an output Clip !" ) );
		}
		if( !other.isOutput() )
		{
			BOOST_THROW_EXCEPTION( exception::Logic()
			    << exception::user( "You can't connect to an input Clip !" ) );
		}
		//TUTTLE_TLOG( TUTTLE_TRACE, "== setConnectedClip: " );
		//TUTTLE_TLOG_VAR( TUTTLE_TRACE, getFullName() );
		//TUTTLE_TLOG_VAR( TUTTLE_TRACE, other.getFullName() );
		
		_connectedClip = &other;
		setConnected();

		getEditableProperties().setStringProperty( "TuttleFullName", getFullName() );
		getEditableProperties().setStringProperty( "TuttleIdentifier", getClipIdentifier() );
	}
示例#3
0
Image::Image( ClipImage& clip, const OfxRectD& bounds, const OfxTime time )
	: ofx::imageEffect::OfxhImage( clip ) ///< this ctor will set basic props on the image
	, _memlen(0)
	, _rowlen(0)
	, _fullname(clip.getFullName())
{
	_ncomp = 0;
	// Set rod in canonical & pixel coord.
	OfxRectI ibounds;
	double par = clip.getPixelAspectRatio();
	ibounds.x1 = int(bounds.x1 / par);
	ibounds.x2 = int(bounds.x2 / par);
	ibounds.y1 = int(bounds.y1);
	ibounds.y2 = int(bounds.y2);

	OfxPointI dimensions = { ibounds.x2 - ibounds.x1, ibounds.y2 - ibounds.y1 };

	if( clip.getComponentsString() == kOfxImageComponentRGBA )
	{
		_ncomp = 4;
	}
	else if( clip.getComponentsString() == kOfxImageComponentRGB )
	{
		_ncomp = 3;
	}
	else if( clip.getComponentsString() == kOfxImageComponentAlpha )
	{
		_ncomp = 1;
	}
	else
	{
		BOOST_THROW_EXCEPTION( exception::Unsupported()
		    << exception::user() + "Unsupported component type: " + quotes( clip.getComponentsString() ) );
	}

	// make some memory according to the bit depth
	if( clip.getBitDepthString() == kOfxBitDepthByte )
	{
		_memlen = _ncomp * dimensions.x * dimensions.y;
		_rowlen = _ncomp * dimensions.x;
	}
	else if( clip.getBitDepthString() == kOfxBitDepthShort )
	{
		_memlen = _ncomp * dimensions.x * dimensions.y * sizeof( boost::uint16_t );
		_rowlen = _ncomp * dimensions.x * sizeof( boost::uint16_t );
	}
	else if( clip.getBitDepthString() == kOfxBitDepthFloat )
	{
		_memlen = int(_ncomp * dimensions.x * dimensions.y * sizeof( float ) );
		_rowlen = int(_ncomp * dimensions.x * sizeof( float ) );
	}
	else
	{
		BOOST_THROW_EXCEPTION( exception::Unsupported()
		    << exception::user() + "Unsupported pixel depth: " + quotes( clip.getBitDepthString() ) );
	}

	// render scale x and y of 1.0
	setDoubleProperty( kOfxImageEffectPropRenderScale, 1.0, 0 );
	setDoubleProperty( kOfxImageEffectPropRenderScale, 1.0, 1 );

	// bounds and rod
	setIntProperty( kOfxImagePropBounds, ibounds.x1, 0 );
	setIntProperty( kOfxImagePropBounds, ibounds.y1, 1 );
	setIntProperty( kOfxImagePropBounds, ibounds.x2, 2 );
	setIntProperty( kOfxImagePropBounds, ibounds.y2, 3 );

	/// @todo the same for bounds and rod, no tiles for the moment !
	setIntProperty( kOfxImagePropRegionOfDefinition, ibounds.x1, 0 );
	setIntProperty( kOfxImagePropRegionOfDefinition, ibounds.y1, 1 );
	setIntProperty( kOfxImagePropRegionOfDefinition, ibounds.x2, 2 );
	setIntProperty( kOfxImagePropRegionOfDefinition, ibounds.y2, 3 );

	// row bytes
	setIntProperty( kOfxImagePropRowBytes, _rowlen );
}