Reid van Melle avatar Reid van Melle committed 88b0251

Got most of the effects stuff working.

Comments (0)

Files changed (17)

+test-multistage:
+
+- after clicking on default stage:
+(/Users/rvanmelle/projects/clutter/clutter-svn/clutter/tests/.libs/test-multistage:17127): ClutterOSX-CRITICAL **: clutter_stage_osx_realize: assertion `self->view == NULL && self->window == NULL' failed
+
+$ ./test-entry-auto 
+
+Pango-CRITICAL **: pango_font_description_set_size: assertion `size >= 0' failed
+aborting...
+Abort trap
+
+$ ./test-paint-wrapper 
+
+** ERROR **: file test-paint-wrapper.c: line 129 (hand_pre_paint): assertion failed: (hand_pre_paint_guard == FALSE)
+aborting...
+Abort trap
+
+$ ./test-perspective
+
+?? don't know... get a fullscreen of white with tiny red dots in the corners that does nothing
+
+$ ./test-random-text
+
+I get a bunch of these errors and then a spinning beach ball:
+
+Pango-CRITICAL **: pango_font_description_set_size: assertion `size >= 0' failed
+
+$ ./test-script
+
+Get a number of Pango-CRITICAL and pango-WARNING and then
+
+ClutterOSX-CRITICAL **: clutter_stage_osx_realize: assertion `self->view == NULL && self->window == NULL' failed
+
+$ ./test-texture-quality
+
+Seems to work, but crashes at the end:
+
+** ERROR **: file cogl-bitmap.c: line 138 (_cogl_bitmap_copy_subregion): assertion failed: (src->format == dst->format)
+aborting...
+Abort trap
+
+./test-textures
+./test-text
+
+$ ./test-timeline-interpolate
+
+Seems to work, but I do get a (FAILED) message on the first expected frame
+
+$ ./test-timeline-smoothness
+
+  .
+  .
+  .
+timeline frame=16 total elapsed=3600(ms) since last frame=100 (ms)
+timeline frame=17 total elapsed=3700(ms) since last frame=100 (ms)
+timeline frame=18 total elapsed=3802(ms) since last frame=101 (ms)
+timeline frame=19 total elapsed=3900(ms) since last frame=98  (ms)
+timeline frame=20 total elapsed=4000(ms) since last frame=100 (ms)
+Failed
+

clutter-cairo/clutterCairo.ml

   
 class cairo_skel obj = object (self)
   inherit cairo_props
