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.19 by root, Tue Aug 16 02:08:06 2005 UTC vs.
Revision 1.31 by root, Sat Oct 28 23:09:02 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
18IO::AIO::min_parallel 32;
19IO::AIO::max_poll_time 0.01;
20
16# we use a low priority to give GUI interactions as high a priority 21# we use a low priority watcher to give GUI interactions as high a priority
17# as possible. 22# as possible.
18sub enable_aio { 23sub enable_aio {
19 $aio_source ||= 24 $aio_source ||=
20 add_watch Glib::IO IO::AIO::poll_fileno, 25 add_watch Glib::IO IO::AIO::poll_fileno,
21 in => sub { IO::AIO::poll_cb; 1 }, 26 in => sub {
22 undef, 27 eval { IO::AIO::poll_cb };
28 warn $@ if $@;#d#
29 1
30 },
31 undef,
23 &Glib::G_PRIORITY_LOW; 32 &Glib::G_PRIORITY_LOW;
24} 33}
25 34
26sub disable_aio { 35sub disable_aio {
27 remove Glib::Source $aio_source if $aio_source; 36 remove Glib::Source $aio_source if $aio_source;
28 undef $aio_source; 37 undef $aio_source;
29} 38}
30 39
31enable_aio; 40enable_aio;
32IO::AIO::max_outstanding 128;
33 41
34sub find_rcfile($) { 42sub find_rcfile($) {
35 my $path; 43 my $path;
36 44
37 for (@INC) { 45 for (@INC) {
44 52
45sub require_image($) { 53sub require_image($) {
46 new_from_file Gtk2::Gdk::Pixbuf find_rcfile "images/$_[0]"; 54 new_from_file Gtk2::Gdk::Pixbuf find_rcfile "images/$_[0]";
47} 55}
48 56
57sub dealpha_compose($) {
58 return $_[0] unless $_[0]->get_has_alpha;
59
60 Gtk2::CV::dealpha_expose $_[0]->composite_color_simple (
61 $_[0]->get_width, $_[0]->get_height,
62 'nearest', 255, 16, 0xffc0c0c0, 0xff606060,
63 )
64}
65
66# TODO: make preferences
67sub dealpha($) {
68 &dealpha_compose
69}
70
491; 711;
50 72

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines