Thank you Neil. I shouldn't have missed this call in the API. * clutter_texture_set_pick_with_alpha* works nicely.
However, when two textures are inside a container, pick works on the rectangular boundaries, disregarding the alpha of the each texture. For this case can you please suggest any solutions? Also, I don't have any intentions to use COGL unless we have to use the cogl path to limiting the mouse events inside an actor. As you have outlined, getting the cogl path will not be difficult but displaying the cairo shape along with the cogl definition inside a custom Actor could be problematic. (subclassing, texture and drawing mechanisms are a bit confusing. But nothing I can't figure out with some directions & explaining.) On Mon, Mar 21, 2011 at 1:47 PM, Neil Roberts <[email protected]> wrote: > Veli Ogla Sungutay <[email protected]> wrote: > > > The Clutter cookbook shows how to create a non rectangular shaped > > actor. (Ex. A star shape). Let's say that we have the star shape as > > a cairo context, and we would like to display this cairo context as an > > Actor *which does not accept mouse events outside its path*. > > > > For this purpose I think we need to define the Cogl path. > > For actors that are subclassing ClutterTexture (which includes > ClutterCairoTexture) this is actually much simpler. Instead of trying to > paint the path in the pick method we can just paint the texture in a > special mode so that it paints the pick color where the texture is > opaque and paints nothing where the texture is semi-transparent. > ClutterTexture already has a property to implement this so to make it > work you only need to add this single line to your code: > > clutter_texture_set_pick_with_alpha (CLUTTER_TEXTURE (cairo_texture), > TRUE); > > However if for some reason you did want to get the Cogl path out of a > Cairo path, it shouldn't be too tricky even though there is no builtin > function to do it. If you look at the source code¹ for the > clutter_path_add_cairo_path function you can see how to extract the > nodes from a Cairo path. You could copy this function and just replace > all of the clutter_path_add_* calls with cogl_path_* calls. > > Regards, > - Neil > > ¹ http://ho.io/nzq3 > -- Veli Sungutay http://www.lyciasoft.com
_______________________________________________ clutter-app-devel-list mailing list [email protected] http://lists.clutter-project.org/listinfo/clutter-app-devel-list
