On Wed, 2010-10-06 at 10:51 -0400, Erick Pérez wrote: > What's the best way, or Is there some guidelines to subclass a clutter > actor or a clutter container but using composition
http://docs.clutter-project.org/docs/clutter/stable/clutter-subclassing-ClutterActor.html > instead of pure hard rewriting paint()/pick() virtual methods. And > the question goes: because of the inability of Cogl of using > antialising, so I want to make cute rounded rectangle actor, i can't > use paint()/pick() approach to subclass. this sentence does not make any sense. > I had this sample: isn't working at all. I'm completely unsurprised by this. > public override void paint() { > > /* creating the rectangle */ > this.r_r = new Clutter.CairoTexture((uint)this.width, > (uint)this.height); this is blatantly wrong. create the CairoTexture in your constructor and parent it to your actor; then create the contents of the CairoTexture during the allocation of the actor, to avoid needlessly updating the contents at each frame. > > this.r_r.set_position(0, 0); don't change the position during a paint. and (0, 0) is the default position anyway. > this.r_r.show_all(); > > this.r_r.unparent(); > this.r_r.set_parent(this); you are unparenting and then reparenting, and doing so inside a paint handler. > I got other issues, i first made this work by defining the > CairotTexture in the constructor, but > after that i can't change the color of the texture, or the size, or > anything like that, that's without talking > about the super long list of arguments of the constructor method. So > that approach, WRONG !!!. that approach is not wrong; it's just that you're implementing it in completely the wrong way - and then you changed the approach to something even *more* wrong. > What I'm trying to do moving the definition of the > Clutter.CairoTexture is get advantage of the already defined methods, > like > Clutter.Actor::set_size(), and so on. again, that doesn't make any sense. > Well, i hope i made clear (even if i don't think so). I suggest you look at other projects using Clutter and Cairo. > BTW: Do someone knows when is plan to add antialiasing functionality to Cogl > ?. the plan is to make Cairo paint using Cogl, and leave the anti-aliasing to Cairo anyway; anti-aliasing in GL is not implementable as a "one size fits all". ciao, Emmanuele. -- Emmanuele Bassi, Open Source Software Engineer Intel Open Source Technology Center _______________________________________________ clutter-app-devel-list mailing list [email protected] http://lists.clutter-project.org/listinfo/clutter-app-devel-list
