Hi

Rakesh Kumar <rakesh.ku...@kpitcummins.com> wrote:

> I have two texture one is rectangular texture and other one contains
> alpha texture that is non rectangular texture ,from this i would like
> to mask two texture and create new shape texture. How we can do this
> in clutter.

You should be able to do this with a custom material on a ClutterTexture
using multi-texturing. Assuming you have your alpha mask texture in a
CoglHandle and your base texture in a ClutterTexture you can do
something like this:

ClutterActor *base_texture = ...;
CoglHandle alpha_mask_texture = ...;
CoglHandle material;

/* Get the material from the Clutter texture */
material =
  clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (base_texture));
/* Add the alpha mask as a second texture layer */
cogl_material_set_layer (material, 1, alpha_mask_texture);
/* Set the combine function so that the base texture is modulated by the
   alpha component of the mask texture */
cogl_material_set_layer_combine (material, 1,
                                 "RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
                                 NULL);

If you need picking to work as well then you would need to subclass
ClutterTextue and override the pick method so that it draws a solid
rectangle masked by the alpha texture in a similar way.

You may want to take a look at Mutter¹ which does a similar thing to
support shaped windows.

- Neil

¹ http://ho.io/ck29
--
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com

Reply via email to