r49124 - in /trunk/libclutter-perl: MANIFEST META.yml NEWS README debian/changelog examples/bubbles.pl examples/circles.pl examples/custom-container.pl examples/hello.pl lib/Clutter.pm xs/ClutterAnimation.xs xs/ClutterContainer.xs
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Mon Dec 21 21:53:31 UTC 2009
Author: gregoa
Date: Mon Dec 21 21:53:23 2009
New Revision: 49124
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=49124
Log:
New upstream release.
Added:
trunk/libclutter-perl/examples/bubbles.pl
- copied unchanged from r49123, branches/upstream/libclutter-perl/current/examples/bubbles.pl
trunk/libclutter-perl/examples/circles.pl
- copied unchanged from r49123, branches/upstream/libclutter-perl/current/examples/circles.pl
Modified:
trunk/libclutter-perl/MANIFEST
trunk/libclutter-perl/META.yml
trunk/libclutter-perl/NEWS
trunk/libclutter-perl/README
trunk/libclutter-perl/debian/changelog
trunk/libclutter-perl/examples/custom-container.pl
trunk/libclutter-perl/examples/hello.pl
trunk/libclutter-perl/lib/Clutter.pm
trunk/libclutter-perl/xs/ClutterAnimation.xs
trunk/libclutter-perl/xs/ClutterContainer.xs
Modified: trunk/libclutter-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclutter-perl/MANIFEST?rev=49124&op=diff
==============================================================================
--- trunk/libclutter-perl/MANIFEST (original)
+++ trunk/libclutter-perl/MANIFEST Mon Dec 21 21:53:23 2009
@@ -6,7 +6,9 @@
copyright.pod
doctypes
examples/behaviour.pl
+examples/bubbles.pl
examples/cairo.pl
+examples/circles.pl
examples/custom-actor.pl
examples/custom-container.pl
examples/easing.pl
Modified: trunk/libclutter-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclutter-perl/META.yml?rev=49124&op=diff
==============================================================================
--- trunk/libclutter-perl/META.yml (original)
+++ trunk/libclutter-perl/META.yml Mon Dec 21 21:53:23 2009
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Clutter
-version: 1.001
+version: 1.002
abstract: Simple GL-based canvas library
license: perl, lgpl
author:
Modified: trunk/libclutter-perl/NEWS
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclutter-perl/NEWS?rev=49124&op=diff
==============================================================================
--- trunk/libclutter-perl/NEWS (original)
+++ trunk/libclutter-perl/NEWS Mon Dec 21 21:53:23 2009
@@ -1,3 +1,10 @@
+Clutter 1.002
+=============
+* Allow omitting FOREACH_WITH_INTERNALS from Container implementations,
+ just like the documentation said
+* Improve Clutter::Animation documentation
+* Improve the examples
+
Clutter 1.001
=============
* Add Clutter::Cogl::Pango API bindings
Modified: trunk/libclutter-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclutter-perl/README?rev=49124&op=diff
==============================================================================
--- trunk/libclutter-perl/README (original)
+++ trunk/libclutter-perl/README Mon Dec 21 21:53:23 2009
@@ -1,4 +1,4 @@
-Clutter version 1.001
+Clutter version 1.002
=====================
Perl bindings to the Clutter OpenGL canvas. Clutter aims to give a nice
Modified: trunk/libclutter-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclutter-perl/debian/changelog?rev=49124&op=diff
==============================================================================
--- trunk/libclutter-perl/debian/changelog (original)
+++ trunk/libclutter-perl/debian/changelog Mon Dec 21 21:53:23 2009
@@ -1,4 +1,4 @@
-libclutter-perl (1.0.1-1) UNRELEASED; urgency=low
+libclutter-perl (1.002-1) UNRELEASED; urgency=low
[ Ryan Niebur ]
* Take over for the Debian Perl Group; Closes: #560886 -- RFA
@@ -21,8 +21,9 @@
perl (>= 5.6.0-{12,16}) with an unversioned dependency on perl (as
permitted by Debian Policy 3.8.3).
* debian/watch: switch to CPAN.
+ * New upstream release.
- -- Ryan Niebur <ryan at debian.org> Sun, 13 Dec 2009 11:43:36 -0800
+ -- gregor herrmann <gregoa at debian.org> Mon, 21 Dec 2009 22:52:31 +0100
clutter-perl (0.8.0.1-1) unstable; urgency=low
Modified: trunk/libclutter-perl/examples/custom-container.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclutter-perl/examples/custom-container.pl?rev=49124&op=diff
==============================================================================
--- trunk/libclutter-perl/examples/custom-container.pl (original)
+++ trunk/libclutter-perl/examples/custom-container.pl Mon Dec 21 21:53:23 2009
@@ -126,14 +126,6 @@
}
}
-sub FOREACH_WITH_INTERNALS {
- my ($self, $func, $data) = @_;
-
- foreach my $child (@{$self->{children}}) {
- &$func ($child, $data);
- }
-}
-
sub CREATE_CHILD_META {
my ($self, $actor) = @_;
Modified: trunk/libclutter-perl/examples/hello.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclutter-perl/examples/hello.pl?rev=49124&op=diff
==============================================================================
--- trunk/libclutter-perl/examples/hello.pl (original)
+++ trunk/libclutter-perl/examples/hello.pl Mon Dec 21 21:53:23 2009
@@ -10,11 +10,15 @@
use strict;
use warnings;
+use constant FONT_DESC => 'Sans 96px';
+
+use Math::Trig qw( :pi );
+use Glib qw( :constants );
use Clutter qw( :init );
use Clutter::Keysyms;
my $stage = Clutter::Stage->get_default();
-$stage->set_color(Clutter::Color->parse('DarkSlateGray'));
+$stage->set_color(Clutter::Color->from_string('DarkSlateGray'));
$stage->signal_connect('button-press-event' => sub { Clutter->main_quit() });
$stage->signal_connect('key-press-event' => sub {
my ($stage, $event) = @_;
@@ -23,13 +27,85 @@
if ($event->keyval == $Clutter::Keysyms{Escape});
});
$stage->set_size(800, 600);
+$stage->show();
-my $label = Clutter::Label->new("Sans 30", "Hello, Clutter!");
-$label->set_color(Clutter::Color->new(0xff, 0xcc, 0xcc, 0xdd));
-$label->set_position(($stage->get_width() - $label->get_width()) / 2,
- ($stage->get_height() - $label->get_height()) / 2);
-$stage->add($label);
-$stage->show_all();
+my $timeline = Clutter::Timeline->new(3000);
+$timeline->set_loop(TRUE);
+
+my $alpha = Clutter::Alpha->new($timeline);
+$alpha->set_func(sub {
+ return sin($alpha->get_timeline()->get_progress() * pi);
+});
+
+my $x_offset = 64;
+my $y_offset = $stage->get_height() / 2;
+
+my @str = split(//, 'hello, clutter!', -1);
+my $idx = 0;
+foreach my $char (@str) {
+ my $color = Clutter::Color->new(
+ int(rand(255)),
+ int(rand(255)),
+ int(rand(255)),
+ 255,
+ );
+ my $text = Clutter::Text->new(FONT_DESC, "$char", $color);
+
+ $text->set_position($x_offset, $y_offset);
+ $stage->add($text);
+
+ my $behaviour;
+
+ if ($idx % 7 == 0) {
+ $behaviour = Clutter::Behaviour::Opacity->new(
+ $alpha,
+ 255, int(rand(64)),
+ );
+ }
+ elsif ($idx % 3 == 0) {
+ $behaviour = Clutter::Behaviour::Rotate->new(
+ $alpha,
+ 'z-axis',
+ ($idx % 2) ? 'cw' : 'ccw',
+ 0.0, 0.0,
+ );
+ $behaviour->set_center(
+ $text->get_width(),
+ $text->get_height(),
+ 0,
+ );
+ }
+ elsif ($idx % 2 == 0) {
+ my $final = ($idx % 5) ? 1.0 + rand(1.0) : rand(0.8);
+ $behaviour = Clutter::Behaviour::Scale->new(
+ $alpha,
+ 1.0, 1.0,
+ $final, $final,
+ );
+ $text->move_anchor_point_from_gravity('center');
+ }
+ else {
+ my ($x, $y) = (int(rand(50)), int(rand(50)));
+ $behaviour = Clutter::Behaviour::Path->new(
+ $alpha,
+ Clutter::Path->new(
+ [ 'move-to', [ [ $x_offset , $y_offset ] ] ],
+ [ 'line-to', [ [ $x_offset + $x, $y_offset - $y ] ] ],
+ [ 'line-to', [ [ $x_offset + $x, $y_offset + $y ] ] ],
+ [ 'line-to', [ [ $x_offset - $x, $y_offset + $y ] ] ],
+ ),
+ );
+ }
+
+ $behaviour->apply($text);
+ $text->{behaviour} = $behaviour;
+
+ $x_offset += $text->get_width() - 5;
+
+ $idx += 1;
+}
+
+$timeline->start();
Clutter->main();
Modified: trunk/libclutter-perl/lib/Clutter.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclutter-perl/lib/Clutter.pm?rev=49124&op=diff
==============================================================================
--- trunk/libclutter-perl/lib/Clutter.pm (original)
+++ trunk/libclutter-perl/lib/Clutter.pm Mon Dec 21 21:53:23 2009
@@ -41,7 +41,7 @@
# this scheme allocates enough space for ten releases of the bindings
# for each point release of libclutter, which should be enough even in
# case of brown paper bag releases. -- ebassi
-our $VERSION = '1.001';
+our $VERSION = '1.002';
$VERSION = eval $VERSION;
our @ISA = qw( DynaLoader Exporter );
Modified: trunk/libclutter-perl/xs/ClutterAnimation.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclutter-perl/xs/ClutterAnimation.xs?rev=49124&op=diff
==============================================================================
--- trunk/libclutter-perl/xs/ClutterAnimation.xs (original)
+++ trunk/libclutter-perl/xs/ClutterAnimation.xs Mon Dec 21 21:53:23 2009
@@ -29,6 +29,11 @@
# start the animation
$animation->get_timeline()->start();
+ # set the object as reactive when the animation ends
+ $animation->signal_connect(completed => sub {
+ $animation->get_object()->set_reactive(TRUE);
+ })
+
=head1 DESCRIPTION
B<Clutter::Animation> is an class providing simple, implicit animations
@@ -41,6 +46,8 @@
The duration of the animation is set using Clutter::Animation::set_duration().
The easing mode of the animation is set using Clutter::Animation::set_mode().
+
+=head2 Controlling the Animation
If you want to control the animation you should retrieve the
L<Clutter::Timeline> using Clutter::Animation::get_timeline() and then
@@ -60,16 +67,52 @@
Clutter::Animatable interface it is possible for that instance to control
the way the initial and final states are interpolated.
+=head2 Changing the Animation
+
+The initial and final value of a property bound to the Animation are
+controlled by a L<Clutter::Interval> instance. You can retrieve the
+Interval instance and change the values, or you can change the Interval
+instance itself:
+
+ # increase the scaling factor
+ $animation->get_interval('scale-x')->set_final_value(2.5);
+ $animation->get_interval('scale-y')->set_final_value(2.5);
+
+ # change the opacity interval
+ $cur_value = $animation->get_object()->get_opacity();
+ $interval = Clutter::Interval->new('Glib::Uchar');
+ $interval->set_interval($cur_value, 128);
+ $animation->update_interval('opacity', $interval);
+
+=head2 Differences between Animation and Behaviour
+
Clutter::Animation is distinguished from L<Clutter::Behaviour> because
the former can only control Glib::Object properties of a single Glib::Object
instance, while the latter can control multiple properties using accessor
functions inside the L<Clutter::Behaviour>::ALPHA_NOTIFY virtual function,
and can control multiple L<Clutter::Actor>s at the same time.
+=head2 Convenience API
+
For convenience, it is possible to use the Clutter::Actor::animate()
method which will take care of setting up and tearing down a
Clutter::Animation instance and animate an actor between its current
-state and the specified final state.
+state and the specified final state:
+
+ $texture->animate(
+ 'ease-out-cubic', 500,
+ scale_x => 2.0,
+ scale_y => 2.0,
+ opacity => 255
+ )->signal_connect(completed => sub { $texture->set_reactive(TRUE) })
+
+The example above reproduces the same animation as the one in the Synopsis.
+
+The Clutter::Animation instance created by Clutter::Actor::animate() is
+managed by the animate() method itself and it is guaranteed to be valid for
+as long as the animation is running; once the animation emits the I<completed>
+signal, the animation will still be valid from within handlers connected to
+that signal, until the default signal handler is executed.
=cut
@@ -85,28 +128,59 @@
=for enum Clutter::AnimationMode
=cut
+=for apidoc
+Creates a new Clutter::Animation
+=cut
ClutterAnimation *clutter_animation_new (class);
C_ARGS:
/* void */
+=for apidoc
+Sets the object to be animated. The I<object> must be set before calling
+Clutter::Animation::bind() or Clutter::Animation::bind_interval()
+=cut
void clutter_animation_set_object (ClutterAnimation *animation, GObject *object);
+=for apidoc
+Retrieves the object set using Clutter::Animation::set_object()
+=cut
GObject *clutter_animation_get_object (ClutterAnimation *animation);
+=for apidoc
+Sets the easing mode of I<animation>. The easing mode can either be a value
+of the Clutter::AnimationMode enumeration or the logical id returned by
+Clutter::Alpha::register_func() for custom easing modes
+=cut
void clutter_animation_set_mode (ClutterAnimation *animation, SV *mode);
CODE:
clutter_animation_set_mode (animation, clutter_perl_animation_mode_from_sv (mode));
+=for apidoc
+Retrieves the easing mode as set using Clutter::Animation::set_mode()
+=cut
SV *clutter_animation_get_mode (ClutterAnimation *animation);
CODE:
clutter_perl_animation_mode_to_sv (clutter_animation_get_mode (animation));
+=for apidoc
+Sets the duration of I<animation>, in milliseconds
+=cut
void clutter_animation_set_duration (ClutterAnimation *animation, gint msecs);
+=for apidoc
+Gets the duration set using Clutter::Animation::set_duration()
+=cut
guint clutter_animation_get_duration (ClutterAnimation *animation);
+=for apidoc
+Sets whether I<animation> should loop. A looping animation will never emit
+the I<completed> signal
+=cut
void clutter_animation_set_loop (ClutterAnimation *animation, gboolean loop);
+=for apidoc
+Retrieves whether I<animation> is looping or not
+=cut
gboolean clutter_animation_get_loop (ClutterAnimation *animation);
void clutter_animation_set_timeline (ClutterAnimation *animation, ClutterTimeline *timeline);
@@ -117,6 +191,23 @@
ClutterAlpha *clutter_animation_get_alpha (ClutterAnimation *animation);
+=for apidoc
+Binds I<property_name> to the animation.
+
+An implicit L<Clutter::Interval> will be created which will use:
+
+=over 4
+
+=item the type of the property
+
+=item the current value as the initial value
+
+=item the passed I<final> value as the final value
+
+=back
+
+This method will croak if I<animation> does not have an object set.
+=cut
ClutterAnimation *clutter_animation_bind (animation, property_name, final)
ClutterAnimation *animation
const gchar *property_name
@@ -164,5 +255,8 @@
ClutterInterval_noinc *clutter_animation_get_interval (ClutterAnimation *animation, const gchar *property_name);
+=for apidoc
+Emits the I<completed> signal on I<animation>
+=cut
void clutter_animation_completed (ClutterAnimation *animation);
Modified: trunk/libclutter-perl/xs/ClutterContainer.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclutter-perl/xs/ClutterContainer.xs?rev=49124&op=diff
==============================================================================
--- trunk/libclutter-perl/xs/ClutterContainer.xs (original)
+++ trunk/libclutter-perl/xs/ClutterContainer.xs Mon Dec 21 21:53:23 2009
@@ -33,6 +33,13 @@
HV * stash = gperl_object_stash_from_type (G_OBJECT_TYPE (obj)); \
GV * slot = gv_fetchmethod (stash, name);
+#define GET_METHOD_WITH_FALLBACK(obj, name, fallback) \
+ HV * stash = gperl_object_stash_from_type (G_OBJECT_TYPE (obj)); \
+ GV * slot = gv_fetchmethod (stash, name); \
+ if (slot == NULL || !GvCV (slot)) { \
+ slot = gv_fetchmethod (stash, fallback); \
+ }
+
#define METHOD_EXISTS (slot && GvCV (slot))
#define PREP(obj) \
@@ -167,7 +174,9 @@
ClutterCallback callback,
gpointer callback_data)
{
- GET_METHOD (container, "FOREACH_WITH_INTERNALS");
+ GET_METHOD_WITH_FALLBACK (container,
+ "FOREACH_WITH_INTERNALS",
+ "FOREACH");
if (METHOD_EXISTS)
{
More information about the Pkg-perl-cvs-commits
mailing list