Prima
view release on metacpan or search on metacpan
Prima/sys/FS.pm view on Meta::CPAN
} elsif ( $q =~ m/^~(\w*)(.*)/ ) {
my @pwent;
unless ( length $1 ) {
push @matches, ($ENV{HOME} // ($win32 ? $ENV{USERPROFILE} : undef) // '/' ) . $2;
} elsif (!$win32 && (@pwent = getpwnam($1)) && defined($pwent[7])) {
push @matches, $pwent[7] . $2;
}
} elsif ( $q =~ m/(?<!\\)\*|\?/ ) {
my @paths = ('');
my $expanded;
for my $subpath ( split m{(/)}, $q ) {
if ( !$expanded && $subpath =~ m/(?<!\\)\*|\?/ ) {
$subpath =~ s/(?<!\\)\*/.*/g;
$subpath =~ s/(?<!\\)\?/./g;
$subpath = qr/$subpath/;
next MATCH unless Prima::sys::FS::opendir( my $dh, length($paths[0]) ? $paths[0] : '.' );
my $opath = pop @paths;
for my $e ( Prima::sys::FS::readdir $dh ) {
next unless $e =~ /^$subpath$/;
push @paths, $opath . $e;
}
pod/Prima/Image.pod view on Meta::CPAN
=item transform matrix => [a,b,c,d,x,y], [ fill => color ]
Applies generic 2D transform matrix to the image, fills empty pixels with
optional fill color.
Required option C<matrix> should point to an array of 6 float numbers,
where these represent a standard 3x2 matrix for 2D transformation, f ex a
C<Prima::matrix> object.
Tries first to split matrix into series of shear and scale transforms using LDU
decomposition; if an interim image is calculated to be too large, fails and
returns C<false>.
The last two members (X and Y translation) only use mantissa and ignore the
rest, so setting them f ex to 10.5 will not produce an image 11 pixels larger,
but only 1. The translation is thus effectively sub-pixel.
Rotation matrices can be applied too, however, when angles are close to 90 and
270, either interim images become too big, or defects introduced by shearing
become too visible. Therefore the method specifically detects for rotation
( run in 2.326 seconds using v1.01-cache-2.11-cpan-71847e10f99 )