Skip to content

clip_regionClipRegionClipRegionclip_regionclip_region🔗

Short description🔗

clip_regionClipRegionClipRegionclip_regionclip_region — Clip a region to a rectangle.

Signature🔗

clip_region( region Region, out region RegionClipped, rectangle.origin.y Row1, rectangle.origin.x Column1, rectangle.corner.y Row2, rectangle.corner.x Column2 )void ClipRegion( const HObject& Region, HObject* RegionClipped, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2 )static void HOperatorSet.ClipRegion( HObject region, out HObject regionClipped, HTuple row1, HTuple column1, HTuple row2, HTuple column2 )def clip_region( region: HObject, row_1: int, column_1: int, row_2: int, column_2: int ) -> HObject

Herror clip_region( const Hobject Region, Hobject* RegionClipped, const Hlong Row1, const Hlong Column1, const Hlong Row2, const Hlong Column2 )

Herror T_clip_region( const Hobject Region, Hobject* RegionClipped, const Htuple Row1, const Htuple Column1, const Htuple Row2, const Htuple Column2 )

HRegion HRegion::ClipRegion( Hlong Row1, Hlong Column1, Hlong Row2, Hlong Column2 ) const

HRegion HRegion.ClipRegion( int row1, int column1, int row2, int column2 )

Description🔗

clip_regionClipRegion clips the input regions to the rectangle given by the four control parameters. clip_regionClipRegion is more efficient than calling intersectionIntersection with a rectangle generated by gen_rectangle1GenRectangle1.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

Parameters🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Region to be clipped.

RegionClippedregionClippedregion_clipped (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

Clipped regions.

Row1row1row_1 (input_control) rectangle.origin.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Row coordinate of the upper left corner of the rectangle.

Default: 00
Suggested values: 0, 128, 200, 2560, 128, 200, 256
Value range: Row1 (lin)

Column1column1column_1 (input_control) rectangle.origin.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Column coordinate of the upper left corner of the rectangle.

Default: 00
Suggested values: 0, 128, 200, 2560, 128, 200, 256
Value range: Column1 (lin)

Row2row2row_2 (input_control) rectangle.corner.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Row coordinate of the lower right corner of the rectangle.

Default: 256256
Suggested values: 128, 200, 256, 512128, 200, 256, 512
Value range: 0 ≤ Row2 ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 10

Column2column2column_2 (input_control) rectangle.corner.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Column coordinate of the lower right corner of the rectangle.

Default: 256256
Suggested values: 128, 200, 256, 512128, 200, 256, 512
Value range: 0 ≤ Column2 ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 10

Result🔗

clip_regionClipRegion returns 2 (H_MSG_TRUE) if all parameters are correct. The behavior in case of empty input (no regions given) can be set via set_system('no_object_result',<Result>) and the behavior in case of an empty input region via set_system('empty_region_result',<Result>). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, connectionConnection, regiongrowingRegiongrowing, pouringPouring

Possible successors

select_shapeSelectShape, disp_regionDispRegion

Alternatives

intersectionIntersection, gen_rectangle1GenRectangle1, clip_region_relClipRegionRel

Module🔗

Foundation