Intertangle-Yarn

 view release on metacpan or  search on metacpan

lib/Intertangle/Yarn/Types.pm  view on Meta::CPAN

use Modern::Perl;
package Intertangle::Yarn::Types;
# ABSTRACT: Types for Yarn
$Intertangle::Yarn::Types::VERSION = '0.002';
use Type::Library 0.008 -base,
	-declare => [qw(
		Point
		Vec2
		Size
		AngleDegrees
		Rect
		Matrix
	)];
use Type::Utils -all;
use Types::Standard qw(Tuple Num);
use Types::Common::Numeric qw(PositiveOrZeroNum);

use Intertangle::Yarn::Graphene;

class_type "Point",
	{ class => 'Intertangle::Yarn::Graphene::Point' };

coerce "Point",
	from Tuple[Num, Num],
	via {
		Intertangle::Yarn::Graphene::Point->new(
			x => $_->[0],
			y => $_->[1],
		)
	};

class_type "Vec2",
	{ class => 'Intertangle::Yarn::Graphene::Vec2' };

coerce "Vec2",
	from Tuple[Num, Num],
	via {
		Intertangle::Yarn::Graphene::Vec2->new(
			x => $_->[0],
			y => $_->[1],
		)
	};

class_type "Size",
	{ class => 'Intertangle::Yarn::Graphene::Size' };

coerce "Size",
	from Tuple[PositiveOrZeroNum, PositiveOrZeroNum],
	via {
		Intertangle::Yarn::Graphene::Size->new(
			width  => $_->[0],
			height => $_->[1],
		)
	};

declare "AngleDegrees", parent => Num;

class_type "Rect",
	{ class => 'Intertangle::Yarn::Graphene::Rect' };

class_type "Matrix",



( run in 1.057 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )