bool rimginterface::Insert( const tImgViewPlanar& aoi, tImgPlanar& target, int32_xy xy ) { assert( target.equals_size_mask( aoi ) ); // test if target position is in img if( xy.x() > static_cast<int>(target.sx()) - 1 || xy.y() > static_cast<int>(target.sy()) - 1 ) { return false; } uint32_xy xxyy( xy.x(), xy.y() ); uint32_xy aoi_ = aoi.size(); uint32_xy result = aoi_ + xxyy; int32_xy aoimax = int32_xy( result.x(), result.y() ); if( aoimax.x() <= 0 && aoimax.y() <= 0 ) { return false; } if( aoimax.x() > static_cast<int>(target.sx()) && aoimax.y() > static_cast<int>(target.sy()) ) { return false; } uint32_xy saoi = aoi.size(); uint32_xy so = target.size(); auto maoibegin = aoi.begin(); auto maoiend = aoi.end(); auto out = target.begin(); uint32_xy size( aoi.size() ); while( maoibegin != maoiend ) { insert::Insert( maoibegin->plane, out->plane, xy, size ); ++maoibegin; ++out; } return true; }
int main(int argc, char** argv) { printf("xx1=%d, xx2=%d, xxa[5]=%d, a[5]=%d, xxyy()=%d\n", xx1, xx2, xxa[5], a[5], xxyy()); }