本文整理汇总了C++中ofx::Clip类的典型用法代码示例。如果您正苦于以下问题:C++ Clip类的具体用法?C++ Clip怎么用?C++ Clip使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Clip类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: int
/* set up and run a processor */
void
BasicPlugin::setupAndProcess(ImageScalerBase &processor, const OFX::RenderArguments &args)
{
// get a dst image
std::auto_ptr<OFX::Image> dst(dstClip_->fetchImage(args.time));
OFX::BitDepthEnum dstBitDepth = dst->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dst->getPixelComponents();
// fetch main input image
std::auto_ptr<OFX::Image> src(srcClip_->fetchImage(args.time));
// make sure bit depths are sane
if(src.get()) {
OFX::BitDepthEnum srcBitDepth = src->getPixelDepth();
OFX::PixelComponentEnum srcComponents = src->getPixelComponents();
// see if they have the same depths and bytes and all
if(srcBitDepth != dstBitDepth || srcComponents != dstComponents)
throw int(1); // HACK!! need to throw an sensible exception here!
}
// auto ptr for the mask.
// Should do this inside the if statement below but the MS compiler I have doesn't have
// a 'reset' function on the auto_ptr class
std::auto_ptr<OFX::Image> mask(getContext() != OFX::eContextFilter ? maskClip_->fetchImage(args.time) : 0);
// do we do masking
if(getContext() != OFX::eContextFilter) {
// say we are masking
processor.doMasking(true);
// Set it in the processor
processor.setMaskImg(mask.get());
}
// get the scale parameter values...
double r, g, b, a = aScale_->getValueAtTime(args.time);
r = g = b = scale_->getValueAtTime(args.time);
// see if the individual component scales are enabled
if(componentScalesEnabled_->getValueAtTime(args.time)) {
r *= rScale_->getValueAtTime(args.time);
g *= gScale_->getValueAtTime(args.time);
b *= bScale_->getValueAtTime(args.time);
}
// set the images
processor.setDstImg(dst.get());
processor.setSrcImg(src.get());
// set the render window
processor.setRenderWindow(args.renderWindow);
// set the scales
processor.setScales((float)r, (float)g, (float)b, (float)a);
// Call the base class process member, this will call the derived templated process code
processor.process();
}
示例2: int
/* set up and run a processor */
void
InvertPlugin::setupAndProcess(InvertBase &processor, const OFX::RenderArguments &args)
{
// get a dst image
std::auto_ptr<OFX::Image> dst(dstClip_->fetchImage(args.time));
OFX::BitDepthEnum dstBitDepth = dst->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dst->getPixelComponents();
// fetch main input image
std::auto_ptr<OFX::Image> src(srcClip_->fetchImage(args.time));
// make sure bit depths are sane
if(src.get()) {
OFX::BitDepthEnum srcBitDepth = src->getPixelDepth();
OFX::PixelComponentEnum srcComponents = src->getPixelComponents();
// see if they have the same depths and bytes and all
if(srcBitDepth != dstBitDepth || srcComponents != dstComponents)
throw int(1); // HACK!! need to throw an sensible exception here!
}
// set the images
processor.setDstImg(dst.get());
processor.setSrcImg(src.get());
// set the render window
processor.setRenderWindow(args.renderWindow);
// Call the base class process member, this will call the derived templated process code
processor.process();
}
示例3: dst
/* set up and run a processor */
void
CrossFadePlugin::setupAndProcess(OFX::ImageBlenderBase &processor, const OFX::RenderArguments &args)
{
// get a dst image
std::auto_ptr<OFX::Image> dst(dstClip_->fetchImage(args.time));
OFX::BitDepthEnum dstBitDepth = dst->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dst->getPixelComponents();
// fetch the two source images
std::auto_ptr<OFX::Image> fromImg(fromClip_->fetchImage(args.time));
std::auto_ptr<OFX::Image> toImg(toClip_->fetchImage(args.time));
// make sure bit depths are sane
if(fromImg.get()) checkComponents(*fromImg, dstBitDepth, dstComponents);
if(toImg.get()) checkComponents(*toImg, dstBitDepth, dstComponents);
// get the transition value
float blend = (float)transition_->getValueAtTime(args.time);
// set the images
processor.setDstImg(dst.get());
processor.setFromImg(fromImg.get());
processor.setToImg(toImg.get());
// set the render window
processor.setRenderWindow(args.renderWindow);
// set the scales
processor.setBlend(blend);
// Call the base class process member, this will call the derived templated process code
processor.process();
}
示例4: dst
/* set up and run a processor */
void
InvertPlugin::setupAndProcess(InvertBase &processor, const OFX::RenderArguments &args)
{
// get a dst image
std::auto_ptr<OFX::Image> dst(dstClip_->fetchImage(args.time));
if (!dst.get()) {
OFX::throwSuiteStatusException(kOfxStatFailed);
}
OFX::BitDepthEnum dstBitDepth = dst->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dst->getPixelComponents();
// fetch main input image
std::auto_ptr<OFX::Image> src(srcClip_->fetchImage(args.time));
// make sure bit depths are sane
if (src.get()) {
OFX::BitDepthEnum srcBitDepth = src->getPixelDepth();
OFX::PixelComponentEnum srcComponents = src->getPixelComponents();
// see if they have the same depths and bytes and all
if (srcBitDepth != dstBitDepth || srcComponents != dstComponents) {
OFX::throwSuiteStatusException(kOfxStatErrImageFormat);
}
}
// auto ptr for the mask.
std::auto_ptr<OFX::Image> mask((getContext() != OFX::eContextFilter) ? maskClip_->fetchImage(args.time) : 0);
// do we do masking
if (getContext() != OFX::eContextFilter && maskClip_->isConnected()) {
// say we are masking
processor.doMasking(true);
// Set it in the processor
processor.setMaskImg(mask.get());
}
bool red, green, blue, alpha;
_paramProcessR->getValueAtTime(args.time, red);
_paramProcessG->getValueAtTime(args.time, green);
_paramProcessB->getValueAtTime(args.time, blue);
_paramProcessA->getValueAtTime(args.time, alpha);
double mix;
_mix->getValueAtTime(args.time, mix);
bool maskInvert;
_maskInvert->getValueAtTime(args.time, maskInvert);
processor.setValues(red, green, blue, alpha, mix, maskInvert);
// set the images
processor.setDstImg(dst.get());
processor.setSrcImg(src.get());
// set the render window
processor.setRenderWindow(args.renderWindow);
// Call the base class process member, this will call the derived templated process code
processor.process();
}
示例5: switch
// the overridden render function
void
NoisePlugin::render(const OFX::RenderArguments &args)
{
// instantiate the render code based on the pixel depth of the dst clip
OFX::BitDepthEnum dstBitDepth = dstClip_->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dstClip_->getPixelComponents();
// do the rendering
if(dstComponents == OFX::ePixelComponentRGBA) {
switch(dstBitDepth)
{
case OFX::eBitDepthUByte : {
NoiseGenerator<unsigned char, 4, 255> fred(*this);
setupAndProcess(fred, args);
}
break;
case OFX::eBitDepthUShort :
{
NoiseGenerator<unsigned short, 4, 65535> fred(*this);
setupAndProcess(fred, args);
}
break;
case OFX::eBitDepthFloat :
{
NoiseGenerator<float, 4, 1> fred(*this);
setupAndProcess(fred, args);
}
break;
}
}
else {
switch(dstBitDepth)
{
case OFX::eBitDepthUByte :
{
NoiseGenerator<unsigned char, 1, 255> fred(*this);
setupAndProcess(fred, args);
}
break;
case OFX::eBitDepthUShort :
{
NoiseGenerator<unsigned short, 1, 65536> fred(*this);
setupAndProcess(fred, args);
}
break;
case OFX::eBitDepthFloat :
{
NoiseGenerator<float, 1, 1> fred(*this);
setupAndProcess(fred, args);
}
break;
}
}
}
示例6: switch
// the overridden render function
void
BasicPlugin::render(const OFX::RenderArguments &args)
{
// instantiate the render code based on the pixel depth of the dst clip
OFX::BitDepthEnum dstBitDepth = dstClip_->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dstClip_->getPixelComponents();
// do the rendering
if(dstComponents == OFX::ePixelComponentRGBA) {
switch(dstBitDepth) {
case OFX::eBitDepthUByte : {
ImageScaler<unsigned char, 4, 255> fred(*this);
setupAndProcess(fred, args);
}
break;
case OFX::eBitDepthUShort : {
ImageScaler<unsigned short, 4, 65535> fred(*this);
setupAndProcess(fred, args);
}
break;
case OFX::eBitDepthFloat : {
ImageScaler<float, 4, 1> fred(*this);
setupAndProcess(fred, args);
}
break;
default :
OFX::throwSuiteStatusException(kOfxStatErrUnsupported);
}
}
else {
switch(dstBitDepth) {
case OFX::eBitDepthUByte : {
ImageScaler<unsigned char, 1, 255> fred(*this);
setupAndProcess(fred, args);
}
break;
case OFX::eBitDepthUShort : {
ImageScaler<unsigned short, 1, 65535> fred(*this);
setupAndProcess(fred, args);
}
break;
case OFX::eBitDepthFloat : {
ImageScaler<float, 1, 1> fred(*this);
setupAndProcess(fred, args);
}
break;
default :
OFX::throwSuiteStatusException(kOfxStatErrUnsupported);
}
}
}
示例7: catch
/** @brief render for the filter */
void
FilterPlugin::render(const OFX::RenderArguments &args)
{
OFX::Image *src = 0, *dst = 0;
try {
// get a src image
src = srcClip_->fetchImage(args.time);
// get a dst image
dst = dstClip_->fetchImage(args.time);
// push some pixels
// blah;
// blah;
// blah;
}
catch(...) {
delete src;
delete dst;
throw;
}
// delete them
delete src;
delete dst;
}
示例8: ImageFilterProcessor
ImageFilterProcessor(OFX::ImageEffect& effect, const EImageOrientation imageOrientation)
: ImageProcessor(effect, imageOrientation)
{
_clipSrc = effect.fetchClip(kOfxImageEffectSimpleSourceClipName);
if(!_clipSrc->isConnected())
BOOST_THROW_EXCEPTION(exception::ImageNotConnected());
}
示例9:
// override the rod call
bool
BasicPlugin::getRegionOfDefinition(const OFX::RegionOfDefinitionArguments &args, OfxRectD &rod)
{
// our RoD is the same as the 'Source' clip's, we are not interested in the mask
rod = srcClip_->getRegionOfDefinition(args.time);
// say we set it
return true;
}
示例10: setupAndProcess
void GenericTestPlugin::setupAndProcess(GenericTestBase &processor, const OFX::RenderArguments &args)
{
std::auto_ptr<OFX::Image> dst(dstClip_->fetchImage(args.time));
OFX::BitDepthEnum dstBitDepth = dst->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dst->getPixelComponents();
std::auto_ptr<OFX::Image> src(srcClip_->fetchImage(args.time));
if(src.get())
{
OFX::BitDepthEnum srcBitDepth = src->getPixelDepth();
OFX::PixelComponentEnum srcComponents = src->getPixelComponents();
// see if they have the same depths and bytes and all
if(srcBitDepth != dstBitDepth || srcComponents != dstComponents)
throw int(1); // HACK!! need to throw an sensible exception here!
}
processor.setDstImg(dst.get());
processor.setSrcImg(src.get());
processor.setRenderWindow(args.renderWindow);
processor.process();
}
示例11: assert
// the overridden render function
void
AnaglyphPlugin::render(const OFX::RenderArguments &args)
{
if (!OFX::fetchSuite(kOfxVegasStereoscopicImageEffectSuite, 1, true)) {
OFX::throwHostMissingSuiteException(kOfxVegasStereoscopicImageEffectSuite);
}
// instantiate the render code based on the pixel depth of the dst clip
OFX::BitDepthEnum dstBitDepth = dstClip_->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dstClip_->getPixelComponents();
// do the rendering
assert(dstComponents == OFX::ePixelComponentRGBA);
switch (dstBitDepth) {
case OFX::eBitDepthUByte : {
ImageAnaglypher<unsigned char, 255> fred(*this);
setupAndProcess(fred, args);
}
break;
case OFX::eBitDepthUShort : {
ImageAnaglypher<unsigned short, 65535> fred(*this);
setupAndProcess(fred, args);
}
break;
case OFX::eBitDepthFloat : {
ImageAnaglypher<float, 1> fred(*this);
setupAndProcess(fred, args);
}
break;
default :
OFX::throwSuiteStatusException(kOfxStatErrUnsupported);
}
}
示例12: setup
virtual void setup( const OFX::RenderArguments& args )
{
// destination view
_dst.reset( _clipDst->fetchImage( args.time ) );
if( !_dst.get() )
BOOST_THROW_EXCEPTION( exception::ImageNotReady() );
if( _dst->getRowBytes() == 0 )
BOOST_THROW_EXCEPTION( exception::WrongRowBytes() );
// _dstPixelRod = _dst->getRegionOfDefinition(); // bug in nuke, returns bounds
_dstPixelRod = _clipDst->getPixelRod( args.time, args.renderScale );
_dstPixelRodSize.x = ( this->_dstPixelRod.x2 - this->_dstPixelRod.x1 );
_dstPixelRodSize.y = ( this->_dstPixelRod.y2 - this->_dstPixelRod.y1 );
_dstView = getView( _dst.get(), _dstPixelRod );
#ifndef TUTTLE_PRODUCTION
// init dst buffer with red to highlight uninitialized pixels
const OfxRectI dstBounds = this->translateRoWToOutputClipCoordinates( _dst->getBounds() );
View dstToFill = boost::gil::subimage_view( _dstView,
dstBounds.x1, dstBounds.y1,
dstBounds.x2 - dstBounds.x1, dstBounds.y2 - dstBounds.y1 );
const boost::gil::rgba32f_pixel_t errorColor( 1.0, 0.0, 0.0, 1.0 );
fill_pixels( dstToFill, errorColor );
#endif
}
示例13:
/* override the time domain action, only for the general context */
bool
RetimerPlugin::getTimeDomain(OfxRangeD &range)
{
// this should only be called in the general context, ever!
if(getContext() == OFX::eContextGeneral) {
// If we are a general context, we can changed the duration of the effect, so have a param to do that
// We need a separate param as it is impossible to derive this from a speed param and the input clip
// duration (the speed may be animating or wired to an expression).
double duration = duration_->getValue(); //don't animate
// how many frames on the input clip
OfxRangeD srcRange = srcClip_->getFrameRange();
range.min = 0;
range.max = srcRange.max * duration;
return true;
}
return false;
}
示例14: dst
/* set up and run a processor */
void
NoisePlugin::setupAndProcess(NoiseGeneratorBase &processor, const OFX::RenderArguments &args)
{
// get a dst image
std::auto_ptr<OFX::Image> dst(dstClip_->fetchImage(args.time));
OFX::BitDepthEnum dstBitDepth = dst->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dst->getPixelComponents();
// set the images
processor.setDstImg(dst.get());
// set the render window
processor.setRenderWindow(args.renderWindow);
// set the scales
processor.setNoiseLevel((float)noise_->getValueAtTime(args.time));
// set the seed based on the current time, and double it we get difference seeds on different fields
processor.setSeed(uint32_t(args.time * 2.0f + 2000.0f));
// Call the base class process member, this will call the derived templated process code
processor.process();
}
示例15: dst
/* set up and run a processor */
void
RetimerPlugin::setupAndProcess(OFX::ImageBlenderBase &processor, const OFX::RenderArguments &args)
{
// get a dst image
std::auto_ptr<OFX::Image> dst(dstClip_->fetchImage(args.time));
OFX::BitDepthEnum dstBitDepth = dst->getPixelDepth();
OFX::PixelComponentEnum dstComponents = dst->getPixelComponents();
// figure the frame we should be retiming from
double sourceTime;
if(getContext() == OFX::eContextRetimer) {
// the host is specifying it, so fetch it from the "sourceTime" pseudo-param
sourceTime = sourceTime_->getValueAtTime(args.time);
}
else {
// we have our own param, which is a speed, so we integrate it to get the time we want
sourceTime = speed_->integrate(0, args.time);
}
// figure the two images we are blending between
double fromTime, toTime;
double blend;
if(args.fieldToRender == OFX::eFieldNone) {
// unfielded, easy peasy
fromTime = floor(sourceTime);
toTime = fromTime + 1;
blend = sourceTime - fromTime;
}
else {
// Fielded clips, pook. We are rendering field doubled images,
// and so need to blend between fields, not frames.
double frac = sourceTime - floor(sourceTime);
if(frac < 0.5) {
// need to go between the first and second fields of this frame
fromTime = floor(sourceTime); // this will get the first field
toTime = fromTime + 0.5; // this will get the second field of the same frame
blend = frac * 2.0; // and the blend is between those two
}
else { // frac > 0.5
fromTime = floor(sourceTime) + 0.5; // this will get the second field of this frame
toTime = floor(sourceTime) + 1.0; // this will get the first field of the next frame
blend = (frac - 0.5) * 2.0;
}
}
// fetch the two source images
std::auto_ptr<OFX::Image> fromImg(srcClip_->fetchImage(fromTime));
std::auto_ptr<OFX::Image> toImg(srcClip_->fetchImage(toTime));
// make sure bit depths are sane
if(fromImg.get()) checkComponents(*fromImg, dstBitDepth, dstComponents);
if(toImg.get()) checkComponents(*toImg, dstBitDepth, dstComponents);
// set the images
processor.setDstImg(dst.get());
processor.setFromImg(fromImg.get());
processor.setToImg(toImg.get());
// set the render window
processor.setRenderWindow(args.renderWindow);
// set the blend between
processor.setBlend((float)blend);
// Call the base class process member, this will call the derived templated process code
processor.process();
}