Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

pgdraw.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000,2001,2002  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: mbickel $
00023     Update Date:      $Date: 2007-04-13 16:15:56 $
00024     Source File:      $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/pgdraw.h,v $
00025     CVS/RCS Revision: $Revision: 1.2 $
00026     Status:           $State: Exp $
00027 */
00028 
00034 #ifndef PG_DRAW_H
00035 #define PG_DRAW_H
00036 
00037 #include "pgrect.h"
00038 #include "pgcolor.h"
00039 
00040 #ifndef M_PI
00041 
00045 #define M_PI 3.14159265359
00046 #endif // M_PI
00047 
00048 namespace PG_Draw {
00049 
00050 // Background modes
00051 enum BkMode {
00052     TILE,
00057     STRETCH,
00064     TILE3H,
00069     TILE3V,
00074     TILE9
00075 };
00076 
00083 
00084 
00098 DECLSPEC SDL_Surface* RotoScaleSurface(SDL_Surface *src, double angle,
00099                                        double zoom, bool smooth = true);
00100 
00102 
00113 DECLSPEC SDL_Surface* ScaleSurface(SDL_Surface *src, double zoomx, double zoomy,
00114                                    bool smooth = true);
00115 
00117 
00128 static inline SDL_Surface *ScaleSurface(SDL_Surface *src, const PG_Rect &rect,
00129                                         bool smooth = true) {
00130         return ScaleSurface(src, static_cast<double>(rect.w) / src->w,
00131                             static_cast<double>(rect.h) / src->h, smooth);
00132 }
00133 
00135 
00146 static inline SDL_Surface *ScaleSurface(SDL_Surface *src, Uint16 newx, Uint16 newy,
00147                                         bool smooth = true) {
00148         return ScaleSurface(src, static_cast<double>(newx) / src->w,
00149                             static_cast<double>(newy) / src->h, smooth);
00150 }
00151 
00153 
00162 DECLSPEC void BlitScale(SDL_Surface *src, SDL_Surface *dst, bool smooth = true);
00163 
00173 DECLSPEC SDL_Surface* CreateGradient(const PG_Rect& r, PG_Gradient& gradient);
00174 
00187 DECLSPEC SDL_Surface* CreateGradient(const PG_Rect& r, const PG_Color& ul, const PG_Color& ur, const PG_Color& dl, const PG_Color& dr);
00188 
00199 DECLSPEC void DrawGradient(SDL_Surface* surface, const PG_Rect& r, PG_Gradient& gradient);
00200 
00214 DECLSPEC void DrawGradient(SDL_Surface * surface, const PG_Rect& rect, const PG_Color& ul, const PG_Color& ur, const PG_Color& dl, const PG_Color& dr);
00215 
00224 DECLSPEC SDL_Surface* CreateRGBSurface(Uint16 w, Uint16 h, int flags = SDL_SWSURFACE);
00225 
00239 DECLSPEC void DrawThemedSurface(SDL_Surface* surface, const PG_Rect& r, PG_Gradient* gradient, SDL_Surface* background, BkMode bkmode, Uint8 blend);
00240 
00253 DECLSPEC void DrawLine(SDL_Surface* surface, Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const PG_Color& color, Uint8 width = 1);
00254 
00265 DECLSPEC void SetPixel(int x, int y, const PG_Color& c, SDL_Surface * surface);
00266 
00276 inline void BlitSurface(SDL_Surface* srf_src, const PG_Rect& rect_src, SDL_Surface* srf_dst, const PG_Rect& rect_dst) {
00277         SDL_BlitSurface(srf_src, const_cast<PG_Rect*>(&rect_src), srf_dst, const_cast<PG_Rect*>(&rect_dst));
00278 }
00279 
00292 DECLSPEC void DrawTile(SDL_Surface* surface, const PG_Rect& ref, const PG_Rect& drawrect, SDL_Surface* tilemap);
00293 
00294 #ifndef DOXYGEN_SKIP
00295 // These will disappear (moved to another lib)
00296 DECLSPEC void RectStretch(SDL_Surface* src_surface, int xs1, int ys1, int xs2, int ys2, SDL_Surface* dst_surface, int xd1, int yd1, int xd2, int yd2, Uint32* voiLUT);
00297 DECLSPEC void CreateFilterLUT();
00298 DECLSPEC void PG_SmoothFast(SDL_Surface* src, SDL_Surface* dst);
00299 DECLSPEC void InterpolatePixel(SDL_Surface* src, SDL_Surface* dest);
00300 #endif // DOXYGEN_SKIP
00301 
00302 } // namespace PG_Draw
00303 
00304 #endif // PG_DRAW_H

Generated on Tue Jun 24 01:27:47 2008 for Advanced Strategic Command by  doxygen 1.4.2