Module suzy::units[][src]

Convenience functions to convert between measurable units of visible size.

The default unit in Suzy is defined to be a ‘dp’ (1/96 inches, or a best approximation based on a user’s scaling factor.

The units inches, mm, cm are standard physical sizes.

The px unit represents a “real” pixel, regardless of scaling.

The cell unit represents some larger size (close to 16dp), which evenly divides the screen. This is intended for compatibility with character cell based interfaces, like a text-based terminal.

Constants

DPI

The ratio Suzy assumes between dp and inches.

Functions

cells

Convert a number of cells to a size in dp

cm

Convert centimeters to dp

dp

This function is an identity function, for API symetry.

inches

Convert inches to dp

mm

Convert millimeters to dp

px

Convert real physical pixels to dp

to_cells

Round dp to a cell boundry

to_cm

Convert dp to centimeters

to_dp

This function is an identity function, for API symetry.

to_inches

Convert dp to inches

to_mm

Convert dp to millimeters

to_px

Convert dp to real physical pixels