コード例 #1
0
/**
 * clutter_deform_effect_get_back_material:
 * @effect: a #ClutterDeformEffect
 *
 * Retrieves the handle to the back face material used by @effect
 *
 * Return value: (transfer none): a handle for the material, or %NULL.
 *   The returned material is owned by the #ClutterDeformEffect and it
 *   should not be freed directly
 *
 * Since: 1.4
 */
CoglHandle
clutter_deform_effect_get_back_material (ClutterDeformEffect *effect)
{
  g_return_val_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect), NULL);

  return effect->priv->back_pipeline;
}
コード例 #2
0
/**
 * clutter_deform_effect_get_n_tiles:
 * @effect: a #ClutterDeformEffect
 * @x_tiles: (out): return location for the number of horizontal tiles,
 *   or %NULL
 * @y_tiles: (out): return location for the number of vertical tiles,
 *   or %NULL
 *
 * Retrieves the number of horizontal and vertical tiles used to sub-divide
 * the actor's geometry during the effect
 *
 * Since: 1.4
 */
void
clutter_deform_effect_get_n_tiles (ClutterDeformEffect *effect,
                                   guint               *x_tiles,
                                   guint               *y_tiles)
{
  g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));

  if (x_tiles != NULL)
    *x_tiles = effect->priv->x_tiles;

  if (y_tiles != NULL)
    *y_tiles = effect->priv->y_tiles;
}
コード例 #3
0
/**
 * clutter_deform_effect_invalidate:
 * @effect: a #ClutterDeformEffect
 *
 * Invalidates the @effect<!-- -->'s vertices and, if it is associated
 * to an actor, it will queue a redraw
 *
 * Since: 1.4
 */
void
clutter_deform_effect_invalidate (ClutterDeformEffect *effect)
{
  ClutterActor *actor;

  g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));

  if (effect->priv->is_dirty)
    return;

  effect->priv->is_dirty = TRUE;

  actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
  if (actor != NULL)
    clutter_effect_queue_repaint (CLUTTER_EFFECT (effect));
}
コード例 #4
0
ファイル: clutter-deform-effect.c プロジェクト: rib/clutter
/**
 * clutter_deform_effect_set_back_material:
 * @effect: a #ClutterDeformEffect
 * @material: (allow-none): a handle to a Cogl material
 *
 * Sets the material that should be used when drawing the back face
 * of the actor during a deformation
 *
 * The #ClutterDeformEffect will take a reference on the material's
 * handle
 *
 * Since: 1.4
 */
void
clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
                                         CoglHandle           material)
{
  ClutterDeformEffectPrivate *priv;

  g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
  g_return_if_fail (material == COGL_INVALID_HANDLE || cogl_is_material (material));

  priv = effect->priv;

  clutter_deform_effect_free_back_material (effect);

  priv->back_material = material;
  if (priv->back_material != COGL_INVALID_HANDLE)
    cogl_handle_ref (priv->back_material);

  clutter_deform_effect_invalidate (effect);
}
コード例 #5
0
/**
 * clutter_deform_effect_set_back_material:
 * @effect: a #ClutterDeformEffect
 * @material: (allow-none): a handle to a Cogl material
 *
 * Sets the material that should be used when drawing the back face
 * of the actor during a deformation
 *
 * The #ClutterDeformEffect will take a reference on the material's
 * handle
 *
 * Since: 1.4
 */
void
clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
                                         CoglHandle           material)
{
  ClutterDeformEffectPrivate *priv;
  CoglPipeline *pipeline = COGL_PIPELINE (material);

  g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
  g_return_if_fail (pipeline == NULL || cogl_is_pipeline (pipeline));

  priv = effect->priv;

  clutter_deform_effect_free_back_pipeline (effect);

  priv->back_pipeline = material;
  if (priv->back_pipeline != NULL)
    cogl_object_ref (priv->back_pipeline);

  clutter_deform_effect_invalidate (effect);
}
コード例 #6
0
/**
 * clutter_deform_effect_set_n_tiles:
 * @effect: a #ClutterDeformEffect
 * @x_tiles: number of horizontal tiles
 * @y_tiles: number of vertical tiles
 *
 * Sets the number of horizontal and vertical tiles to be used
 * when applying the effect
 *
 * More tiles allow a finer grained deformation at the expenses
 * of computation
 *
 * Since: 1.4
 */
void
clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect,
                                   guint                x_tiles,
                                   guint                y_tiles)
{
  ClutterDeformEffectPrivate *priv;
  gboolean tiles_changed = FALSE;

  g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
  g_return_if_fail (x_tiles > 0 && y_tiles > 0);

  priv = effect->priv;

  g_object_freeze_notify (G_OBJECT (effect));

  if (priv->x_tiles != x_tiles)
    {
      priv->x_tiles = x_tiles;

      g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_X_TILES]);

      tiles_changed = TRUE;
    }

  if (priv->y_tiles != y_tiles)
    {
      priv->y_tiles = y_tiles;

      g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_Y_TILES]);

      tiles_changed = TRUE;
    }

  if (tiles_changed)
    {
      clutter_deform_effect_init_arrays (effect);
      clutter_deform_effect_invalidate (effect);
    }

  g_object_thaw_notify (G_OBJECT (effect));
}