pod::Prima::Region(3)
π NAME π
pod::Prima::Region(3) β Prima::Region β generic shapes for clipping and hit testing, from the User Contributed Perl Documentation, bestie π
β¨
β¨ SYNOPSIS β¨
Okay so here's the group-chat recap of how you actually use this thing π«Ά:
$empty = Prima::Region->new;
$rect = Prima::Region->new( rect => [ 10, 10, 20, 20 ]);
$rect = Prima::Region->new( box => [ 10, 10, 10, 10 ]); # same
$poly = Prima::Region->new( polygon => [ 0, 0, 100, 0, 100, 100 ]);
$bits = Prima::Region->new( image => $image );
$drawable-> region( $rect );
my $rgn = $drawable->region;
$rgn->image->save('region.png') if $rgn;
πΈ DESCRIPTION πΈ
Prima::Region is a descendant of the Prima::Component class, no cap. A Prima::Region object is literally a representation of a generic shape that can be applied to a drawable and checked to see whether points are within its boundaries. Iconic.
π API π
Here's the whole menu, bestie β every method, every option, every little detail π
new %OPTIONSβ Creates a new region object. If called without any options, the resulting region will be empty. The following options can be used:rect => [ X1, Y1, X2, Y2 ]β Creates a rectangular region with inclusive-inclusive coordinates.box => [ X, Y, WIDTH, HEIGHT ]β Same asrectbut using the box semantics.polygon => \@POINTS, fillMode = 0β Creates a polygon shape with vertices given in@POINTS, and using the optionalfillMode(see"fillMode"inDrawable).image => IMAGEβ Creates a region from a 1-bit image. If the image contains no pixels that are set to1, the resulting region is created as an empty region.
bitmap with_offset => 0, type => dbt::Bitmapβ Paints the region on a newly created bitmap and returns it. By default, the region offset is not included.boxβ Returns the(X,Y,WIDTH,HEIGHT)bounding box that encloses the smallest possible rectangle, or(0,0,0,0)if the region is empty.combine REGION, OPERATION = rgnop::Copyβ Applies one of the following set operations to the region:rgnop::Copyβ Makes a copy of theREGION.rgnop::Intersectβ The resulting region is an intersection of the two regions.rgnop::Unionβ The resulting region is a union of the two regions.rgnop::Xorβ Performs XOR operation on the two regions.rgnop::Diffβ The resulting region is a difference between the two regions.
dupβ Creates a duplicate region object.get_boxesβ Returns aPrima::arrayobject filled with 4-integer tuples, where each is a box defined as a(x,y,width,height)tuple.get_handleβ Returns the system handle for the region.equals REGIONβ Returns true if the regions are equal, false otherwise.image with_offset => 0, type => dbt::Bitmapβ Paints the region on a newly created image and returns it. By default, the region offset is not included.is_emptyβ Returns true if the region is empty, false otherwise.offset DX, DYβ Shifts the region vertically and/or horizontally.point_inside X, Yβ Returns true if the(X,Y)point is inside the region.rect_inside X1,Y1,X2,Y2β Checks whether a rectangle given by the inclusive-inclusive coordinates is inside, outside, or partially covered by the region. The return value can be one of these flags:rgn::Insidergn::Outsidergn::Partially
where the rgn::Outside constant has the value of 0.
π«Ά AUTHOR π«Ά
Dmitry Karasik, <dmitry@karasik.eu.org>. β author credit, slay π
π¦ SEE ALSO π¦
Go check out Prima, Prima::Drawable, and Prima::Drawable::Path β bestie homework, iykyk π¦β¨
That's the whole thing, bestie! The source/version footer says perl v5.42.0, dated 2024-08-20, and the page is pod::Prima::Region(3) β now go make some iconic regions π
π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms