Main Page | Class Hierarchy | Class List | File List | Class Members

drawlibs.h

00001 
00002 /*
00003  * drawlibs.h - code for manipulating SDL surfaces and drawing
00004  * Initial design by Eduardo B. Fonseca <ebf@aedsolucoes.com.br>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 #ifndef DRAWLIBS_H
00023 #define DRAWLIBS_H
00024 
00025 #include "SDL.h"
00026 
00027 #define sgn(x) ((x<0)?-1:((x>0)?1:0))   /* macro to return the sign of a
00028                                            number */
00029 
00030 DLLEXPORT SDL_Surface *CreateSurface(Uint32 flags, int width, int height,
00031                                      int bpp = 32);
00032 DLLEXPORT void ConvertSurface(SDL_Surface ** surface);
00033 
00034 DLLEXPORT void DrawPixel(SDL_Surface * screen, int x, int y, Uint32 color);
00035 DLLEXPORT void DrawLine(SDL_Surface * screen, int x1, int y1, int x2, int y2,
00036                         Uint32 color);
00037 DLLEXPORT void DrawRect(SDL_Surface * screen, int x1, int y1, int x2, int y2,
00038                         Uint32 color);
00039 DLLEXPORT void DrawRound(SDL_Surface * screen, int x0, int y0, int w, int h,
00040                          int corner, Uint32 color);
00041 
00042 DLLEXPORT void vertgradient(SDL_Surface * surf, SDL_Color c1, SDL_Color c2,
00043                             Uint8 alpha = 255);
00044 DLLEXPORT void vertgradient2(SDL_Surface * surf, SDL_Rect & gradRect,
00045                              SDL_Color c1, SDL_Color c2, Uint8 alpha = 255);
00046 DLLEXPORT void horizgradient2(SDL_Surface * surf, SDL_Rect & gradRect,
00047                               SDL_Color c1, SDL_Color c2, Uint8 alpha = 255);
00048 
00049 DLLEXPORT Uint32 GetPixel(SDL_Surface * surface, int x, int y);
00050 DLLEXPORT void FloodFill(SDL_Surface * screen, int x, int y, Uint32 c);
00051 DLLEXPORT void DrawTriangle(SDL_Surface * s, int x[3], int y[3], Uint32 c);
00052 
00053 enum
00054 {
00055     ARROW_UP,
00056     ARROW_DOWN,
00057     ARROW_LEFT,
00058     ARROW_RIGHT
00059 };
00060 DLLEXPORT void DrawArrow(SDL_Surface * s, int type, int x, int y, int a,
00061                          Uint32 color, bool fill = false, Uint32 fillcolor = 0);
00062 
00063 #define SLOCK(surface) \
00064     do { \
00065         if(SDL_MUSTLOCK(surface)) \
00066             SDL_LockSurface(surface); \
00067     } while(0)
00068 
00069 #define SUNLOCK(surface) \
00070     do { \
00071         if(SDL_MUSTLOCK(surface)) \
00072             SDL_UnlockSurface(surface); \
00073     } while(0)
00074 
00075 #endif

Generated on Mon Mar 1 19:56:18 2004 for aedGUI by doxygen 1.3.6