clutter-fixed
Fixed point API
Clutter has a fixed point API targeted at platforms without a floating
point unit, such as embedded devices. This API should be preferred to
the floating point one as it does not trigger the slow path of software
emulation, relying on integer math for fixed-to-floating and
floating-to-fixed conversion.
Basic Rules of Fixed Point Arithmetic
Two fixed point numbers can be directly added and subtracted.
To add other numerical type to a fixed point number it has to be first
converted to fixed point.
A fixed point number can be directly multiplied or divided by an integer.
Two fixed point numbers can only be multiplied and divided by the provided
#CLUTTER_FIXED_MUL (aka #CFX_MUL) and #CLUTTER_FIXED_DIV (aka #CFX_DIV) macros.
Number of bits used to store fractional part of #ClutterFixed.
#ClutterFixed representation of 1.
Maximum number representable by #ClutterFixed.
Minumum number representable by #ClutterFixed.
Alias for #CLUTTER_FIXED_DIV.
Alias for #CLUTTER_FIXED_INT.
Alias for #CLUTTER_FIXED_MUL.
Macro for converting #ClutterFixed to single precission floating point.
@x: #ClutterFixed
Macro for converting #ClutterFixed to double precission floating point.
@x: #ClutterFixed
Macro for converting floating point numbers to #ClutterFixed.
@x: double or float
Macro for converting floating point numbers to intergers; this conversion
is significantly faster that casting floats to int.
@x: float
Macro for converting integers to #ClutterFixed.
@x: int
Macro to obtain integer part of #ClutterFixed.
@x: #ClutterFixed
Macro to obtain the fraction of #ClutterFixed.
@x: #ClutterFixed
Macro to obtain greatest integer smaller than given #ClutterFixed.
@x: #ClutterFixed
Macro to obtain smallest integer greater than given #ClutterFixed.
@x: #ClutterFixed
Macro for multiplication of two #ClutterFixed numbers.
@x: #ClutterFixed
@y: #ClutterFixed
Macro for difvision of two #ClutterFixed numbers.
@x: #ClutterFixed
@y: #ClutterFixed
@angle:
@angle:
@angle:
@Returns:
@angle:
@Returns:
@x:
@Returns:
@x:
@Returns: