=head1 NAME

Gtk2::Gdk::Pixbuf::Draw::Cache -  Cache for drawing scaled pixbufs

=cut

=for position DESCRIPTION

=head1 DESCRIPTION

Gtk2::Gdk::Pixbuf::Draw::Cache provides a cache that should be used by the
Gtk2::ImageView::Tool when redrawing the Gtk2::ImageView.

=cut



=head1 HIERARCHY

  Glib::Boxed
  +----Gtk2::Gdk::Pixbuf::Draw::Cache



=cut

=for object Gtk2::Gdk::Pixbuf::Draw::Cache Cache for drawing scaled pixbufs
=cut




=head1 METHODS

=head2 cache = Gtk2::Gdk::Pixbuf::Draw::Cache-E<gt>B<new> 

Returns a new pixbuf draw cache.

=head2 $cache-E<gt>B<draw> ($opts, $drawable)

=over

=item * $opts (Gtk2::Gdk::Pixbuf::Draw::Opts) 

=item * $drawable (Gtk2::Gdk::Drawable) 

=back

Redraws the area specified in the pixbuf draw options in an efficient way by
using caching.

=over

=item cache : a GdkPixbufDrawCache

=item opts : the Gtk2::Gdk::Pixbuf::Draw::Opts to use in this draw

=item drawable : a GdkDrawable to draw on

=back


=head2 $cache-E<gt>B<free> 

Deallocates a pixbuf draw cache and all its data.


=head2 $cache-E<gt>B<invalidate> 

Force the pixbuf draw cache to scale the pixbuf at the next draw.

Gtk2::Gdk::Pixbuf::Draw::Cache tries to minimize the number of scale operations
needed by caching the last drawn pixbuf. It would be inefficient to check the
individual pixels inside the pixbuf so it assumes that if the memory address of
the pixbuf has not changed, then the cache is good to use.

However, when the image data is modified, this assumtion breaks, which is why
this method must be used to tell draw cache about it.


=head2 method = Gtk2::Gdk::Pixbuf::Draw::Cache-E<gt>B<get_method> ($old, $new)

=over

=item * $old (Gtk2::Gdk::Pixbuf::Draw::Opts) 

=item * $new (Gtk2::Gdk::Pixbuf::Draw::Opts) 

=back

Gets the fastest method to draw the specified draw options. old is assumed to be
the last PixbufDrawOpts used and new is the one to use this time.



=cut


=head1 ENUMS AND FLAGS

=head2 enum Gtk2::Gdk::Pixbuf::Draw::Method

=over

=item * 'scale' / 'GDK_PIXBUF_DRAW_METHOD_SCALE'

=item * 'contains' / 'GDK_PIXBUF_DRAW_METHOD_CONTAINS'

=item * 'scroll' / 'GDK_PIXBUF_DRAW_METHOD_SCROLL'

=back




=cut


=head1 SEE ALSO

L<Gtk2::ImageView>, L<Glib::Boxed>


=cut


=head1 COPYRIGHT

Copyright (C) 2007 by Jeffrey Ratcliffe.

This software is licensed under the GPL-3; see L<Gtk2::ImageView> for a full notice.


=cut

