ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CV/lib/Gtk2/CV.pm
(Generate patch)

Comparing CV/lib/Gtk2/CV.pm (file contents):
Revision 1.18 by root, Thu Jul 21 01:04:29 2005 UTC vs.
Revision 1.29 by root, Thu Oct 26 16:43:29 2006 UTC

1package Gtk2::CV; 1package Gtk2::CV;
2
3use XSLoader;
4
5$VERSION = '0.5';
6
7XSLoader::load "Gtk2::CV", $VERSION;
8 2
9use Gtk2; 3use Gtk2;
10use Glib; 4use Glib;
11 5
12use IO::AIO; 6use IO::AIO;
13 7
8BEGIN {
9 use XSLoader;
10
11 $VERSION = '1.3';
12
13 XSLoader::load "Gtk2::CV", $VERSION;
14}
15
14my $aio_source; 16my $aio_source;
15 17
18# we use a low priority watcher to give GUI interactions as high a priority
19# as possible.
16sub enable_aio { 20sub enable_aio {
17 $aio_source ||= 21 $aio_source ||=
18 add_watch Glib::IO IO::AIO::poll_fileno, 22 add_watch Glib::IO IO::AIO::poll_fileno,
19 in => sub { IO::AIO::poll_cb; 1 }; 23 in => sub {
24 eval { IO::AIO::poll_some 64 };
25 warn $@ if $q;#d#
26 1
27 },
28 undef,
29 &Glib::G_PRIORITY_LOW;
20} 30}
21 31
22sub disable_aio { 32sub disable_aio {
23 remove Glib::Source $aio_source if $aio_source; 33 remove Glib::Source $aio_source if $aio_source;
24 undef $aio_source; 34 undef $aio_source;
25} 35}
26 36
27enable_aio; 37enable_aio;
28IO::AIO::max_outstanding 128;
29 38
30sub find_rcfile($) { 39sub find_rcfile($) {
31 my $path; 40 my $path;
32 41
33 for (@INC) { 42 for (@INC) {
40 49
41sub require_image($) { 50sub require_image($) {
42 new_from_file Gtk2::Gdk::Pixbuf find_rcfile "images/$_[0]"; 51 new_from_file Gtk2::Gdk::Pixbuf find_rcfile "images/$_[0]";
43} 52}
44 53
54sub dealpha_compose($) {
55 return $_[0] unless $_[0]->get_has_alpha;
56
57 Gtk2::CV::dealpha_expose $_[0]->composite_color_simple (
58 $_[0]->get_width, $_[0]->get_height,
59 'nearest', 255, 16, 0xffc0c0c0, 0xff606060,
60 )
61}
62
63# TODO: make preferences
64sub dealpha($) {
65 &dealpha_compose
66}
67
451; 681;
46 69

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines