View on
Jouke Visser > AAC-Pvoice-0.91 > AAC::Pvoice::Bitmap



Annotate this POD


Open  0
View/Report Bugs
Module Version: 1.12   Source  


AAC::Pvoice::Bitmap - Easily create resized bitmaps with options


  use AAC::Pvoice::Bitmap;
  my $bitmap = AAC::Pvoice::Bitmap->new('image.jpg',        #image
                                        100,                #maxX
                                        100,                #maxY
                                        'This is my image', #caption
                                        wxWHITE,            #background
                                        1);                 #blowup?


This module is a simpler interface to the Wx::Bitmap to do things with images that I tend to do with almost every image I use in pVoice applications.

It's a subclass of Wx::Bitmap, so you can call any method that a Wx::Bitmap can handle on the resulting AAC::Pvoice::Bitmap.


new(image, maxX, maxY, caption, background, blowup, parentbackground)

This constructor returns a bitmap (useable as a normal Wx::Bitmap), that has a size of maxX x maxY, the image drawn into it as large as possible. If blowup has a true value, it will enlarge the image to try and match the maxX and maxY. Any space not filled by the image will be the specified background colour. A caption can be specified to draw under the image.

If the image doesn't exist, it will draw a large questionmark and warn the user.


This is the path to the image you want to have.

maxX, maxY

These are the maximum X and Y size of the resulting image. If the original image is larger, it will be resized (maintaining the aspect ratio) to match these values as closely as possible. If the 'blowup' parameter is set to a true value, it will also enlarge images that are smaller than maxX and maxY to get the largest possible image within these maximum values.


This is an optional caption below the image. The caption's font is Comic Sans MS and will have a pointsize that will make the caption fit within the maxX of the image. The resulting height of the caption is subtracted from the maxY


This is the background of the image, specified as either a constant (i.e. wxWHITE) or as an arrayref of RGB colours (like [128,150,201] ).


This boolean parameter determines whether or not images that are smaller than maxX and maxY should be blown up to be as large as possible within the given maxX and maxY.


This is the background of the parent of this bitmap, which is the colour to be used outside of the round cornered background.


probably a lot, patches welcome!


        Jouke Visser


This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.


perl(1), Wx

syntax highlighting: