| <!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: FTBufferGlyph.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>FTBufferGlyph.cpp</h1><a href="FTBufferGlyph_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#include "<a class="code" href="FTBufferGlyph_8h.html">FTBufferGlyph.h</a>"</span> |
| 00002 |
| <a name="l00003"></a><a class="code" href="classFTBufferGlyph.html#a0">00003</a> <a class="code" href="classFTBufferGlyph.html#a0">FTBufferGlyph::FTBufferGlyph</a>( FT_GlyphSlot glyph, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* b) |
| 00004 : <a class="code" href="classFTGlyph.html">FTGlyph</a>( glyph), |
| 00005 destWidth(0), |
| 00006 destHeight(0), |
| 00007 data(0), |
| 00008 buffer(b) |
| 00009 { |
| 00010 err = FT_Render_Glyph( glyph, <a class="code" href="FTGL_8h.html#a2">FT_RENDER_MODE_NORMAL</a>); |
| 00011 <span class="keywordflow">if</span>( err || ft_glyph_format_bitmap != glyph->format) |
| 00012 { |
| 00013 <span class="keywordflow">return</span>; |
| 00014 } |
| 00015 |
| 00016 FT_Bitmap bitmap = glyph->bitmap; |
| 00017 |
| 00018 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> srcWidth = bitmap.width; |
| 00019 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> srcHeight = bitmap.rows; |
| 00020 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> srcPitch = bitmap.pitch; |
| 00021 |
| 00022 destWidth = srcWidth; |
| 00023 destHeight = srcHeight; |
| 00024 destPitch = srcPitch; |
| 00025 |
| 00026 <span class="keywordflow">if</span>( destWidth && destHeight) |
| 00027 { |
| 00028 data = <span class="keyword">new</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>[destPitch * destHeight]; |
| 00029 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* dest = data + (( destHeight - 1) * destPitch); |
| 00030 |
| 00031 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* src = bitmap.buffer; |
| 00032 |
| 00033 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> y = 0; y < srcHeight; ++y) |
| 00034 { |
| 00035 memcpy( dest, src, srcPitch); |
| 00036 dest -= destPitch; |
| 00037 src += srcPitch; |
| 00038 } |
| 00039 } |
| 00040 |
| 00041 pos.x = glyph->bitmap_left; |
| 00042 pos.y = srcHeight - glyph->bitmap_top; |
| 00043 } |
| 00044 |
| 00045 |
| <a name="l00046"></a><a class="code" href="classFTBufferGlyph.html#a1">00046</a> <a class="code" href="classFTBufferGlyph.html#a1">FTBufferGlyph::~FTBufferGlyph</a>() |
| 00047 { |
| 00048 <span class="keyword">delete</span> [] data; |
| 00049 } |
| 00050 |
| 00051 |
| <a name="l00052"></a><a class="code" href="classFTBufferGlyph.html#a2">00052</a> <span class="keywordtype">float</span> <a class="code" href="classFTBufferGlyph.html#a2">FTBufferGlyph::Render</a>( <span class="keyword">const</span> <a class="code" href="classFTPoint.html">FTPoint</a>& pen) |
| 00053 { |
| 00054 <span class="keywordflow">if</span>( data && buffer) |
| 00055 { |
| 00056 } |
| 00057 |
| 00058 <span class="keywordflow">return</span> advance; |
| 00059 } |
| </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Dec 5 22:11:47 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> |