⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ft2-computations.html

📁 Free type 2.1.0 Documents
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>FreeType-2.1.10 API Reference</title>
<style type="text/css">
  body { font-family: Verdana, Geneva, Arial, Helvetica, serif;
         color: #000000;
         background: #FFFFFF; }

  p { text-align: justify; }
  h1 { text-align: center; }
  li { text-align: justify; }

  a:link { color: #0000EF; }
  a:visited { color: #51188E; }
  a:hover { color: #FF0000; }

  span.keyword { font-family: monospace;
                 text-align: left;
                 white-space: pre;
                 color: darkblue; }

  pre.colored { color: blue; }

  ul.empty { list-style-type: none; }
</style>
</head>
<body>
<center><h1>FreeType-2.1.10 API Reference</h1></center>

<center><h1>
Computations
</h1></center>
<h2>Synopsis</h2>
<table align=center cellspacing=5 cellpadding=0 border=0>
<tr><td></td><td><a href="#FT_MulDiv">FT_MulDiv</a></td><td></td><td><a href="#FT_Matrix_Invert">FT_Matrix_Invert</a></td><td></td><td><a href="#FT_Tan">FT_Tan</a></td></tr>
<tr><td></td><td><a href="#FT_MulFix">FT_MulFix</a></td><td></td><td><a href="#FT_Angle">FT_Angle</a></td><td></td><td><a href="#FT_Atan2">FT_Atan2</a></td></tr>
<tr><td></td><td><a href="#FT_DivFix">FT_DivFix</a></td><td></td><td><a href="#FT_ANGLE_PI">FT_ANGLE_PI</a></td><td></td><td><a href="#FT_Angle_Diff">FT_Angle_Diff</a></td></tr>
<tr><td></td><td><a href="#FT_RoundFix">FT_RoundFix</a></td><td></td><td><a href="#FT_ANGLE_2PI">FT_ANGLE_2PI</a></td><td></td><td><a href="#FT_Vector_Unit">FT_Vector_Unit</a></td></tr>
<tr><td></td><td><a href="#FT_CeilFix">FT_CeilFix</a></td><td></td><td><a href="#FT_ANGLE_PI2">FT_ANGLE_PI2</a></td><td></td><td><a href="#FT_Vector_Rotate">FT_Vector_Rotate</a></td></tr>
<tr><td></td><td><a href="#FT_FloorFix">FT_FloorFix</a></td><td></td><td><a href="#FT_ANGLE_PI4">FT_ANGLE_PI4</a></td><td></td><td><a href="#FT_Vector_Length">FT_Vector_Length</a></td></tr>
<tr><td></td><td><a href="#FT_Vector_Transform">FT_Vector_Transform</a></td><td></td><td><a href="#FT_Sin">FT_Sin</a></td><td></td><td><a href="#FT_Vector_Polarize">FT_Vector_Polarize</a></td></tr>
<tr><td></td><td><a href="#FT_Matrix_Multiply">FT_Matrix_Multiply</a></td><td></td><td><a href="#FT_Cos">FT_Cos</a></td><td></td><td><a href="#FT_Vector_From_Polar">FT_Vector_From_Polar</a></td></tr>
</table><br><br>

<table align=center width="87%"><tr><td>
<p>This section contains various functions used to perform computations on 16.16 fixed-float numbers or 2d vectors.</p>
</td></tr></table><br>
<table align=center width="75%"><tr><td>
<h4><a name="FT_MulDiv">FT_MulDiv</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <a href="ft2-basic_types.html#FT_Long">FT_Long</a> )
  <b>FT_MulDiv</b>( <a href="ft2-basic_types.html#FT_Long">FT_Long</a>  a,
             <a href="ft2-basic_types.html#FT_Long">FT_Long</a>  b,
             <a href="ft2-basic_types.html#FT_Long">FT_Long</a>  c );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>A very simple function used to perform the computation `(a*b)/c' with maximal accuracy (it uses a 64-bit intermediate integer whenever necessary).</p>
<p>This function isn't necessarily as fast as some processor specific operations, but is at least completely portable.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>a</b></td><td>
<p>The first multiplier.</p>
</td></tr>
<tr valign=top><td><b>b</b></td><td>
<p>The second multiplier.</p>
</td></tr>
<tr valign=top><td><b>c</b></td><td>
<p>The divisor.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The result of `(a*b)/c'. This function never traps when trying to divide by zero; it simply returns `MaxInt' or `MinInt' depending on the signs of `a' and `b'.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_MulFix">FT_MulFix</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <a href="ft2-basic_types.html#FT_Long">FT_Long</a> )
  <b>FT_MulFix</b>( <a href="ft2-basic_types.html#FT_Long">FT_Long</a>  a,
             <a href="ft2-basic_types.html#FT_Long">FT_Long</a>  b );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>A very simple function used to perform the computation `(a*b)/0x10000' with maximal accuracy. Most of the time this is used to multiply a given value by a 16.16 fixed float factor.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>a</b></td><td>
<p>The first multiplier.</p>
</td></tr>
<tr valign=top><td><b>b</b></td><td>
<p>The second multiplier. Use a 16.16 factor here whenever possible (see note below).</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The result of `(a*b)/0x10000'.</p>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
<p>This function has been optimized for the case where the absolute value of `a' is less than 2048, and `b' is a 16.16 scaling factor. As this happens mainly when scaling from notional units to fractional pixels in FreeType, it resulted in noticeable speed improvements between versions 2.x and 1.x.</p>
<p>As a conclusion, always try to place a 16.16 factor as the <i>second</i> argument of this function; this can make a great difference.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_DivFix">FT_DivFix</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <a href="ft2-basic_types.html#FT_Long">FT_Long</a> )
  <b>FT_DivFix</b>( <a href="ft2-basic_types.html#FT_Long">FT_Long</a>  a,
             <a href="ft2-basic_types.html#FT_Long">FT_Long</a>  b );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>A very simple function used to perform the computation `(a*0x10000)/b' with maximal accuracy. Most of the time, this is used to divide a given value by a 16.16 fixed float factor.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>a</b></td><td>
<p>The first multiplier.</p>
</td></tr>
<tr valign=top><td><b>b</b></td><td>
<p>The second multiplier. Use a 16.16 factor here whenever possible (see note below).</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The result of `(a*0x10000)/b'.</p>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
<p>The optimization for FT_DivFix() is simple: If (a &lt;&lt; 16) fits in 32 bits, then the division is computed directly. Otherwise, we use a specialized version of <a href="ft2-computations.html#FT_MulDiv">FT_MulDiv</a>.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_RoundFix">FT_RoundFix</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> )
  <b>FT_RoundFix</b>( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a>  a );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>A very simple function used to round a 16.16 fixed number.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>a</b></td><td>
<p>The number to be rounded.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The result of `(a + 0x8000) &amp; -0x10000'.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_CeilFix">FT_CeilFix</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> )
  <b>FT_CeilFix</b>( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a>  a );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>A very simple function used to compute the ceiling function of a 16.16 fixed number.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>a</b></td><td>
<p>The number for which the ceiling function is to be computed.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The result of `(a + 0x10000 - 1) &amp; -0x10000'.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_FloorFix">FT_FloorFix</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a> )
  <b>FT_FloorFix</b>( <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a>  a );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>A very simple function used to compute the floor function of a 16.16 fixed number.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>a</b></td><td>
<p>The number for which the floor function is to be computed.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>The result of `a &amp; -0x10000'.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Vector_Transform">FT_Vector_Transform</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <span class="keyword">void</span> )
  <b>FT_Vector_Transform</b>( <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a>*        vec,
                       <span class="keyword">const</span> <a href="ft2-basic_types.html#FT_Matrix">FT_Matrix</a>*  matrix );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Transforms a single vector through a 2x2 matrix.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>inout</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>vector</b></td><td>
<p>The target vector to transform.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>matrix</b></td><td>
<p>A pointer to the source 2x2 matrix.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
<p>The result is undefined if either `vector' or `matrix' is invalid.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Matrix_Multiply">FT_Matrix_Multiply</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <span class="keyword">void</span> )
  <b>FT_Matrix_Multiply</b>( <span class="keyword">const</span> <a href="ft2-basic_types.html#FT_Matrix">FT_Matrix</a>*  a,
                      <a href="ft2-basic_types.html#FT_Matrix">FT_Matrix</a>*  b );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Performs the matrix operation `b = a*b'.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>a</b></td><td>
<p>A pointer to matrix `a'.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>inout</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>b</b></td><td>
<p>A pointer to matrix `b'.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
<p>The result is undefined if either `a' or `b' is zero.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Matrix_Invert">FT_Matrix_Invert</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
  <b>FT_Matrix_Invert</b>( <a href="ft2-basic_types.html#FT_Matrix">FT_Matrix</a>*  matrix );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Inverts a 2x2 matrix. Returns an error if it can't be inverted.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>inout</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>matrix</b></td><td>
<p>A pointer to the target matrix. Remains untouched in case of error.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>FreeType error code. 0 means success.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Angle">FT_Angle</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  <span class="keyword">typedef</span> <a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a>  <b>FT_Angle</b>;

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>This type is used to model angle values in FreeType. Note that the angle is a 16.16 fixed float value expressed in degrees.</p>
</td></tr></table><br>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_ANGLE_PI">FT_ANGLE_PI</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

#define <b>FT_ANGLE_PI</b>  ( 180L &lt;&lt; 16 )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -