| <!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"> |
| </head><body> |
| <!-- Generated by Doxygen 1.3.6 --> |
| <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div> |
| <h1>FTOutlineGlyph.cpp</h1><a href="FTOutlineGlyph_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#include "<a class="code" href="FTOutlineGlyph_8h.html">FTOutlineGlyph.h</a>"</span> |
| 00002 <span class="preprocessor">#include "<a class="code" href="FTVectoriser_8h.html">FTVectoriser.h</a>"</span> |
| 00003 |
| 00004 |
| <a name="l00005"></a><a class="code" href="classFTOutlineGlyph.html#a0">00005</a> <a class="code" href="classFTOutlineGlyph.html#a0">FTOutlineGlyph::FTOutlineGlyph</a>( FT_GlyphSlot glyph, <span class="keywordtype">bool</span> useDisplayList) |
| 00006 : <a class="code" href="classFTGlyph.html">FTGlyph</a>( glyph), |
| 00007 glList(0) |
| 00008 { |
| 00009 <span class="keywordflow">if</span>( ft_glyph_format_outline != glyph->format) |
| 00010 { |
| 00011 err = 0x14; <span class="comment">// Invalid_Outline</span> |
| 00012 <span class="keywordflow">return</span>; |
| 00013 } |
| 00014 |
| 00015 <a class="code" href="classFTVectoriser.html">FTVectoriser</a> vectoriser( glyph); |
| 00016 |
| 00017 size_t numContours = vectoriser.<a class="code" href="classFTVectoriser.html#a5">ContourCount</a>(); |
| 00018 <span class="keywordflow">if</span> ( ( numContours < 1) || ( vectoriser.<a class="code" href="classFTVectoriser.html#a4">PointCount</a>() < 3)) |
| 00019 { |
| 00020 <span class="keywordflow">return</span>; |
| 00021 } |
| 00022 |
| 00023 <span class="keywordflow">if</span>(useDisplayList) |
| 00024 { |
| 00025 glList = glGenLists(1); |
| 00026 glNewList( glList, GL_COMPILE); |
| 00027 } |
| 00028 |
| 00029 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> c = 0; c < numContours; ++c) |
| 00030 { |
| 00031 <span class="keyword">const</span> <a class="code" href="classFTContour.html">FTContour</a>* contour = vectoriser.<a class="code" href="classFTVectoriser.html#a6">Contour</a>(c); |
| 00032 |
| 00033 glBegin( GL_LINE_LOOP); |
| 00034 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pointIndex = 0; pointIndex < contour-><a class="code" href="classFTContour.html#a3">PointCount</a>(); ++pointIndex) |
| 00035 { |
| 00036 <a class="code" href="classFTPoint.html">FTPoint</a> point = contour-><a class="code" href="classFTContour.html#a2">Point</a>(pointIndex); |
| 00037 glVertex2f( point.<a class="code" href="classFTPoint.html#a7">X</a>() / 64.0f, point.<a class="code" href="classFTPoint.html#a8">Y</a>() / 64.0f); |
| 00038 } |
| 00039 glEnd(); |
| 00040 } |
| 00041 |
| 00042 <span class="keywordflow">if</span>(useDisplayList) |
| 00043 { |
| 00044 glEndList(); |
| 00045 } |
| 00046 } |
| 00047 |
| 00048 |
| <a name="l00049"></a><a class="code" href="classFTOutlineGlyph.html#a1">00049</a> <a class="code" href="classFTOutlineGlyph.html#a1">FTOutlineGlyph::~FTOutlineGlyph</a>() |
| 00050 { |
| 00051 glDeleteLists( glList, 1); |
| 00052 } |
| 00053 |
| 00054 |
| <a name="l00055"></a><a class="code" href="classFTOutlineGlyph.html#a2">00055</a> <span class="keyword">const</span> <a class="code" href="classFTPoint.html">FTPoint</a>& <a class="code" href="classFTOutlineGlyph.html#a2">FTOutlineGlyph::Render</a>( <span class="keyword">const</span> <a class="code" href="classFTPoint.html">FTPoint</a>& pen) |
| 00056 { |
| 00057 glTranslatef( pen.<a class="code" href="classFTPoint.html#a7">X</a>(), pen.<a class="code" href="classFTPoint.html#a8">Y</a>(), 0.0f); |
| 00058 |
| 00059 <span class="keywordflow">if</span>( glList) |
| 00060 { |
| 00061 glCallList( glList); |
| 00062 } |
| 00063 |
| 00064 <span class="keywordflow">return</span> advance; |
| 00065 } |
| 00066 |
| </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Dec 5 22:24:06 2004 for FTGL by |
| <a href="http://www.doxygen.org/index.html"> |
| <img src="doxygen.png" alt="doxygen" align="middle" border=0 > |
| </a>1.3.6 </small></address> |
| </body> |
| </html> |