Home | History | Annotate | Download | only in skin
      1 /* Copyright (C) 2007-2008 The Android Open Source Project
      2 **
      3 ** This software is licensed under the terms of the GNU General Public
      4 ** License version 2, as published by the Free Software Foundation, and
      5 ** may be copied, distributed, and modified under those terms.
      6 **
      7 ** This program is distributed in the hope that it will be useful,
      8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
      9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     10 ** GNU General Public License for more details.
     11 */
     12 #ifndef _ANDROID_SKIN_SCALER_H
     13 #define _ANDROID_SKIN_SCALER_H
     14 
     15 #include "android/skin/image.h"
     16 
     17 typedef struct SkinScaler   SkinScaler;
     18 
     19 /* create a new image scaler. by default, it uses a scale of 1.0 */
     20 extern SkinScaler*  skin_scaler_create( void );
     21 
     22 /* change the scale of a given scaler. returns 0 on success, or -1 in case of
     23  * problem (unsupported scale) */
     24 extern int          skin_scaler_set( SkinScaler*  scaler,
     25                                      double       scale,
     26                                      double       xDisp,
     27                                      double       yDisp );
     28 
     29 /* retrieve the position of the scaled source rectangle 'srect' into 'drect'
     30  * you can use the same pointer for both parameters. */
     31 extern void         skin_scaler_get_scaled_rect( SkinScaler*  scaler,
     32                                                   SkinRect*    srect,
     33                                                   SkinRect*    drect );
     34 
     35 extern void         skin_scaler_free( SkinScaler*  scaler );
     36 
     37 extern void         skin_scaler_scale( SkinScaler*   scaler,
     38                                        SDL_Surface*  dst,
     39                                        SDL_Surface*  src,
     40                                        int           sx,
     41                                        int           sy,
     42                                        int           sw,
     43                                        int           sh );
     44 
     45 #endif /* _ANDROID_SKIN_SCALER_H */
     46