Object Hierarchy:

Object hierarchy for Fixed


public struct Fixed

COGL has a fixed point API targeted at platforms without a floating point unit, such as embedded devices.

On such platforms 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 notations conversion.

It is not recommened for use on platforms with a floating point unit (e.g. desktop systems), nor for use in language bindings.

Basic rules of Fixed Point arithmethic:

  • Two fixed point numbers can be directly added, subtracted and have their modulus taken.
  • 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 COGL_FIXED_MUL and COGL_FIXED_DIV macros.

The fixed point API is available since COGL 1.0.

Namespace: Cogl
Package: cogl-1.0


Static methods: