TuttleOFX  1
terry::filter::floodFill Namespace Reference

Data Structures

struct  Connexity4
struct  Connexity8
struct  IsUpper
struct  FloodElement
 A range of pixels in a line to propagate. More...

Enumerations

enum  EDirection { eDirectionAbove = 0, eDirectionBellow = 1 }

Functions

template<class SIterator , class DIterator , class DPixel , class Test >
GIL_FORCEINLINE void fill_pixels_range_if (SIterator srcBegin, const SIterator &srcEnd, DIterator dstBegin, const DPixel &value, const Test &condition)
 fill all pixels respecting the condition in a range of pixels (on the same line or with an 1d_traversable image).
GIL_FORCEINLINE EDirection invertDirection (const EDirection d)
template<class Connexity , class StrongTest , class SoftTest , class SView , class DView , template< class > class Allocator>
void flood_fill (const SView &srcView, const Rect< std::ssize_t > &srcRod, DView &dstView, const Rect< std::ssize_t > &dstRod, const Rect< std::ssize_t > &procWindow, const StrongTest &strongTest, const SoftTest &softTest)
 Flood fill an image, with 2 conditions. Fill all pixels respecting the soft condition if connected with a pixel respecting the strong condition.
template<class StrongTest , class SoftTest , class SView , class DView >
void flood_fill_bruteForce (const SView &srcView, const Rect< std::ssize_t > &srcRod, DView &dstView, const Rect< std::ssize_t > &dstRod, const Rect< std::ssize_t > &procWindow, const StrongTest &strongTest, const SoftTest &softTest)
 Simplest implementation of flood fill algorithm.

Enumeration Type Documentation

Enumerator:
eDirectionAbove 
eDirectionBellow 

Definition at line 73 of file floodFill.hpp.


Function Documentation

template<class SIterator , class DIterator , class DPixel , class Test >
GIL_FORCEINLINE void terry::filter::floodFill::fill_pixels_range_if ( SIterator  srcBegin,
const SIterator &  srcEnd,
DIterator  dstBegin,
const DPixel &  value,
const Test &  condition 
)

fill all pixels respecting the condition in a range of pixels (on the same line or with an 1d_traversable image).

Definition at line 25 of file floodFill.hpp.

Referenced by flood_fill().

template<class Connexity , class StrongTest , class SoftTest , class SView , class DView , template< class > class Allocator>
void terry::filter::floodFill::flood_fill ( const SView &  srcView,
const Rect< std::ssize_t > &  srcRod,
DView &  dstView,
const Rect< std::ssize_t > &  dstRod,
const Rect< std::ssize_t > &  procWindow,
const StrongTest &  strongTest,
const SoftTest &  softTest 
)

Flood fill an image, with 2 conditions. Fill all pixels respecting the soft condition if connected with a pixel respecting the strong condition.

Parameters:
[in]srcViewinput image
[in]srcRodinput image ROD
[out]dstViewinput image
[in]dstRodoutput image ROD
[in]procWindowregion to process
[in]strongConditionfunctor with the strong test
[in]softConditionfunctor with the soft test
Remarks:
Implementation is based on standard filling algorithms. So we use ranges by line (x axis), and check connections between these x ranges and possible x ranges in the above or bellow lines.

Definition at line 121 of file floodFill.hpp.

References eDirectionAbove, eDirectionBellow, terry::draw::fill_pixels_range(), fill_pixels_range_if(), invertDirection(), terry::rectanglesIntersection(), terry::Rect< T >::x1, terry::Rect< T >::x2, terry::Rect< T >::y1, and terry::Rect< T >::y2.

Here is the call graph for this function:

template<class StrongTest , class SoftTest , class SView , class DView >
void terry::filter::floodFill::flood_fill_bruteForce ( const SView &  srcView,
const Rect< std::ssize_t > &  srcRod,
DView &  dstView,
const Rect< std::ssize_t > &  dstRod,
const Rect< std::ssize_t > &  procWindow,
const StrongTest &  strongTest,
const SoftTest &  softTest 
)

Simplest implementation of flood fill algorithm.

See also:
flood_fill, faster implementation of the same algorithm
Remarks:
not in production (only use for debugging)

<

Todo:
tuttle: use host allocator

Definition at line 490 of file floodFill.hpp.

References tuttle::plugin::merge::copy_pixels(), terry::max_value(), terry::pointInRect(), terry::rectangleReduce(), terry::subimage_view(), terry::translateRegion(), terry::Rect< T >::x1, terry::Rect< T >::x2, terry::Rect< T >::y1, and terry::Rect< T >::y2.

Here is the call graph for this function:

GIL_FORCEINLINE EDirection terry::filter::floodFill::invertDirection ( const EDirection  d)

Definition at line 80 of file floodFill.hpp.

References eDirectionAbove, and eDirectionBellow.

Referenced by flood_fill().