CAD-Drawing-IO-Image

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

	$build_class = $custom_build;
}

my $builder = $build_class->new(
	module_name         => 'CAD::Drawing::IO::Image',
	license             => 'perl',
	dist_version_from   => 'lib/CAD/Drawing/IO/Image.pm',
	requires => {
		'Test::More'    => 0,
		'CAD::Drawing'  => 0.26,
		'Image::Magick' => 6.0,
	},
	add_to_cleanup      => [ qw(CAD-Drawing-IO-Image-* META.yml)],
);

$builder->create_build_script();

META.yml  view on Meta::CPAN

name: CAD-Drawing-IO-Image
version: 0.02
author:
  - 'Eric L. Wilhelm <ewilhelm at cpan dot org>'
abstract: Output methods for images
license: perl
resources:
  license: http://dev.perl.org/licenses/
requires:
  CAD::Drawing: 0.26
  Image::Magick: 6
  Test::More: 0
provides:
  CAD::Drawing::IO::Image:
    file: lib/CAD/Drawing/IO/Image.pm
    version: 0.02
generated_by: Module::Build version 0.2704
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.2.html
  version: 1.2

lib/CAD/Drawing/IO/Image.pm  view on Meta::CPAN


use CAD::Drawing;
use CAD::Drawing::Defined;

use warnings;
use strict;

use Carp;
use UNIVERSAL qw(isa);

use Image::Magick;

########################################################################
=pod

=head1 NAME

CAD::Drawing::IO::Image - Output methods for images

=head1 AUTHOR

lib/CAD/Drawing/IO/Image.pm  view on Meta::CPAN

code.

Additionally, while the author is actively developing this code,
notification of any intended changes or extensions would be most helpful
in avoiding repeated work for all parties involved.  Please contact the
author with any such development plans.

=head1 SEE ALSO

  CAD::Drawing
  Image::Magick

=cut

########################################################################

=head1 Requisite Plug-in Functions

See CAD::Drawing::IO for a description of the plug-in architecture.

=cut

lib/CAD/Drawing/IO/Image.pm  view on Meta::CPAN

	if(isa($opt, 'HASH')) {
		%opts = %$opt;
	}
	else {
		$opt and croak("not a hash");
	}
	my $imwidth = $opts{width};
	my $imheight = $opts{height};
	(defined($imwidth) and defined($imheight)) or
		carp("can't save image without width and height\n");
	my $outobj = Image::Magick->new(size=>"${imwidth}x${imheight}");
	my $bgcolor = "white";
	my $defaultcolor = "black";
	if($opts{defaultcolor}) {
		$defaultcolor = $opts{defaultcolor};
	}
	# $CAD::Drawing::default_color{$self} = $defaultcolor; # XXX ?
	if($opts{bgcolor}) {
		$bgcolor = $opts{bgcolor};
	}
	$outobj->ReadImage("xc:$bgcolor");



( run in 0.483 second using v1.01-cache-2.11-cpan-beeb90c9504 )