I am looking into migrating to wxPerl for doing some GUI work, and I've come across a problem working with bitmaps, specifically scaling them. Most examples use the Wx::Image->Scale->ConvertToBitmap() methodology, but the ConvertToBitmap routine is no longer in the wxPerl package.
In the wxWidgets documentation, reference is made to using the wxBitmap constructor in place of ConvertToBitmap, but it isn't clear that wxPerl has implemented that constructor. The following code shows a simplified version of what I am trying to do:
use Wx;
package MyApp;
use strict;
use vars qw(@ISA);
@ISA = qw(Wx::App);
sub OnInit {
my( $this ) = @_;
my( $frame ) = MyFrame->new( undef, -1, "Image Resize",
[100, 100], [450, 300] );
$frame->Show( 1 );
return 1;
}
package MyFrame;
use strict;
use vars qw(@ISA);
use Wx qw(wxBITMAP_TYPE_BMP);
@ISA = qw(Wx::Frame);
sub new {
my $class = shift;
my $this = $class->SUPER::new(@_);
my $image = Wx::Image->new('print.bmp',wxBITMAP_TYPE_BMP)->Scale(3
+2,32);
# my $bmp = $image->ConvertToBitmap(); old way, no longer supporte
+d
my $bmp = ???;
$this->{ImageViewer}= Wx::StaticBitmap->new($this, -1, $bmp);
$this;
}
package main;
my $app = MyApp->new();
$app->MainLoop();
So my question is what to put in place of the ??? to get a bitmap, which can be used in StaticBitmap, from the scaled image.
Thanks,
Jon
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.