Important: The information in this document is obsolete and should not be used for new development.
Converting Number Formats
You can use QuickDraw GX macros to convert betweenFixed,fract, integer, floating-point, and gxColorValue number formats. Macros are also provided to round, truncate, and compute the square root of a fixed-point number.For example, you can use the
IntToFixedmacro to convert an integer to aFixedformat and you can use theFloatToFixedmacro to convert from a floating-point format to aFixedformat. The functionality of theFloatToFixedmacro is also provided as the shortenedflmacro. The functionality of theIntToFixedmacro is also provided as the shortenedffmacro.The
ffmacro is especially useful when you are coding specific points in your application. For example, it's easier to define a line in your application using theffmacro:
gxLine lineData = {ff(25), ff(25) , ff(125), ff(125)};than to use the equivalent, but much longerIntToFixedmacro:
gxLine lineData = {IntToFixed(25), IntToFixed(25), IntToFixed(125), IntToFixed(125)};For constants, usingffis faster and more efficient than usingfl, becauseffis evaluated at compile time, whereasflis evaluated at run time.The
IntToFixedmacro is described on page 8-37. TheFloatToFixedmacro is described on page 8-39. Theflmacro is described on page 8-39. Theffmacro is described on page 8-38.
 
  
  
 