ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CV/lib/Gtk2/CV.pm
Revision: 1.30
Committed: Sat Oct 28 01:26:09 2006 UTC (17 years, 9 months ago) by root
Branch: MAIN
Changes since 1.29: +2 -0 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 IO::AIO::min_parallel 32;
19
20 # we use a low priority watcher to give GUI interactions as high a priority
21 # as possible.
22 sub enable_aio {
23 $aio_source ||=
24 add_watch Glib::IO IO::AIO::poll_fileno,
25 in => sub {
26 eval { IO::AIO::poll_some 64 };
27 warn $@ if $q;#d#
28 1
29 },
30 undef,
31 &Glib::G_PRIORITY_LOW;
32 }
33
34 sub disable_aio {
35 remove Glib::Source $aio_source if $aio_source;
36 undef $aio_source;
37 }
38
39 enable_aio;
40
41 sub find_rcfile($) {
42 my $path;
43
44 for (@INC) {
45 $path = "$_/Gtk2/CV/$_[0]";
46 return $path if -r $path;
47 }
48
49 die "FATAL: can't find required file $_[0]\n";
50 }
51
52 sub require_image($) {
53 new_from_file Gtk2::Gdk::Pixbuf find_rcfile "images/$_[0]";
54 }
55
56 sub dealpha_compose($) {
57 return $_[0] unless $_[0]->get_has_alpha;
58
59 Gtk2::CV::dealpha_expose $_[0]->composite_color_simple (
60 $_[0]->get_width, $_[0]->get_height,
61 'nearest', 255, 16, 0xffc0c0c0, 0xff606060,
62 )
63 }
64
65 # TODO: make preferences
66 sub dealpha($) {
67 &dealpha_compose
68 }
69
70 1;
71