NAME
App::MathImage::Image::Base::Gtk::Gdk::Pixbuf -- draw into Gtk::Gdk::Pixbuf images
SYNOPSIS
use App::MathImage::Image::Base::Gtk::Gdk::Pixbuf;
my $image = App::MathImage::Image::Base::Gtk::Gdk::Pixbuf->new
(-width => 100,
-height => 100);
$image->line (0,0, 99,99, '#FF00FF');
$image->rectangle (10,10, 20,15, 'white');
CLASS HIERARCHY
App::MathImage::Image::Base::Gtk::Gdk::Pixbuf
is a subclass of Image::Base
,
Image::Base
App::MathImage::Image::Base::Gtk::Gdk::Pixbuf
DESCRIPTION
In progress ...
App::MathImage::Image::Base::Gtk::Gdk::Pixbuf
extends Image::Base
to draw into GdkPixbuf 1.0 images (the GdkPixbuf version of Gtk 1.2). GdkPixbuf 1.0 can read various file formats,
PNG, JPEG, GIF, TIFF, XPM, XBM, ICO, RAS, PNM, BMP
but it has no file writing.
Pixbufs are held in client-side memory and don't of themselves require an X server or Gtk->init()
, but the code here uses Gtk::Gdk::Color->parse_color()
and will Gtk->init()
where necessary.
Colour Names
Colour names recognised are
names \
#FFF | per Gtk::Gdk::Color->parse_color()
#FFFFFF | which means Xlib XParseColor()
etc /
None special for transparent (when "has_alpha")
Only 8-bit RGB or RGBA pixbufs are supported by this module. This is all that GdkPixbuf 1.0 itself supports. 3 or 4 digit hex colours are truncated to their high 8 bits.
FUNCTIONS
See "FUNCTIONS" in Image::Base for the behaviour common to all Image-Base classes.
$image = App::MathImage::Image::Base::Gtk::Gdk::Pixbuf->new (key=>value,...)
-
Create and return a new GdkPixbuf image object. It can be pointed at an existing pixbuf,
$image = App::MathImage::Image::Base::Gtk::Gdk::Pixbuf->new (-pixbuf => $gdkpixbuf);
Or a file can be read,
$image = App::MathImage::Image::Base::Gtk::Gdk::Pixbuf->new (-file => '/my/file/name.jpeg');
Or a new pixbuf created with width and height,
$image = App::MathImage::Image::Base::Gtk::Gdk::Pixbuf->new (-width => 10, -height => 10);
When creating a pixbuf an alpha channel (transparency) can be requested with
-has_alpha
,$image = App::MathImage::Image::Base::Gtk::Gdk::Pixbuf->new (-width => 10, -height => 10, -has_alpha => 1);
$image->load ()
$image->load ($filename)
-
Read the
-file
, or set-file
to$filename
and then read. This creates and sets a new underlying-pixbuf
because it's not possible to read into an existing pixbuf object, only read a new one. $image->save ()
$image->save ($filename)
-
Gdk-Pixbuf 1.0 doesn't support saving.
ATTRIBUTES
-pixbuf
(Gtk::Gdk::Pixbuf
object)-
The target
Gtk::Gdk::Pixbuf
object. -width
(integer, read-only)-height
(integer, read-only)-
The size of a pixbuf cannot be changed once created.
-has_alpha
(boolean, read-only)-
Whether the underlying pixbuf has a alpha channel, meaning a transparency mask (or partial transparency). This cannot be changed once created.