FigAnim
view release on metacpan or search on metacpan
$self->{title} = "";
# header
$self->{version} = undef;
$self->{orientation} = undef;
$self->{justification} = undef;
$self->{units} = undef;
$self->{papersize} = undef;
$self->{magnification} = undef;
$self->{multiple_page} = undef;
$self->{transparent_color} = undef;
$self->{resolution} = undef;
$self->{coord_system} = undef;
# array containing the Color objects
$self->{colors} = [];
# arrays containing every object's name classified by type
$self->{arcs} = [];
$self->{compounds} = [];
$self->{ellipses} = [];
return $self;
}
# methods
sub clone {
my $self = shift;
my $obj = new FigAnim;
foreach ('title','version','orientation','justification','units',
'papersize','magnification','multiple_page','transparent_color',
'resolution','coord_system','arcs','compounds','ellipses',
'polylines','splines','texts') {
$obj->{$_} = $self->{$_};
}
foreach (@{$self->{colors}}) {
push @{$obj->{colors}}, $_->clone();
}
foreach (keys %{$self->{objects}}) {
my $line = <$fh>;
return unless ($line =~ /^\#FIG (\d(.\d)*)\n$/);
$self->{version} = $1;
$self->{orientation} = nextline($fh);
$self->{justification} = nextline($fh);
$self->{units} = nextline($fh);
$self->{papersize} = nextline($fh);
$self->{magnification} = nextline($fh);
$self->{multiple_page} = nextline($fh);
$self->{transparent_color} = nextline($fh);
while (($line = nextline($fh)) =~ /^\# /) {
$line =~ s/\# //;
$self->{title} .= $line . "\n";
}
($self->{resolution}, $self->{coord_system}) = split / /, $line;
}
sub parseObjects {
my $self = shift;
my $fh = shift;
my $self = shift;
my $fh = shift;
printf $fh "#FIG %s\n", $self->{version};
printf $fh "%s\n", $self->{orientation};
printf $fh "%s\n", $self->{justification};
printf $fh "%s\n", $self->{units};
printf $fh "%s\n", $self->{papersize};
printf $fh "%.2f\n", $self->{magnification};
printf $fh "%s\n", $self->{multiple_page};
printf $fh "%d\n", $self->{transparent_color};
if ($self->{title} ne "") {
foreach (split(/\n/, $self->{title})) {
printf $fh "# $_\n";
}
}
printf $fh "%d %d\n", $self->{resolution}, $self->{coord_system};
}
sub writeObjects {
my $self = shift;
( run in 0.310 second using v1.01-cache-2.11-cpan-0a6323c29d9 )