-  inherit ClutterActor.actor_skel (as_actor obj)
+  inherit ['a] ClutterActor.actor_skel (as_actor obj)
   method obj : cairo obj = obj
   method new_context = Cairo.new_context obj
 end

clutter/clutter.ml

 
 type coglbox = [`coglbox|`actor]
 
-type alpha_fun = alpha -> int
-type effect = [
+type alpha_fun_callback = alpha obj -> int
+let max_alpha = 0xffff
+type alpha_fun = [
   `RAMP_INC
 | `RAMP_DEC
 | `RAMP
 | `SMOOTHSTEP_DEC
 | `EXP_INC
 | `EXP_DEC
-| `CUSTOM of alpha_fun]
+| `CUSTOM of alpha_fun_callback]
     
 (** top level clutter routines *)
 external clutter_main : unit -> unit = "clutter_main"

clutter/clutterActor.ml

   inherit actor_sigs
 end
 	    
-class virtual actor_skel (obj : actor obj) = object(self)
+class virtual ['a] actor_skel (obj : actor obj) = object(self)
   inherit actor_props
+  method virtual obj : 'a obj
   method set_anchor_point_from_gravity =
     Actor.set_anchor_point_from_gravity obj
   method id = Gobject.get_oid obj
 end
 
 class actor obj = object
-  inherit actor_skel (obj : [> `actor] Clutter.obj)
+  inherit ['a] actor_skel (obj : [> `actor] Clutter.obj)
   method obj = obj
   method connect = new actor_signals_impl obj
 end

clutter/clutterAlpha.ml

+open OclutterProps
+open ClutterProps
+open Clutter
+
+module AlphaInternal = struct
+  external _create_full : timeline obj -> int -> alpha obj
+    = "ml_clutter_alpha_new_full"
+  let create_full a (b:alpha_fun) = _create_full a (Hashtbl.hash b)
+end;;
+
+class alpha_skel (obj:alpha obj) = object(self)
+  inherit alpha_props
+  method obj : alpha obj = obj
+end
+
+class alpha obj = object
+  inherit alpha_skel (obj : [> `alpha] obj)
+end
+
+let create ~timeline ~alpha_func =
+  let a = AlphaInternal.create_full timeline#as_timeline alpha_func in
+  new alpha a

clutter/clutterBehaviour.ml

+open OclutterProps
+open ClutterProps
+open Clutter
+open ClutterEnums
+
+module BehaviourInternal = struct
+  external path_new : alpha:alpha obj -> knots:knot array -> behaviour_path obj
+    = "ml_clutter_behaviour_path_new"
+  external bspline_new : alpha:alpha obj -> knots:knot array ->
+    behaviour_bspline obj = "ml_clutter_behaviour_bspline_new"
+end
+  
+(*module Beh = struct
+  module E = ClutterEnums
+  (* ellipse operations *)
+  external ellipse : alpha obj -> cx:int -> cy:int -> width:int -> height:int -> dir:E.rotate_direction_type -> start:float -> finish:float -> ellipse obj = "ml_clutter_behaviour_ellipse_new_bc"
+    "ml_clutter_behaviour_ellipse_new"
+
+  (* opacity operations *)
+  external opacity : alpha obj -> start:int -> finish:int -> opacity obj = "ml_clutter_behaviour_opacity_new"
+
+  (* general behaviour operations *)
+  external apply : [> `behaviour] obj -> [> `actor] obj -> unit = "ml_clutter_behaviour_apply"
+
+  module P = struct
+    let opacity_end : ([>`opacity],_) Gobject.property =
+      {Gobject.name="opacity-end"; conv=Gobject.Data.int}
+    let opacity_start : ([>`opacity],_) Gobject.property =
+      {Gobject.name="opacity-start"; conv=Gobject.Data.int}
+  end
+end;;*)
+
+class behaviour_signals_impl obj = object
+  inherit ['a] gobject_signals obj
+  inherit behaviour_sigs
+end
+
+class virtual behaviour_skel (obj : behaviour obj) = object(self)
+  inherit behaviour_props
+  method apply = Behaviour.apply obj
+end
+
+module Opacity = struct
+  class opacity_skel obj = object(self)
+    inherit behaviour_opacity_props
+    inherit behaviour_skel (as_behaviour obj)
+    method obj : behaviour_opacity obj = obj
+  end
+
+  class opacity_signals_impl obj = object
+    inherit ['a] gobject_signals obj
+    inherit behaviour_sigs
+  end
+
+  class opacity obj = object
+    inherit opacity_skel (obj : behaviour_opacity obj)
+    method connect = new opacity_signals_impl obj
+  end
+
+  let make_opacity ~create =
+    BehaviourOpacity.make_params ~cont:
+      (fun pl ->
+	 Behaviour.make_params pl ~cont:
+	   (fun pl () ->
+	      let (e : #opacity_skel) = create pl in e))
+
+  let create =
+    make_opacity [] ~create:(fun pl -> new opacity (BehaviourOpacity.create pl))
+end
+
+module Ellipse = struct
+  class ellipse_skel obj = object(self)
+    inherit behaviour_ellipse_props
+    inherit behaviour_skel (as_behaviour obj)
+    method obj : behaviour_ellipse obj = obj
+    (*method set_angle_tilt (axis:rotate_axis_type) v = function
+	`X_AXIS -> self#set_angle_tilt_x v
+      | `Y_AXIS -> self#set_angle_tilt_y v*)
+  end
+
+  class ellipse_signals_impl obj = object
+    inherit ['a] gobject_signals obj
+    inherit behaviour_sigs
+  end
+
+  class ellipse obj = object
+    inherit ellipse_skel (obj : [> `behaviourellipse] obj)
+    method connect = new ellipse_signals_impl obj
+  end
+
+  let make_ellipse ~create =
+    BehaviourEllipse.make_params ~cont:
+      (fun pl ->
+	 Behaviour.make_params pl ~cont:
+	   (fun pl () ->
+	      let (e : #ellipse_skel) = create pl in e))
+
+  let create =
+    make_ellipse [] ~create:(fun pl -> new ellipse (BehaviourEllipse.create pl))
+end
+
+module Bspline = struct
+  class bspline_skel obj = object(self)
+    inherit behaviour_skel (as_behaviour obj)
+    method obj : behaviour_bspline obj = obj
+    method set_origin = BehaviourBspline.set_origin obj
+  end
+
+  class bspline_signals_impl obj = object
+    inherit ['a] gobject_signals obj
+    inherit behaviour_bspline_sigs
+    inherit behaviour_sigs
+  end
+
+  class bspline obj = object
+    inherit bspline_skel (obj : [> `behaviourbspline] obj)
+    method connect = new bspline_signals_impl obj
+  end
+
+  let create ~alpha ~knots =
+    let o = BehaviourInternal.bspline_new ~alpha:(alpha#obj) ~knots in
+    new bspline o
+
+end
+
+module Path = struct
+  class path_skel obj = object(self)
+    inherit behaviour_path_props
+    inherit behaviour_skel (as_behaviour obj)
+    method obj : behaviour_path obj = obj
+  end
+
+  class path_signals_impl obj = object
+    inherit ['a] gobject_signals obj
+    inherit behaviour_path_sigs
+    inherit behaviour_sigs
+  end
+
+  class path obj = object
+    inherit path_skel (obj : [> `behaviourpath] obj)
+    method connect = new path_signals_impl obj
+  end
+
+  let create ~alpha ~knots =
+    let o = BehaviourInternal.path_new ~alpha:(alpha#obj) ~knots in
+    new path o
+
+end
+
+
+  
+let opacity = Opacity.create
+let ellipse = Ellipse.create
+let bspline = Bspline.create
+let path = Path.create

clutter/clutterEffects.ml

 open Clutter
 open ClutterEnums
 
+module Actor = ClutterActor
+
 module Effect = struct
   
   type t (* clutterEffectTemplate *)
   type complete_fun = actor obj -> unit
 
-  external create : timeline obj -> effect -> t
+  external create : timeline obj -> int -> alpha_fun_callback option -> t
     = "ml_clutter_effect_template_new"
-  external create_for_duration : int -> effect -> t
+  external create_for_duration : int -> int -> alpha_fun_callback option -> t
     = "ml_clutter_effect_template_new_for_duration"
     
   external fade : t -> actor obj -> int -> ?done_cb:complete_fun
 class effect_template obj =
 object
   val obj = obj
-  method fade = Effect.fade obj
-  method move = Effect.move obj
-  method path = Effect.path obj
-  method scale = Effect.scale obj
-  method depth = Effect.depth obj
-  method rotate = Effect.rotate obj
+  method fade (a: Actor.actor) = Effect.fade obj a#obj
+  method move (a: Actor.actor) = Effect.move obj a#obj
+  method scale (a: Actor.actor) = Effect.scale obj a#obj
+  method rotate (a: Actor.actor) = Effect.rotate obj a#obj
+  method depth (a: Actor.actor) = Effect.depth obj a#obj
+  method path (a: Actor.actor) = Effect.path obj a#obj        
+  (*
+    THIS MAKES FOR A NICER INTERFACE BUT I HAVE TO DUPLICATE THE
+    SIGNATURE
+    
+    method move (a: 'a. #ClutterActor.actor_o as 'a) =
+    Effect.move obj a#obj
+  method path : 'a. (#ClutterActor.actor_o as 'a) -> unit =
+    fun a -> Effect.path obj a#obj
+  method scale : 'a. (#ClutterActor.actor_o as 'a) -> unit =
+    fun a -> Effect.scale obj a#obj
+  method depth : 'a. (#ClutterActor.actor_o as 'a) -> unit =
+    fun a -> Effect.depth obj a#obj
+  method rotate : 'a. (#ClutterActor.actor_o as 'a) -> unit =
+    fun a -> Effect.rotate obj a#obj*)
 end
 
-let template tl alpha =
-  let obj = Effect.create tl alpha in
+let map_alpha_function alpha =
+  let code = match alpha with
+      `RAMP_INC -> 1
+    | `RAMP_DEC -> 2
+    | `RAMP -> 3
+    | `SINE -> 4
+    | `SINE_INC -> 5
+    | `SINE_DEC -> 6
+    | `SINE_HALF -> 7
+    | `SQUARE -> 8
+    | `SMOOTHSTEP_INC -> 9
+    | `SMOOTHSTEP_DEC -> 10
+    | `EXP_INC -> 11
+    | `EXP_DEC -> 12
+    | `CUSTOM _ -> 13
+  and callback = match alpha with
+      `CUSTOM x -> Some x
+    | _ -> None
+  in
+  code, callback
+  
+let template ~timeline ~alpha =
+  let code, callback = map_alpha_function alpha in
+  let obj = Effect.create timeline#as_timeline code callback in
   new effect_template obj
 
-let template_for_duration duration alpha =
-  let obj = Effect.create_for_duration duration alpha in
+let template_for_duration ~duration ~alpha =
+  let code, callback = map_alpha_function alpha in
+  let obj = Effect.create_for_duration duration code callback in
   new effect_template obj
   

clutter/clutterGroup.ml

 class group_skel (obj:group obj) = object (self)
   inherit actor_props
   inherit ClutterContainer.container_skel (as_container obj)
-  inherit ClutterActor.actor_skel (as_actor obj)
+  inherit ['a] ClutterActor.actor_skel (as_actor obj)
   method private obj : group Clutter.obj = obj
   method add_many : 'a. (#ClutterActor.actor_o as 'a) array -> unit =
     fun items ->

clutter/clutterLabel.ml

 class label_skel obj = object (self)
   inherit label_props
   inherit actor_props
-  inherit ClutterActor.actor_skel (as_actor obj)
+  inherit ['a] ClutterActor.actor_skel (as_actor obj)
   method obj : label Clutter.obj = obj
 end
 

clutter/clutterRectangle.ml

 open ClutterProps
 open Clutter
 
+module Actor = ClutterActor
+  
 class rectangle_skel obj = object (self)
   inherit rectangle_props
-  inherit ClutterActor.actor_skel (as_actor obj)
+  inherit ['a] Actor.actor_skel (as_actor obj)
   method obj : rectangle Clutter.obj = obj
+  (*method as_actor : Actor.actor_skel = (self :> ([`actor] Actor.actor_skel))*)
 end
 
 class rectangle_signals_impl obj = object

clutter/clutterStage.ml

 class stage_skel obj = object (self)
   inherit stage_props
   inherit ClutterContainer.container_skel (as_container obj)
-  inherit ClutterActor.actor_skel (as_actor obj)
+  inherit ['a] ClutterActor.actor_skel (as_actor obj)
   method obj : stage Clutter.obj = obj
   method get_actor_at_pos ~x ~y =
     new ClutterActor.actor (Stage.get_actor_at_pos obj ~x ~y)

clutter/clutterTexture.ml

 
 class texture_skel obj = object (self)
   inherit texture_props
-  inherit ClutterActor.actor_skel (as_actor obj)
+  inherit ['a] ClutterActor.actor_skel (as_actor obj)
   method obj : texture Clutter.obj = obj
 end
 

clutter/ml_effects.c

 #include "wrappers.h"
+#include <assert.h>
 #include "clutter_tags.h"
 #include "ml_timeline.h"
 #include "ml_actor.h"
+#include "ml_alpha.h"
 
+guint32 alpha_callback (ClutterAlpha *a, gpointer data)
+{
+  value val, *clos = (value*)data;
+  val = Val_ClutterAlpha(a);
+  value result = callback_exn (*clos, val);
+  return Int_val(result);
+  //ml_global_root_destroy(clos); --- need to do this on the alpha destory
+}
+
+void alpha_callback_destroy (gpointer data)
+{
+  value *clos = (value*)data;
+  ml_global_root_destroy(clos);
+}
 
 // FIXME: this does not free the pointer when done
 #define ClutterEffectTemplate_val(val) ((ClutterEffectTemplate *)Pointer_val(val))
 #define Val_ClutterEffectTemplate(val) (Val_pointer(val))
 
-CAMLprim value ml_clutter_effect_template_new(value timeline, value alpha_fn) {
-  CAMLparam2(timeline, alpha_fn);
+ClutterAlphaFunc get_alpha_func(value alpha_fn, value callback) {
+  value *clos_p = Option_val(callback, ml_global_root_new, NULL);
   ClutterAlphaFunc fn;
-  printf("warning: effect template new not fully supported\n");
   switch(Int_val(alpha_fn)) {
   case 1: fn = CLUTTER_ALPHA_RAMP_INC; break;
   case 2: fn = CLUTTER_ALPHA_RAMP_DEC; break;
   case 3: fn = CLUTTER_ALPHA_RAMP; break;
+  case 4: fn = CLUTTER_ALPHA_RAMP; break;
+  case 5: fn = CLUTTER_ALPHA_RAMP; break;
+  case 6: fn = CLUTTER_ALPHA_RAMP; break;
+  case 7: fn = CLUTTER_ALPHA_RAMP; break;
+  case 8: fn = CLUTTER_ALPHA_RAMP; break;
+  case 9: fn = CLUTTER_ALPHA_RAMP; break;
+  case 10: fn = CLUTTER_ALPHA_RAMP; break;
+  case 11: fn = CLUTTER_ALPHA_RAMP; break;
+  case 12: fn = CLUTTER_ALPHA_RAMP; break;
+  case 13: assert(clos_p != NULL); fn = alpha_callback; break;
   default: fn = CLUTTER_ALPHA_SINE;
-  };
-  ClutterEffectTemplate* t = clutter_effect_template_new
-    (ClutterTimeline_val(timeline), fn);
+  }
+  return fn;
+}
+
+CAMLprim value
+ml_clutter_effect_template_new(value timeline, value alpha_fn, value callback) {
+  CAMLparam3(timeline, alpha_fn, callback);
+  value *clos_p = Option_val(callback, ml_global_root_new, NULL);
+  ClutterAlphaFunc fn = get_alpha_func(alpha_fn, callback);
+  ClutterEffectTemplate* t;
+  if (clos_p == NULL) {
+    t = clutter_effect_template_new(ClutterTimeline_val(timeline), fn);
+  } else {
+    t = clutter_effect_template_new_full
+      (ClutterTimeline_val(timeline), fn, clos_p, alpha_callback_destroy);
+  }
   CAMLreturn(Val_ClutterEffectTemplate(t));
 }
 
-CAMLprim value ml_clutter_effect_template_new_for_duration
-(value duration, value alpha_fn) {
-  CAMLparam2(duration, alpha_fn);
-  ClutterAlphaFunc fn;
-  printf("warning: effect template new not fully supported\n");
-  switch(Int_val(alpha_fn)) {
-  case 1: fn = CLUTTER_ALPHA_RAMP_INC; break;
-  case 2: fn = CLUTTER_ALPHA_RAMP_DEC; break;
-  case 3: fn = CLUTTER_ALPHA_RAMP; break;
-  default: fn = CLUTTER_ALPHA_SINE;
-  };
+CAMLprim value
+ml_clutter_effect_template_new_for_duration(value duration, value alpha_fn,
+					    value callback) {
+  CAMLparam3(duration, alpha_fn, callback);
+  value *clos_p = Option_val(callback, ml_global_root_new, NULL);
+  ClutterAlphaFunc fn = get_alpha_func(alpha_fn, callback);
   ClutterEffectTemplate* t = clutter_effect_template_new_for_duration
     (Int_val(duration), fn);
+  if (clos_p != NULL) assert(0);  // not supported yet
   CAMLreturn(Val_ClutterEffectTemplate(t));
 }
 

clutter/oClutter.mlpack

+ClutterTexture
+ClutterRectangle
+ClutterLabel
+ClutterAlpha
+ClutterBehaviour
+ClutterContainer
+ClutterEllipse
+ClutterGroup
+ClutterActor
+ClutterStage
+ClutterTimeline
Added
New image

tests/test-cogl-tex-file.ml

+
+
+open Printf
+open Clutter
+
+let gl_draw _ =
+  printf "gl_draw\n%!";
+  (*Cogl.push_matrix ();*)
+  GlClear.color (0.0, 0.0, 0.0);
+  GlClear.clear [`color];
+  GlDraw.color (1.0, 0.0, 0.0);
+  (*Cogl.rectangle ~x:0 ~y:0 ~width:400 ~height:400;*)
+  GlMat.mode `projection;
+  GlMat.load_identity ();
+  GlMat.ortho ~x:(-1.0,1.0) ~y:(-1.0,1.0) ~z:(-1.0,1.0);
+  GlDraw.begins `polygon;
+  GlDraw.vertex ~x:(-0.5) ~y:(-0.2) ();
+  GlDraw.vertex ~x:(-0.5) ~y:(0.5) ();
+  GlDraw.vertex ~x:(0.5) ~y:(0.5) ();
+  GlDraw.vertex ~x:(0.5) ~y:(-0.5) ();
+  GlDraw.ends ();
+  Gl.flush ()
+  (*Cogl.pop_matrix ()*)
+    (*
+      let c2 = CoglBox.create gl_draw in
+      let c2 = new ClutterActor.actor (as_actor c2) in
+      stage#add_actor c2;
+    *)
+  
+let _ =
+  let stage = ClutterStage.get_default () in
+  stage#set_size ~width:800 ~height:600;
+  let frame = ref 0 in
+  let tex_id = Cogl.Texture.new_from_file "./examples/redhand.png" 0 false `ANY in
+  (* FIXME: Cogl.Textures.set_filters tex_id `CGL_LINEAR `CGL_LINEAR; *)
+  let c = CoglBox.create
+    (fun _ ->
+       let cback = Color.rgb (0x66, 0x66, 0xDD)
+       and cwhite = Color.rgb (0xFF, 0xFF, 0xFF) in
+       let texcoords = [|float_to_units 0.; float_to_units 0.;
+			 float_to_units 1.; float_to_units 1.|] in
+       let sin_frame = sini (angle_from_deg (float !frame))
+       and cos_frame = cosi (angle_from_deg (float !frame)) in
+       let pingpong_frame = if !frame <= 180 then !frame else 360 - !frame in
+       let frac_frame = cfx_qdiv (from_device pingpong_frame)
+	 (from_device 180) in
+       let frac_frame = frac_frame +~ ((cfx_one ()) >>~ 1) in
+       let frac_frame = frac_frame <<~ 1 in
+       for t=0 to 1 do
+	 let t = 2*t in
+	 texcoords.(t) <- texcoords.(t) +~ cos_frame;
+	 texcoords.(t+1) <- texcoords.(t+1) +~ sin_frame;
+	 texcoords.(t) <- cfx_qmul texcoords.(t) frac_frame;
+	 texcoords.(t+1) <- cfx_qmul texcoords.(t+1) frac_frame;
+       done;
+       Cogl.push_matrix ();
+       Cogl.color cback#obj;
+       Cogl.rectangle ~x:0 ~y:0 ~width:400 ~height:400;
+       Cogl.color cwhite#obj;
+       Cogl.translate 100 100 0;
+       Cogl.Texture.rectangle tex_id ~x1:(from_device 0) ~y1:(from_device 0)
+	 ~x2:(from_device 200) ~y2:(from_device 213)
+	 ~tx1:texcoords.(0) ~ty1:texcoords.(1) ~tx2:texcoords.(2)
+	 ~ty2:texcoords.(3);
+       Cogl.pop_matrix ();
+    ) in
+  
+  let c = new ClutterActor.actor (as_actor c) in
+  stage#add_actor c;
+  let timeline = ClutterTimeline.timeline ~num_frames:1
+    ~fps:60 ~loop:false () in
+  let _ = timeline#connect#new_frame (fun _ f -> frame := f; c#queue_redraw) in
+  timeline#start;
+  stage#show_all;
+  clutter_main ()
+  
+  

tests/test-effect.ml

 open ClutterEnums
 
 open Printf
-  
+module Timeline = ClutterTimeline
+module Actor = ClutterActor
+module Alpha = ClutterAlpha
+
 let _ =
   let stage_color = Color.rgba (0xcc,0xcc,0xcc,0xff) in
   let rect_color = Color.rgba (0,0,0,0xdd) in
   let red = Color.rgba (0xff,0,0,0xff) in
 
-  let timeline = ClutterTimeline.timeline ~duration:5000 () in
+  let timeline = Timeline.timeline ~duration:5000 () in
   timeline#set_loop true;
 
-  let tmpl = ClutterEffects.template timeline#as_timeline `RAMP_INC in
+  let i = ref 1. in
+  let tmpl = ClutterEffects.template timeline
+    (`CUSTOM (fun obj ->
+		i := min (!i *. 1.01) (float max_alpha);
+		(int_of_float !i)))
+  in
 
   let stage = ClutterStage.get_default () in
 
     ~color:rect_color () in
   stage#add_actor actor; (* container operation *)
 
-  let _ = tmpl#fade actor#as_actor 0x22
+  let _ = tmpl#fade (actor :> Actor.actor) 0x22
     ~done_cb:(fun _ -> printf "fade done\n%!") in
   actor#show;
   
   let actor = ClutterRectangle.rectangle ~color:rect_color ~width:50
     ~height:50 ~x:750 ~y:70 () in
   stage#add_actor actor;
-  let _ = tmpl#depth actor#as_actor ~depth:(-500)
+  let _ = tmpl#depth (actor :> Actor.actor) ~depth:(-500)
     ~done_cb:(fun _ -> printf "depth done\n%!") in
   actor#show;
 
   let actor = ClutterRectangle.rectangle ~color:rect_color ~width:50
     ~height:50 ~x:50 ~y:140 () in
   stage#add_actor actor;
-  let _ = tmpl#move actor#as_actor ~x:750 ~y:140
+  let _ = tmpl#move (actor :> Actor.actor) ~x:750 ~y:140
     ~done_cb:(fun _ -> printf "move done\n%!") in
   actor#show;
 
   let actor = ClutterRectangle.rectangle ~color:red ~width:50
     ~height:50 ~x:750 ~y:210 () in
   stage#add_actor actor;
-  let _ = tmpl#path actor#as_actor ~knots:[|(750,210); (350,210)|]
+  let _ = tmpl#path (actor :> Actor.actor) ~knots:[|(750,210); (350,210)|]
     ~done_cb:(fun _ -> printf "path done\n%!") in
   actor#show;
 
     ~height:50 ~x:50 ~y:280 () in
   stage#add_actor actor;
   actor#set_anchor_point_from_gravity `GRAVITY_CENTER;
-  let _ = tmpl#scale actor#as_actor ~xscale:2. ~yscale:2.
+  let _ = tmpl#scale (actor :> Actor.actor) ~xscale:2. ~yscale:2.
     ~done_cb:(fun _ -> printf "scale done\n%!") in
   actor#show;
 
   let actor = ClutterRectangle.rectangle ~color:rect_color ~width:50
     ~height:50 ~x:750 ~y:350 () in
   stage#add_actor actor;
-  let _ = tmpl#rotate actor#as_actor ~axis:`Z_AXIS ~angle:180.
+  let _ = tmpl#rotate (actor :> Actor.actor) ~axis:`Z_AXIS ~angle:180.
     ~x:25 ~y:25 ~z:0 ~dir:`ROTATE_CW
     ~done_cb:(fun _ -> printf "rotate done\n%!") in
   actor#show;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.