Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1.  
  2. SDL_draw 1.2.1
  3. ~~~~~~~~~~~~~~
  4. The latest version of this library is available from:
  5. http://sdl-draw.sourceforge.net/
  6.  
  7. This is a simple library to draw basic elements, like points, lines and
  8. circles, on SDL surfaces.
  9.  
  10. Library API
  11. ~~~~~~~~~~~
  12. #include "SDL_draw.h"
  13.  
  14. //IMPORTANT: Call this function AFTER the call to 'SDL_SetVideoMode':
  15. Draw_Init(); //Register the functions for current bpp
  16.  
  17.  
  18. void Draw_Pixel(SDL_Surface *super,
  19.                 Sint16 x, Sint16 y, Uint32 color);
  20.  
  21.   Draw a colored pixel on coordinates x,y.
  22.  
  23.  
  24. void Draw_Line(SDL_Surface *super,
  25.                Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2,
  26.                Uint32 color);
  27.  
  28.   Draw a line from x1,y1 to x2,y2.
  29.  
  30.  
  31. void Draw_Circle(SDL_Surface *super,
  32.                  Sint16 x0, Sint16 y0, Uint16 r,
  33.                  Uint32 color);
  34.                                        
  35.   Draw a circle with center x0,y0 and radius r.
  36.  
  37.  
  38. void Draw_FillCircle(SDL_Surface *super,
  39.                      Sint16 x0, Sint16 y0, Uint16 r,
  40.                      Uint32 color);
  41.                      
  42.   Draw a filled circle with center x0,y0 and radius r.
  43.  
  44.  
  45. void Draw_HLine(SDL_Surface *super,
  46.                 Sint16 x0,Sint16 y0, Sint16 x1,
  47.                 Uint32 color);
  48.  
  49.   Draw a horizontal line from x0,y0 to x1,y0.
  50.  
  51.  
  52. void Draw_VLine(SDL_Surface *super,
  53.                 Sint16 x0,Sint16 y0, Sint16 y1,
  54.                 Uint32 color);
  55.  
  56.   Draw a vertical line from x0,y0 to x0,y1.
  57.  
  58.  
  59. void Draw_Rect(SDL_Surface *super,
  60.                Sint16 x,Sint16 y, Uint16 w,Uint16 h,
  61.                Uint32 color);
  62.  
  63.   Draw a rectangle with upper left corner in x,y being w the width and h the
  64.   height.
  65.  
  66.  
  67. void Draw_FillRect(SDL_Surface *super,
  68.                    Sint16 x,Sint16 y, Uint16 w,Uint16 h,
  69.                    Uint32 color);
  70.  
  71.   The same as above but the rectangle is filled. This function is equivalent
  72.   to SDL_FillRect (is a MACRO).
  73.  
  74.  
  75. void Draw_Ellipse(SDL_Surface *super,
  76.                   Sint16 x0, Sint16 y0,
  77.                   Uint16 Xradius, Uint16 Yradius,
  78.                   Uint32 color);
  79.  
  80.   Draw a ellipse with center in x0,y0. Xradius is the major axis and Yradius is
  81.   the minor axis.
  82.                  
  83.  
  84. void Draw_FillEllipse(SDL_Surface *super,
  85.                       Sint16 x0, Sint16 y0,
  86.                       Uint16 Xradius, Uint16 Yradius,
  87.                       Uint32 color);
  88.  
  89.   Draw a filled ellipse (same parameters as the above function).
  90.  
  91.  
  92. void Draw_Round(SDL_Surface *super,
  93.                 Sint16 x0,Sint16 y0, Uint16 w,Uint16 h,
  94.                 Uint16 corner, Uint32 color);
  95.  
  96.   Draw a rectangle with rounded corners. x0,y0 is the upper left corner of the
  97.   rectangle, w is the width and h is the height. corner is the radius of the
  98.   corner.
  99.  
  100.  
  101. void Draw_Round(SDL_Surface *super,
  102.                 Sint16 x0,Sint16 y0, Uint16 w,Uint16 h,
  103.                 Uint16 corner, Uint32 color);
  104.  
  105.   The same as above but the rounded rectangle is filled.
  106.  
  107.  
  108. The file sdldrawtest.c is a example application for the library. You can
  109. compile it using (for GNU Compiler):
  110.  
  111. $ export CFLAGS="`sdl-config --cflags` -I./include"
  112. $ export LIBS="`sdl-config --libs` ./src/.libs/libSDL_draw.a"
  113. $ gcc -o sdldrawtest sdldrawtest.c -Wall $CFLAGS $LIBS
  114.  
  115. This library is under the GNU Library General Public License, see the file
  116. "COPYING" for details.
  117.  
  118.