Image::Base::Wx::Bitmap -- draw into a Wx::Bitmap
use Image::Base::Wx::Bitmap; my $image = Image::Base::Wx::Bitmap->new (-wxbitmap => $wxbitmap); $image->line (0,0, 99,99, '#FF00FF'); $image->rectangle (10,10, 20,15, 'white');
Image::Base::Wx::Bitmap is a subclass of
Image::Base Image::Base::Wx::DC Image::Base::Wx::Bitmap
Image::Base to draw into a
Wx::Bitmap is a platform-dependent colour image with a specified bits-per-pixel depth. The supported depths depend on the platform but include at least the screen depth and 1-bit monochrome.
Drawing is done with a wxMemoryDC as per the
Image::Base::Wx::DC. This subclass adds file load and save for the
The file formats supported in Wx 2.8 include the following, perhaps depending which supporting libraries it was built with.
BMP always available PNG JPEG GIF load-only PCX PNM TIFF TGA load-only IFF load-only XPM ICO CUR ANI load-only
load() detects the format, but a handler for the format must have been registered globally. All formats can be registered with
This is suggested since otherwise load XPM seems to behave as an "ANY" which might trick the detection attempts. The
Wx::Image handlers are used by
Wx::Bitmap so registering desired formats there might be enough.
Colour names are anything recognised by
Wx::Colour->new(), as described in "Colour Names" in Image::Base::Wx::DC.
See "FUNCTIONS" in Image::Base for behaviour common to all Image-Base classes.
$image = Image::Base::Wx::Bitmap->new (key=>value,...)
Create and return a new image object. It can read a file,
$image = Image::Base::Wx::Bitmap->new (-file => '/my/file/name.bmp');
Or create a new bitmap with width and height. The default
-depth is the bits-per-pixel of the screen, or something else can be given.
$image = Image::Base::Wx::Bitmap->new (-width => 200, -height => 100, -depth => 1); # monochrome
Or a new image can be pointed at an existing
my $wxbitmap = Wx::Bitmap->new (200, 100); my $image = Image::Base::Wx::Bitmap->new (-wxbitmap => $wxbitmap);
Further parameters are applied per
set (see "ATTRIBUTES" below).
The target bitmap object.
Wx::DC used to draw into the bitmap. A suitable DC is created for the bitmap automatically, but it can be set explicitly if desired.
-file_format(string, default undef)
The file format from the last
load() and the format to use in
save(). This is one of the
wxBITMAP_TYPE_XXX names such as "PNG" or "JPEG".
The size of the bitmap, per
$wxbitmap->GetHeight(). Currently these are read-only. Can a bitmap be resized dynamically?
The number of bits per pixel in the bitmap, per
$wxbitmap->GetDepth(). Currently this is read-only. Can a bitmap be reformatted dynamically?
Wx circa 2.8.12 on Gtk prints
g_log() warnings on attempting to load an unknown file format, including an empty file or garbage. This is apparently from attempting it as an XPM. Is that a Wx bug?
Copyright 2012 Kevin Ryde
Image-Base-Wx is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Image-Base-Wx is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Image-Base-Wx. If not, see <http://www.gnu.org/licenses/>.