Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals

FTBufferGlyph.cpp

Go to the documentation of this file.
00001 #include    "FTBufferGlyph.h"
00002 
00003 FTBufferGlyph::FTBufferGlyph( FT_GlyphSlot glyph, unsigned char* b)
00004 :   FTGlyph( glyph),
00005     destWidth(0),
00006     destHeight(0),
00007     data(0),
00008     buffer(b)
00009 {
00010     err = FT_Render_Glyph( glyph, FT_RENDER_MODE_NORMAL);
00011     if( err || ft_glyph_format_bitmap != glyph->format)
00012     {
00013         return;
00014     }
00015 
00016     FT_Bitmap bitmap = glyph->bitmap;
00017 
00018     unsigned int srcWidth = bitmap.width;
00019     unsigned int srcHeight = bitmap.rows;
00020     unsigned int srcPitch = bitmap.pitch;
00021     
00022     destWidth = srcWidth;
00023     destHeight = srcHeight;
00024     destPitch = srcPitch;    
00025 
00026     if( destWidth && destHeight)
00027     {
00028         data = new unsigned char[destPitch * destHeight];
00029         unsigned char* dest = data + (( destHeight - 1) * destPitch);
00030 
00031         unsigned char* src = bitmap.buffer;
00032 
00033         for( unsigned int 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 
00046 FTBufferGlyph::~FTBufferGlyph()
00047 {
00048     delete [] data;
00049 }
00050 
00051 
00052 float FTBufferGlyph::Render( const FTPoint& pen)
00053 {
00054     if( data && buffer)
00055     {
00056     }
00057 
00058     return advance;
00059 }

Generated on Sun Dec 5 22:11:47 2004 for FTGL by doxygen 1.3.6