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

rotozoom.h

00001 /*
00002   libwftk - Worldforge Toolkit - a widget library
00003   Copyright (C) 2002 Malcolm Walker <malcolm@worldforge.org>
00004   Based on code copyright  (C) 1999-2002  Karsten Laux
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Lesser General Public
00008   License as published by the Free Software Foundation; either
00009   version 2.1 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   Lesser General Public License for more details.
00015   
00016   You should have received a copy of the GNU Lesser General Public
00017   License along with this library; if not, write to the
00018   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019   Boston, MA  02111-1307, SA.
00020 
00021 
00022   THIS FILE ORIGINALLY APPEARED IN THE SDL_gfx library, as
00023   SDL_rotozoom.h.  SDL_gfx is available from:
00024 
00025   http://www.ferzkopp.net
00026 
00027   SDL_rotozoom - rotozoomer
00028 
00029   LGPL (c) A. Schiffler
00030 
00031 */
00032 
00033 #ifndef _SDL_rotozoom_h
00034 #define _SDL_rotozoom_h
00035 
00036 /* Set up for C function definitions, even when using C++ */
00037 //#ifdef __cplusplus
00038 //extern "C" {
00039 //#endif
00040 
00041 #include <cmath>
00042 #ifndef M_PI
00043 #define M_PI    3.141592654
00044 #endif
00045 #include <SDL/SDL.h>
00046 
00047 
00048 /* ---- Defines */
00049 
00050 #define SMOOTHING_OFF       0
00051 #define SMOOTHING_ON        1
00052 
00053 /* ---- Structures */
00054 
00055     typedef struct tColorRGBA {
00056     Uint8 r;
00057     Uint8 g;
00058     Uint8 b;
00059     Uint8 a;
00060     } tColorRGBA;
00061 
00062     typedef struct tColorY {
00063     Uint8 y;
00064     } tColorY;
00065 
00066 
00067 /* ---- Prototypes */
00068 
00069 #if defined WIN32 && !defined __MINGW32__
00070 #ifdef BUILD_DLL
00071 #define DLLINTERFACE __declspec(dllexport)
00072 #else
00073 #define DLLINTERFACE __declspec(dllimport)
00074 #endif
00075 #else
00076 #define DLLINTERFACE
00077 #endif
00078 
00079 /* 
00080  
00081  rotozoomSurface()
00082 
00083  Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
00084  'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1
00085  then the destination 32bit surface is anti-aliased. If the surface is not 8bit
00086  or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
00087 
00088 */
00089 
00090     DLLINTERFACE SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth);
00091 
00092 
00093 /* Returns the size of the target surface for a rotozoomSurface() call */
00094 
00095     DLLINTERFACE void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth,
00096                       int *dstheight);
00097 
00098 /* 
00099  
00100  zoomSurface()
00101 
00102  Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
00103  'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1
00104  then the destination 32bit surface is anti-aliased. If the surface is not 8bit
00105  or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
00106 
00107 */
00108 
00109     DLLINTERFACE SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth);
00110 
00111         int zoomSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int smooth);  
00112 
00113 /* Returns the size of the target surface for a zoomSurface() call */
00114 
00115     DLLINTERFACE void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight);
00116 
00117 
00118 /* Ends C function definitions when using C++ */
00119 //#ifdef __cplusplus
00120 //};
00121 //#endif
00122 
00123 #endif              /* _SDL_rotozoom_h */

Generated Tue Aug 9 18:40:26 2005.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.