### Struct

# Clutter Units

#### Description [src]

    struct ClutterUnits {
      /* No available fields */
    }

A logical distance unit

`ClutterUnits` is a structure holding a logical distance value along with its type, expressed as a value of the `ClutterUnitType` enumeration. It is possible to use `ClutterUnits` to store a position or a size in units different than pixels, and convert them whenever needed (for instance inside the `Clutter.ActorClass.allocate` virtual function, or inside the `Clutter.ActorClass.get_preferred_width` and `Clutter.ActorClass.get_preferred_height` virtual functions.

In order to register a `ClutterUnits` property, the `ClutterParamSpecUnit` `GParamSpec` sub-class should be used:

      GParamSpec *pspec;

      pspec = clutter_param_spec_units ("active-width",
                                        "Width",
                                        "Width of the active area, in millimeters",
                                        CLUTTER_UNIT_MM,
                                        0.0, 12.0,
                                        12.0,
                                        G_PARAM_READWRITE);
      g_object_class_install_property (gobject_class, PROP_WIDTH, pspec);

A `GValue` holding units can be manipulated using `clutter_value_set_units()` and `clutter_value_get_units()`. `GValue`s containing a `ClutterUnits` value can also be transformed to `GValue`s initialized with `G_TYPE_INT`, `G_TYPE_FLOAT` and `G_TYPE_STRING` through implicit conversion and using `g_value_transform()`.

#### Functions

###### clutter_units_from_cm

Stores a value in centimeters inside `units`.

###### clutter_units_from_em

Stores a value in em inside `units`, using the default font name.

###### clutter_units_from_em_for_font

Stores a value in em inside `units` using `font_name`.

###### clutter_units_from_mm

Stores a value in millimiters inside `units`.

###### clutter_units_from_pixels

Stores a value in pixels inside `units`.

###### clutter_units_from_pt

Stores a value in typographic points inside `units`.

###### clutter_units_from_string

Parses a value and updates `units` with it.

#### Instance methods

###### clutter_units_copy

Copies `units`.

###### clutter_units_free

Frees the resources allocated by `units`.

###### clutter_units_get_unit_type

Retrieves the unit type of the value stored inside `units`.

###### clutter_units_get_unit_value

Retrieves the value stored inside `units`.

###### clutter_units_to_pixels

Converts a value in `ClutterUnits` to pixels.

###### clutter_units_to_string

Converts `units` into a string.