Ejemplo n.º 1
0
GIL_FORCEINLINE F transform_pixels_locator(const View1& src1, const Rect<std::ptrdiff_t>& src1Rod, const View2& src2,
                                           const Rect<std::ptrdiff_t>& src2Rod, const View2& src3,
                                           const Rect<std::ptrdiff_t>& src3Rod, const ViewDst& dst,
                                           const Rect<std::ptrdiff_t>& dstRod, const Rect<std::ptrdiff_t>& renderWin,
                                           const F& fun)
{
    const std::ptrdiff_t renderWidth = renderWin.x2 - renderWin.x1;
    typename View1::xy_locator s1loc = src1.xy_at(renderWin.x1 - src1Rod.x1, renderWin.y1 - src1Rod.y1);
    typename View2::xy_locator s2loc = src2.xy_at(renderWin.x1 - src2Rod.x1, renderWin.y1 - src2Rod.y1);
    typename View3::xy_locator s3loc = src3.xy_at(renderWin.x1 - src3Rod.x1, renderWin.y1 - src3Rod.y1);
    for(std::ptrdiff_t y = renderWin.y1; y < renderWin.y2; ++y)
    {
        typename ViewDst::x_iterator dstIt = dst.x_at(dstRod.x1, y - dstRod.y1);
        for(std::ptrdiff_t x = renderWin.x1; x < renderWin.x2; ++x, ++s1loc.x(), ++s2loc.x(), ++s3loc.x(), ++dstIt)
        {
            *dstIt = fun(s1loc, s2loc, s3loc);
        }
        s1loc.x() -= renderWidth;
        ++s1loc.y();
        s2loc.x() -= renderWidth;
        ++s2loc.y();
        s3loc.x() -= renderWidth;
        ++s3loc.y();
    }
    return fun;
}
Ejemplo n.º 2
0
GIL_FORCEINLINE
F transform_pixels_locator_progress( const View1& src1, const OfxRectI& src1Rod,
									 const View2& src2, const OfxRectI& src2Rod,
									 const ViewDst& dst, const OfxRectI& dstRod,
									 const OfxRectI& renderWin, const F& fun, IProgress& p )
{
	const std::ptrdiff_t renderWidth = renderWin.x2 - renderWin.x1;
	typename View1::xy_locator s1loc = src1.xy_at( renderWin.x1-src1Rod.x1, renderWin.y1-src1Rod.y1 );
	typename View2::xy_locator s2loc = src2.xy_at( renderWin.x1-src2Rod.x1, renderWin.y1-src2Rod.y1 );
	for( std::ptrdiff_t y = renderWin.y1; y < renderWin.y2; ++y )
	{
		typename ViewDst::x_iterator dstIt = dst.x_at( dstRod.x1, y-dstRod.y1 );
		for( std::ptrdiff_t x = renderWin.x1;
		     x < renderWin.x2;
		     ++x, ++s1loc.x(), ++s2loc.x(), ++dstIt )
		{
			*dstIt = fun( s1loc, s2loc );
		}
		s1loc.x() -= renderWidth; ++s1loc.y();
		s2loc.x() -= renderWidth; ++s2loc.y();
		if( p.progressForward( renderWidth ) )
			return fun;
	}
	return fun;
}