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.2 by root, Mon Nov 3 01:27:37 2003 UTC vs.
Revision 1.28 by root, Sun Oct 22 22:17:53 2006 UTC

1package Gtk2::CV; 1package Gtk2::CV;
2 2
3use XSLoader; 3use Gtk2;
4use Glib;
4 5
5XSLoader::load "Gtk2::CV", 0.0001; 6use IO::AIO;
6 7
7use Gtk2; 8BEGIN {
9 use XSLoader;
8 10
9sub require_image { 11 $VERSION = '1.3';
12
13 XSLoader::load "Gtk2::CV", $VERSION;
14}
15
16my $aio_source;
17
18# we use a low priority watcher to give GUI interactions as high a priority
19# as possible.
20sub enable_aio {
21 $aio_source ||=
22 add_watch Glib::IO IO::AIO::poll_fileno,
23 in => sub {
24 eval { IO::AIO::poll_cb };
25 warn $@ if $q;#d#
26 1
27 },
28 undef,
29 &Glib::G_PRIORITY_LOW;
30}
31
32sub disable_aio {
33 remove Glib::Source $aio_source if $aio_source;
34 undef $aio_source;
35}
36
37enable_aio;
38
39sub find_rcfile($) {
10 my $path; 40 my $path;
11 41
12 for (@INC) { 42 for (@INC) {
13 $path = "$_/Gtk2/CV/images/$_[0]"; 43 $path = "$_/Gtk2/CV/$_[0]";
14 last if -r $path; 44 return $path if -r $path;
15 } 45 }
16 46
17 eval { new_from_file Gtk2::Gdk::Pixbuf $path } 47 die "FATAL: can't find required file $_[0]\n";
18 or die "can't find image $_[0] in \@INC"; 48}
49
50sub require_image($) {
51 new_from_file Gtk2::Gdk::Pixbuf find_rcfile "images/$_[0]";
52}
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
19} 66}
20 67
211; 681;
22 69

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines