ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CV/lib/Gtk2/CV.pm
Revision: 1.29
Committed: Thu Oct 26 16:43:29 2006 UTC (17 years, 8 months ago) by root
Branch: MAIN
Changes since 1.28: +1 -1 lines
Log Message:
*** empty log message ***

File Contents

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