Clutter::Units(3pm)

NAME

Clutter::Units - A logical distance unit

SYNOPSIS

$units = { type => 'mm', value => 12.0 };
$pixels = $units->to_pixels();

$units = Clutter::Units->from_em(3, "Sans 16px");
print $units->{value};      # "3"
print $units->to_string();  # "3 em"

$units = Clutter::Units->from_string("12 pt");
print $units->{type};       # "pt"
print $units->to_pixels();

DESCRIPTION

Clutter::Units is a data structure holding a logical distance value along with its type, expressed as a value of the Clutter::UnitType
enumeration.

It is possible to use Clutter::Units to store a position or a size in
units different than pixels, and convert them whenever needed (for
instance inside the Clutter::Actor::allocate() virtual function, or inside the Clutter::Actor::get_preferred_width() and Clutter::Actor::get_preferred_height() virtual functions).

A Clutter::Units is represented by a hash reference with two keys,
type, holding the unit type; and value, holding the value for the specified type.

The type key can contain one of the following:

px : pixels
em : em
pt : typographic points
mm : millimeters

The value key must contain a double.

HIERARCHY

Glib::Boxed
+----Clutter::Units

METHODS

units = Clutter::Units->from_em ($em, $font_name=undef)
o $em (double)
o $font_name (string)
units = Clutter::Units->from_mm ($mm)
o $mm (double)
units = Clutter::Units->from_pixels ($pixels)
o $pixels (integer)
units = Clutter::Units->from_pt ($pt)
o $pt (double)
units = Clutter::Units->from_string ($string)
o $string (string)
double = $units->to_pixels string = $units->to_string

ENUMS AND FLAGS

enum Clutter::UnitType
o 'pixel' / 'CLUTTER_UNIT_PIXEL'
o 'em' / 'CLUTTER_UNIT_EM'
o 'mm' / 'CLUTTER_UNIT_MM'
o 'point' / 'CLUTTER_UNIT_POINT'

SEE ALSO

Clutter, Glib::Boxed

COPYRIGHT

Copyright (C) 2006, 2007, 2008 OpenedHand Ltd

Copyright (C) 2009 Intel Corporation

This module is free software; you can redistribute it and/or modify it under the terms of either:

o the GNU Lesser General Public Library version 2.1; or

o the Artistic License, version 2.0.

See Clutter for the full copyright notice.
Copyright © 2010-2025 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout