AAC-Pvoice

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        * no longer uses too large images (screensizing update)
    AAC::Pvoice::EditableRow
        * no longer uses too large images (screensizing update)

0.8 AAC::Pvoice::Input
        * when keystrokes are used, alpha keys are now case-insensitive
    Several bugfixes and therefore needed new methods (for most of you
    probably not that important)

0.9 AAC::Pvoice::Bitmap
        * We now use Image::Magick to create the bitmaps. It's a change to
          the internals, so the methods and their parameters stay the same.
        * Returned images are cached first (using File::Cache). If an image
          has been processed before, it will be retrieved from the cache.
          The cache never expires, but every combination of parameters
          results in a new cached image (and of course the file modificationtime
          of the image is also taken into account.
    AAC::Pvoice::Dialog
        * This is a newly added class. It's a subclass of Wx::Dialog and
          allows you to create dialog boxes, using an AAC::Pvoice::Panel
    AAC::Pvoice

META.yml  view on Meta::CPAN

name:         AAC-Pvoice
version:      0.91
version_from: lib/AAC/Pvoice.pm
installdirs:  site
requires:
    Device::ParallelPort:          0
    Device::ParallelPort::drv::win32: 0
    File::Cache:                   0
    File::stat:                    0
    File::Temp:                    0
    Image::Magick:                 6
    IO::Scalar:                    0
    Text::Wrap:                    0
    Wx:                            0.15

distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17

Makefile.PL  view on Meta::CPAN

{
    $pdrv = Device::ParallelPort::drv::parport;
}

WriteMakefile(
    NAME         => 'AAC::Pvoice',
    VERSION_FROM => 'lib/AAC/Pvoice.pm', # finds $VERSION
    AUTHOR       => 'Jouke Visser <jouke@cpan.org>',
    ABSTRACT_FROM=> 'lib/AAC/Pvoice.pm',
    PREREQ_PM    => {   Wx                      => 0.15,
                        Image::Magick           => 6.0,
                        Device::ParallelPort    => 0,
                        $pdrv                   => 0,
                        IO::Scalar              => 0,
                        File::Cache             => 0,
                        File::stat              => 0,
                        File::Temp              => 0,
                        Text::Wrap              => 0,
                        }
);

README  view on Meta::CPAN


As of version 0.5, these modules should be able to run on all platforms
supported by Device::ParallelPort. This dependency has to do with AAC::Pvoice::Input, which
needs to be able to poll the parallel port in case it needs to communicate
with the 'Adremo' electrical wheelchair. For this I'm  using
Device::ParallelPort, which has drivers for Linux and Win32.

As of version 0.6 the modules allow you to use your application in
One or Two-button mode. See the documentation of AAC::Pvoice::Input for details.

As of version 0.9 you need Image::Magick.

At the very least you should be able to use this set of instructions
to install the module...

perl Makefile.PL
make
make test
make install

If you are on a windows box you should use 'nmake' rather than 'make'.

lib/AAC/Pvoice/Bitmap.pm  view on Meta::CPAN

package AAC::Pvoice::Bitmap;

use strict;
use warnings;
use Wx qw(:everything);
use Wx::Perl::Carp;
use Image::Magick;
use IO::Scalar;
use File::Cache;
use File::stat;
use File::Temp qw( :POSIX );

our $VERSION     = sprintf("%d.%02d", q$Revision: 1.12 $=~/(\d+)\.(\d+)/);

use base qw(Wx::Bitmap);
our $cache;
BEGIN

lib/AAC/Pvoice/Bitmap.pm  view on Meta::CPAN

    my $image = $cache->get("$file-$x-$y-$caption-$ibg-$blowup-$pbg-$mtime");
    if (!$image)
    {
    	my $radius = 10;
    	my $svg = <<SVG;
<svg width="$x" height="$y" viewBox="0 0 $x $y">
   <rect x="0" y="0" width="$x" height="$y" ry="$radius"
       style="stroke: none; fill: $ibg;"/>
</svg>
SVG
    	my $background=Image::Magick->new(magick => 'svg');
    	$background->Set('background' => $pbg);
    	$background->blobtoimage($svg);
        
    	my ($textheight, $textwidth) = (0,0);
    	if ($caption)
    	{
    	    my $pt = 20;
    	    do {
    		(undef, undef, undef, undef, $textwidth, $textheight, undef) =
    		    $background->QueryFontMetrics(text => $caption, font => 'Comic-Sans-MS', pointsize => $pt, gravity => 'South');
    		    $pt--;
    		} until ($textwidth < $x) && ($textheight < $y/5);
    	    $background->Annotate(text => $caption, font => 'Comic-Sans-MS', pointsize => $pt, gravity => 'South');
    	}
        
    	# Read the actual image
    	my $img = Image::Magick->new;
        
    	my $rc = $img->Read($file);
    	carp "Can't read $file: $rc" if $rc;
        # wmf files have a white background color by default
        # if we can't get the matte color for the image, we assume
        # that white can be used as the transparent color...
    	$img->Transparent(color => 'white') if (!$img->Get('matte') || $file =~ /wmf$/i);
    	my $w = $img->Get('width');
    	my $h = $img->Get('height');
    	my $ch = $textheight;



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