Gimp.Unit
Description: Reference for Gimp.Unit

### Class

# GimpUnit

#### Description [src]

    final class Gimp.Unit : GObject.Object
    {
      /* No available fields */
    }

Provides operations on units, a collection of predefined units and functions to create new units.

#### Hierarchy

#### Ancestors

- GObject

#### Constructors

###### gimp_unit_new

Creates a new unit.

#### Functions

###### gimp_unit_format_string

The `format` string supports the following percent expansions:.

since: 2.8

###### gimp_unit_get_by_id

Returns the unique `GimpUnit` object corresponding to `unit_id`, which is the integer identifier as returned by `gimp_unit_get_id()`.

since: 3.0

###### gimp_unit_inch

Returns the unique object representing inch unit.

since: 3.0

###### gimp_unit_mm

Returns the unique object representing millimeter unit.

since: 3.0

###### gimp_unit_percent

Returns the unique object representing percent dimensions relatively to an image.

since: 3.0

###### gimp_unit_pica

Returns the unique object representing Pica unit.

since: 3.0

###### gimp_unit_pixel

Returns the unique object representing pixel unit.

since: 3.0

###### gimp_unit_point

Returns the unique object representing typographical point unit.

since: 3.0

#### Instance methods

###### gimp_unit_get_abbreviation

This function returns the abbreviation of the unit (e.g. “in” for inches). It can be used as a short label for the unit in the interface. For long labels, use `gimp_unit_get_name()`.

###### gimp_unit_get_deletion_flag

No description available.

###### gimp_unit_get_digits

Returns the number of digits set for `unit`. Built-in units’ accuracy is approximately the same as an inch with two digits. User-defined units can suggest a different accuracy.

###### gimp_unit_get_factor

A `GimpUnit`‘s `factor` is defined to be:.

###### gimp_unit_get_id

The ID can be used to retrieve the unit with `gimp_unit_get_by_id()`.

###### gimp_unit_get_name

This function returns the usual name of the unit (e.g. “inches”). It can be used as the long label for the unit in the interface. For short labels, use `gimp_unit_get_abbreviation()`.

###### gimp_unit_get_scaled_digits

Returns the number of digits a `unit` field should provide to get enough accuracy so that every pixel position shows a different value from neighboring pixels.

###### gimp_unit_get_symbol

This is e.g. “”” for UNIT_INCH.

###### gimp_unit_is_built_in

Returns whether the unit is built-in.

since: 3.0

###### gimp_unit_is_metric

Checks if the given `unit` is metric. A simplistic test is used that looks at the unit’s factor and checks if it is 2.54 multiplied by some common powers of 10. Currently it checks for mm, cm, dm, m.

since: 2.10

###### gimp_unit_set_deletion_flag

Sets a `GimpUnit`‘s `deletion_flag`. If the `deletion_flag` of a unit is `TRUE` when GIMP exits, this unit will not be saved in the users’s “unitrc” file.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Gimp.Unit:abbreviation

No description available.

###### Gimp.Unit:digits

No description available.

###### Gimp.Unit:factor

No description available.

###### Gimp.Unit:id

No description available.

###### Gimp.Unit:name

No description available.

###### Gimp.Unit:symbol

No description available.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct GimpUnitClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.