ClutterZoomAction

ClutterZoomAction — Action enabling zooming on actors

Synopsis

struct              ClutterZoomAction;
struct              ClutterZoomActionClass;
ClutterAction *     clutter_zoom_action_new             (void);
enum                ClutterZoomAxis;
void                clutter_zoom_action_set_zoom_axis   (ClutterZoomAction *action,
                                                         ClutterZoomAxis axis);
ClutterZoomAxis     clutter_zoom_action_get_zoom_axis   (ClutterZoomAction *action);

void                clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
                                                         ClutterPoint *point);
void                clutter_zoom_action_get_transformed_focal_point
                                                        (ClutterZoomAction *action,
                                                         ClutterPoint *point);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----ClutterActorMeta
               +----ClutterAction
                     +----ClutterGestureAction
                           +----ClutterZoomAction

Properties

  "zoom-axis"                ClutterZoomAxis       : Read / Write

Signals

  "zoom"                                           : Run Last

Description

ClutterZoomAction is a sub-class of ClutterGestureAction that implements all the necessary logic for zooming actors.

The simplest usage of ClutterZoomAction consists in adding it to a ClutterActor and setting it as reactive; for instance, the following code:

will automatically result in the actor to be scale according to the distance between 2 touch points.

Details

struct ClutterZoomAction

struct ClutterZoomAction;

The ClutterZoomAction structure contains only private data and should be accessed using the provided API

Since 1.12


struct ClutterZoomActionClass

struct ClutterZoomActionClass {
  gboolean (* zoom)  (ClutterZoomAction *action,
                      ClutterActor      *actor,
                      ClutterPoint      *focal_point,
                      gdouble            factor);
};

The ClutterZoomActionClass structure contains only private data

zoom ()

class handler of the "zoom" signal

Since 1.12


clutter_zoom_action_new ()

ClutterAction *     clutter_zoom_action_new             (void);

Creates a new ClutterZoomAction instance

Returns :

the newly created ClutterZoomAction

Since 1.12


enum ClutterZoomAxis

typedef enum {
 /*< prefix=CLUTTER_ZOOM >*/
  CLUTTER_ZOOM_X_AXIS,
  CLUTTER_ZOOM_Y_AXIS,
  CLUTTER_ZOOM_BOTH
} ClutterZoomAxis;

The axis of the constraint that should be applied by the zooming action.

CLUTTER_ZOOM_X_AXIS

Scale only on the X axis

CLUTTER_ZOOM_Y_AXIS

Scale only on the Y axis

CLUTTER_ZOOM_BOTH

Scale on both axis

Since 1.12


clutter_zoom_action_set_zoom_axis ()

void                clutter_zoom_action_set_zoom_axis   (ClutterZoomAction *action,
                                                         ClutterZoomAxis axis);

Restricts the zooming action to a specific axis

action :

a ClutterZoomAction

axis :

the axis to constraint the zooming to

Since 1.12


clutter_zoom_action_get_zoom_axis ()

ClutterZoomAxis     clutter_zoom_action_get_zoom_axis   (ClutterZoomAction *action);

Retrieves the axis constraint set by clutter_zoom_action_set_zoom_axis()

action :

a ClutterZoomAction

Returns :

the axis constraint

Since 1.12


clutter_zoom_action_get_focal_point ()

void                clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
                                                         ClutterPoint *point);

Retrieves the focal point of the current zoom

action :

a ClutterZoomAction

point :

a ClutterPoint. [out]

Since 1.12


clutter_zoom_action_get_transformed_focal_point ()

void                clutter_zoom_action_get_transformed_focal_point
                                                        (ClutterZoomAction *action,
                                                         ClutterPoint *point);

Retrieves the focal point relative to the actor's coordinates of the current zoom

action :

a ClutterZoomAction

point :

a ClutterPoint. [out]

Since 1.12

Property Details

The "zoom-axis" property

  "zoom-axis"                ClutterZoomAxis       : Read / Write

Constraints the zooming action to the specified axis

Default value: CLUTTER_ZOOM_BOTH

Since 1.12

Signal Details

The "zoom" signal

gboolean            user_function                      (ClutterZoomAction *action,
                                                        ClutterActor      *actor,
                                                        ClutterPoint      *distance,
                                                        gdouble            Returns,
                                                        gpointer           user_data)      : Run Last

The ::zoom signal is emitted for each touch event after the "zoom-begin" signal has been emitted.

The components of the distance between the touch begin event and the latest touch update event are computed in the actor's coordinate space, to take into account eventual transformations. If you want the stage coordinates of the latest motion event you can use clutter_zoom_action_get_motion_coords().

The default handler of the signal will call clutter_actor_set_scale() on actor using the ratio of the first distance between the 2 touch points and the current distance. If you want to override the default behaviour, you can connect to this signal and call g_signal_stop_emission_by_name() from within your callback.

action :

the ClutterZoomAction that emitted the signal

actor :

the ClutterActor attached to the action

distance :

the initial distance between the 2 touch points

user_data :

user data set when the signal handler was connected.

Returns :

TRUE if the zoom action has been handled by one of the listener or FALSE to continue the emission.

Since 1.12