| 1 | package Bio::Phylo::Treedrawer::Jpeg; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use Bio::Phylo::Util::Dependency 'Bio::Phylo::Treedrawer::Png'; | ||
| 5 | use Bio::Phylo::Util::Exceptions 'throw'; | ||
| 6 | use base 'Bio::Phylo::Treedrawer::Png'; | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Bio::Phylo::Treedrawer::Jpeg - Graphics format writer used by treedrawer, no | ||
| 11 | serviceable parts inside | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | This module creates a jpeg file from a Bio::Phylo::Forest::DrawTree | ||
| 16 | object. It is called by the L<Bio::Phylo::Treedrawer> object, so look there to | ||
| 17 | learn how to create tree drawings. | ||
| 18 | |||
| 19 | |||
| 20 | =begin comment | ||
| 21 | |||
| 22 | # only need to override finish to write to a different format | ||
| 23 | |||
| 24 | =end comment | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | sub _finish { | ||
| 29 | my $self = shift; | ||
| 30 | my $jpg; | ||
| 31 | eval { $jpg = $self->_downsample->jpeg }; | ||
| 32 | if ( not $@ ) { | ||
| 33 | return $jpg; | ||
| 34 | } | ||
| 35 | else { | ||
| 36 | throw 'ExtensionError' => | ||
| 37 | "Can't create JPEG, libgd probably not compiled with it"; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | =head1 SEE ALSO | ||
| 42 | |||
| 43 | There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo> | ||
| 44 | for any user or developer questions and discussions. | ||
| 45 | |||
| 46 | =over | ||
| 47 | |||
| 48 | =item L<Bio::Phylo::Treedrawer> | ||
| 49 | |||
| 50 | The jpeg treedrawer is called by the L<Bio::Phylo::Treedrawer> object. Look there | ||
| 51 | to learn how to create tree drawings. | ||
| 52 | |||
| 53 | =item L<Bio::Phylo::Manual> | ||
| 54 | |||
| 55 | Also see the manual: L<Bio::Phylo::Manual> and L<http://rutgervos.blogspot.com>. | ||
| 56 | |||
| 57 | =back | ||
| 58 | |||
| 59 | =head1 CITATION | ||
| 60 | |||
| 61 | If you use Bio::Phylo in published research, please cite it: | ||
| 62 | |||
| 63 | B<Rutger A Vos>, B<Jason Caravas>, B<Klaas Hartmann>, B<Mark A Jensen> | ||
| 64 | and B<Chase Miller>, 2011. Bio::Phylo - phyloinformatic analysis using Perl. | ||
| 65 | I<BMC Bioinformatics> B<12>:63. | ||
| 66 | L<http://dx.doi.org/10.1186/1471-2105-12-63> | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | 1; |