Sophie

Sophie

distrib > Mandriva > 2007.0 > x86_64 > by-pkgid > 1a7919977dcfbccb7898bea385b0e529 > files > 70

lib64ftgl0-devel-2.0.11-5mdv2007.0.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>FTGL: FTOutlineGlyph.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
  </ul></div>
<div class="tabs">
  <ul>
    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
  </ul></div>
<h1>FTOutlineGlyph.cpp</h1><a href="FTOutlineGlyph_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include    "FTOutlineGlyph.h"</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include    "FTVectoriser.h"</span>
<a name="l00003"></a>00003 
<a name="l00004"></a>00004 
<a name="l00005"></a>00005 FTOutlineGlyph::FTOutlineGlyph( FT_GlyphSlot glyph)
<a name="l00006"></a>00006 :   FTGlyph( glyph),
<a name="l00007"></a>00007     glList(0)
<a name="l00008"></a>00008 {
<a name="l00009"></a>00009     <span class="keywordflow">if</span>( ft_glyph_format_outline != glyph-&gt;format)
<a name="l00010"></a>00010     {
<a name="l00011"></a>00011         err = 0x14; <span class="comment">// Invalid_Outline</span>
<a name="l00012"></a>00012         <span class="keywordflow">return</span>;
<a name="l00013"></a>00013     }
<a name="l00014"></a>00014 
<a name="l00015"></a>00015     FTVectoriser vectoriser( glyph);
<a name="l00016"></a>00016 
<a name="l00017"></a>00017     size_t numContours = vectoriser.ContourCount();
<a name="l00018"></a>00018     <span class="keywordflow">if</span> ( ( numContours &lt; 1) || ( vectoriser.PointCount() &lt; 3))
<a name="l00019"></a>00019     {
<a name="l00020"></a>00020         <span class="keywordflow">return</span>;
<a name="l00021"></a>00021     }
<a name="l00022"></a>00022 
<a name="l00023"></a>00023     glList = glGenLists(1);
<a name="l00024"></a>00024     glNewList( glList, GL_COMPILE);
<a name="l00025"></a>00025         <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> c = 0; c &lt; numContours; ++c)
<a name="l00026"></a>00026         {
<a name="l00027"></a>00027             <span class="keyword">const</span> FTContour* contour = vectoriser.Contour(c);
<a name="l00028"></a>00028             
<a name="l00029"></a>00029             glBegin( GL_LINE_LOOP);
<a name="l00030"></a>00030                 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> p = 0; p &lt; contour-&gt;PointCount(); ++p)
<a name="l00031"></a>00031                 {
<a name="l00032"></a>00032                     glVertex2f( contour-&gt;Point(p).x / 64.0f, contour-&gt;Point(p).y / 64.0f);
<a name="l00033"></a>00033                 }
<a name="l00034"></a>00034             glEnd();
<a name="l00035"></a>00035         }
<a name="l00036"></a>00036     glEndList();
<a name="l00037"></a>00037 }
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 FTOutlineGlyph::~FTOutlineGlyph()
<a name="l00041"></a>00041 {
<a name="l00042"></a>00042     glDeleteLists( glList, 1);
<a name="l00043"></a>00043 }
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 <span class="keywordtype">float</span> FTOutlineGlyph::Render( <span class="keyword">const</span> FTPoint&amp; pen)
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048     <span class="keywordflow">if</span>( glList)
<a name="l00049"></a>00049     {
<a name="l00050"></a>00050         glTranslatef( pen.x, pen.y, 0);
<a name="l00051"></a>00051             glCallList( glList);
<a name="l00052"></a>00052         glTranslatef( -pen.x, -pen.y, 0);
<a name="l00053"></a>00053     }
<a name="l00054"></a>00054     
<a name="l00055"></a>00055     <span class="keywordflow">return</span> advance;
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057 
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Aug 23 03:47:29 2006 for FTGL by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>