gml_TFraction Class Reference

#include <gml_Fraction.h>

Collaboration diagram for gml_TFraction:

Collaboration graph
[legend]
List of all members.

Detailed Description

Fast integer representation of a floating-point number between 0 and 1. Provides a Merge() method for fast blending of two integers (e.g. for alpha-compositing purposes).


Public Member Functions

 gml_TFraction (Float32 fraction)
 Build a gml_TFraction from the IEEE 32-bit float fraction.
 gml_TFraction (UInt32 numerator, UInt8 exponent)
 Build a gml_TFraction as numerator / 2 ** exponent.
 gml_TFraction ()
 Build the fraction representing 1.
UInt32 Merge (const UInt32 a, const UInt32 b) const
 Return a*f + b*(1-f) using only integer arithmetics.
UInt32 Numerator () const
 Return the numerator.
UInt8 Exponent () const
 Return the exponent.
Float32 Value () const
 Return the floating-point value corresponding to this fraction.

Protected Attributes

UInt8 fExponent
 the opposite of the fraction's power-of-two exponent
UInt32 fNumerator1
 the fraction's numerator
UInt32 fNumerator2
 the numerator of the fraction's complement to 1

The documentation for this class was generated from the following file:
Generated on Tue Jun 12 14:03:28 2007 for gml by Doxygen 1.5.2.