Esempio n. 1
0
/* set up and run a copy processor */
static void
setupAndCopy(OFX::PixelProcessorFilterBase & processor,
             const OfxRectI &renderWindow,
             const void *srcPixelData,
             const OfxRectI& srcBounds,
             OFX::PixelComponentEnum srcPixelComponents,
             OFX::BitDepthEnum srcPixelDepth,
             int srcRowBytes,
             void *dstPixelData,
             const OfxRectI& dstBounds,
             OFX::PixelComponentEnum dstPixelComponents,
             OFX::BitDepthEnum dstPixelDepth,
             int dstRowBytes)
{
    assert(srcPixelData && dstPixelData);

    // make sure bit depths are sane
    if (srcPixelDepth != dstPixelDepth || srcPixelComponents != dstPixelComponents) {
        OFX::throwSuiteStatusException(kOfxStatErrFormat);
    }

    // set the images
    processor.setDstImg(dstPixelData, dstBounds, dstPixelComponents, dstPixelDepth, dstRowBytes);
    processor.setSrcImg(srcPixelData, srcBounds, srcPixelComponents, srcPixelDepth, srcRowBytes);

    // set the render window
    processor.setRenderWindow(renderWindow);
    
    // Call the base class process member, this will call the derived templated process code
    processor.process();
}
Esempio n. 2
0
/* set up and run a copy processor */
void
CImgFilterPluginHelperBase::setupAndFill(OFX::PixelProcessorFilterBase & processor,
                                         const OfxRectI &renderWindow,
                                         void *dstPixelData,
                                         const OfxRectI& dstBounds,
                                         OFX::PixelComponentEnum dstPixelComponents,
                                         int dstPixelComponentCount,
                                         OFX::BitDepthEnum dstPixelDepth,
                                         int dstRowBytes)
{
    assert(dstPixelData &&
           dstBounds.x1 <= renderWindow.x1 && renderWindow.x2 <= dstBounds.x2 &&
           dstBounds.y1 <= renderWindow.y1 && renderWindow.y2 <= dstBounds.y2);
    // set the images
    processor.setDstImg(dstPixelData, dstBounds, dstPixelComponents, dstPixelComponentCount, dstPixelDepth, dstRowBytes);

    // set the render window
    processor.setRenderWindow(renderWindow);

    // Call the base class process member, this will call the derived templated process code
    processor.process();
}
Esempio n. 3
0
/* set up and run a copy processor */
void
CImgFilterPluginHelperBase::setupAndCopy(OFX::PixelProcessorFilterBase & processor,
                                         double time,
                                         const OfxRectI &renderWindow,
                                         const OFX::Image* orig,
                                         const OFX::Image* mask,
                                         const void *srcPixelData,
                                         const OfxRectI& srcBounds,
                                         OFX::PixelComponentEnum srcPixelComponents,
                                         int srcPixelComponentCount,
                                         OFX::BitDepthEnum srcBitDepth,
                                         int srcRowBytes,
                                         int srcBoundary,
                                         void *dstPixelData,
                                         const OfxRectI& dstBounds,
                                         OFX::PixelComponentEnum dstPixelComponents,
                                         int dstPixelComponentCount,
                                         OFX::BitDepthEnum dstPixelDepth,
                                         int dstRowBytes,
                                         bool premult,
                                         int premultChannel,
                                         double mix,
                                         bool maskInvert)
{
    // src may not be valid over the renderWindow
    //assert(srcPixelData &&
    //       srcBounds.x1 <= renderWindow.x1 && renderWindow.x2 <= srcBounds.x2 &&
    //       srcBounds.y1 <= renderWindow.y1 && renderWindow.y2 <= srcBounds.y2);
    // dst must be valid over the renderWindow
    assert(dstPixelData &&
           dstBounds.x1 <= renderWindow.x1 && renderWindow.x2 <= dstBounds.x2 &&
           dstBounds.y1 <= renderWindow.y1 && renderWindow.y2 <= dstBounds.y2);
    // make sure bit depths are sane
    if(srcBitDepth != dstPixelDepth/* || srcPixelComponents != dstPixelComponents*/) {
        OFX::throwSuiteStatusException(kOfxStatErrFormat);
    }

    if (isEmpty(renderWindow)) {
        return;
    }
    bool doMasking = ((!_maskApply || _maskApply->getValueAtTime(time)) && _maskClip && _maskClip->isConnected());
    if (doMasking) {
        processor.doMasking(true);
        processor.setMaskImg(mask, maskInvert);
    }

    // set the images
    assert(dstPixelData);
    processor.setOrigImg(orig);
    processor.setDstImg(dstPixelData, dstBounds, dstPixelComponents, dstPixelComponentCount, dstPixelDepth, dstRowBytes);
    assert(0 <= srcBoundary && srcBoundary <= 2);
    processor.setSrcImg(srcPixelData, srcBounds, srcPixelComponents, srcPixelComponentCount, srcBitDepth, srcRowBytes, srcBoundary);

    // set the render window
    processor.setRenderWindow(renderWindow);

    processor.setPremultMaskMix(premult, premultChannel, mix);

    // Call the base class process member, this will call the derived templated process code
    processor.process();
}