Image::Base::Wx::DC -- draw into a Wx::DC
use Image::Base::Wx::DC; my $image = Image::Base::Wx::DC->new (-dc => $dc); $image->line (0,0, 99,99, '#FF00FF'); $image->rectangle (10,10, 20,15, 'white');
Image::Base::Wx::DC is a subclass of Image::Base,
Image::Base::Wx::DC
Image::Base
Image::Base Image::Base::Wx::DC
Image::Base::Wx::DC extends Image::Base to draw into a Wx::DC.
Wx::DC
Native Wx::DC does much more than Image::Base but if you have some generic pixel twiddling code for Image::Base then this class can point it at Wx for a window or printer paint, etc.
See Image::Base::Wx::Bitmap for a subclass drawing into Wx::Bitmap with file loading and saving too.
Image::Base::Wx::Bitmap
Wx::Bitmap
Colour names are anything recognised by Wx::Colour->new(), which as per its Set() method means
Wx::Colour->new()
Set()
"pink" names per wxColourDatabase "#RRGGBB" 2 digit hex "RGB(r,g,b)" decimal 0 to 255
1, 3 or 4 digit hex are platform dependent. They work under Gtk, but not under MS-Windows.
The colour is applied to the "pen" in the -dc, and for filling to the "brush" too. The pen is also set to wxCAP_PROJECTING to ensure the last pixel is drawn for line(). That might be an artifact of the X11 pixel rule "on the boundary above or left", but in any case gets the right effect.
-dc
wxCAP_PROJECTING
line()
If the colour etc in the -dc is changed elsewhere then what Image::Base::Wx::DC thinks it has set will be invalid. Set -dc into the $image again to reset.
$image
See "FUNCTIONS" in Image::Base for the behaviour common to all Image-Base classes.
$image = Image::Base::Wx::DC->new (key=>value,...)
Create and return a new image object. A -dc parameter must be given,
$image = Image::Base::Wx::DC->new (-dc => $dc);
Further parameters are applied per set (see "ATTRIBUTES" below).
set
$image->xy ($x, $y, $colour)
Get or set the pixel at $x,$y.
$x
$y
Getting a pixel is per Wx::DC GetPixel(). In the current code colours are returned in "#RRGGBB" form (wxC2S_HTML_SYNTAX of Wx::Colour).
GetPixel()
wxC2S_HTML_SYNTAX
Wx::Colour
The target dc.
-width
-height
The size of the DC's target, as per $dc->GetSize().
$dc->GetSize()
Wx circa 3.0.4, with Gtk at least, may have line and point fuzzing turned on by default. The effect is that individual pixels, and corners of rectangles, do not get the colour you say, but are blurred into the existing background. That sort of thing can be desirable for circles or sloping lines, but not for rectangles and pixels. Wx::Image drawing is precise so you can draw that way for full control.
Wx::Image
Wx, Image::Base, Image::Base::Wx::Image
http://user42.tuxfamily.org/image-base-wx/index.html
Copyright 2012, 2019 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/>.
To install Image::Base::Wx, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::Base::Wx
CPAN shell
perl -MCPAN -e shell install Image::Base::Wx
For more information on module installation, please visit the detailed CPAN module installation guide.