The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Prima::IPA::Region - region data structures

DESCRIPTION

A contour is a 8-connected point set that is returned by Prima::IPA::Global::identify_contours function. A region is a set of horizontal lines, describing an 2D area. The contour2region function converts contour output of Prima::IPA::Global::identify_contours and Prima::IPA::Global::identify_scanlines to a region and returns the region array and its starting y-position. The contour has to contain no less that 2 unique points. The ultimate requirement is that all points have to be 8-connected and the contour contains no holes.

Example:

          3.3                3.3-3.3
      2.2     4.2   ->    2.2-------4.2
  1.1 2.1 3.1 4.1      1.1----------4.1

      contour                region

The module provides various manipluation routines for these regions.

API

contour2region CONTOUR

Converts output of Prima::IPA::Global::identify_contours to a region.

scanlines2region CONTOUR

Converts output of Prima::IPA::Global::identify_scanlines to a region.

draw DRAWABLE, REGION, OFFSET_X, OFFSET_Y

Plots REGION onto DRAWABLE with OFFSET_X and OFFSET_Y

plot DRAWABLE, REGION, OFFSET_X, OFFSET_Y

Same as draw but optimized for speed, and DRAWABLE must be an image.

outline DRAWABLE, REGION, OFFSET_X, OFFSET_Y

Draws outline of REGION onto DRAWABLE with OFFSET_X and OFFSET_Y

combine REGION_1, REGION_2, OP = 'and'

Combines two regions, REGION_1 and REGION_2, with logic operation, which can be one of 'and', 'or', and 'xor' strings, and returns the result.

calc_extents REGION

Recalculates extensions of REGION and returns adjusted alias of REGION.

alias REGION

Returns shallow copy of REGION

copy REGION

Returns deep copy of REGION

move REGION, OFFSET_X, OFFSET_Y

Shifts REGION by OFFSET_X and OFFSET_Y

area REGION

Returns area occupied by a region

SEE ALSO

"identify_contours" in Prima::IPA::Global, "identify_scanlines" in Prima::IPA::Global