TTFRenderedText.cpp

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2004-2006 The Pentagram team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #include "pent_include.h"
00020 
00021 #include "TTFRenderedText.h"
00022 #include "TTFont.h"
00023 #include "RenderSurface.h"
00024 #include "Texture.h"
00025 
00026 DEFINE_RUNTIME_CLASSTYPE_CODE(TTFRenderedText,RenderedText);
00027 
00028 
00029 TTFRenderedText::TTFRenderedText(Texture* texture_, int width_, int height_,
00030                                                                  int vlead_, TTFont* font_)
00031         : texture(texture_), font(font_)
00032 {
00033         width = width_;
00034         height = height_;
00035         vlead = vlead_;
00036 }
00037 
00038 TTFRenderedText::~TTFRenderedText()
00039 {
00040         delete texture;
00041 }
00042 
00043 void TTFRenderedText::draw(RenderSurface* surface, int x, int y,
00044                                                    bool destmasked)
00045 {
00046         if (!destmasked)
00047                 surface->Blit(texture, 0, 0, width, height, x, y-font->getBaseline(),
00048                                           font->isAntialiased());
00049         else
00050                 surface->MaskedBlit(texture, 0, 0, width, height,
00051                                                         x, y-font->getBaseline(),
00052                                                         0, font->isAntialiased());
00053 }
00054 
00055 void TTFRenderedText::drawBlended(RenderSurface* surface, int x, int y,
00056                                                                   uint32 col, bool destmasked)
00057 {
00058         if (!destmasked)
00059                 surface->FadedBlit(texture, 0, 0, width, height,
00060                                                    x, y-font->getBaseline(), col,
00061                                                    font->isAntialiased());
00062         else
00063                 surface->MaskedBlit(texture, 0, 0, width, height,
00064                                                    x, y-font->getBaseline(), col,
00065                                                         font->isAntialiased());
00066 }
00067 

Generated on Fri Jul 27 22:27:45 2007 for pentagram by  doxygen 1.4.7