-
Notifications
You must be signed in to change notification settings - Fork 0
/
scale.h
58 lines (43 loc) · 1.56 KB
/
scale.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
Copyright (c) 2013 Auston Sterling
See license.txt for copying permission.
-----Image Scaling Library Header-----
Auston Sterling
A library containing a variety of algorithms for scaling images.
- Nearest Neighbor
- Bilinear
- Bicubic
- Smooth Bresenham
*/
#ifndef _scale_h_
#define _scale_h_
#include "SDL/SDL.h"
//Nearest Neighbor
//Call given new width and height
SDL_Surface* scaleNN(SDL_Surface* inimage, int w, int h)
{return scaleNN(inimage, float(w)/float(inimage->w), float(h)/float(inimage->h));}
//Call given two ratios
SDL_Surface* scaleNN(SDL_Surface* inimage, float xratio, float yratio);
//Call given single ratio
SDL_Surface* scaleNN(SDL_Surface* inimage, float ratio)
{return scaleNN(inimage, ratio, ratio);}
//Bilinear
//Call given two ratios
SDL_Surface* scaleBL(SDL_Surface* inimage, float xratio, float yratio);
//Call given one ratio
SDL_Surface* scaleBL(SDL_Surface* inimage, float ratio)
{return scaleBL(inimage, ratio, ratio);}
//Call given new width and height
SDL_Surface* scaleBL(SDL_Surface* inimage, int w, int h)
{return scaleBL(inimage, float(w)/float(inimage->w), float(h)/float(inimage->h));}
//Bicubic
//Call given two ratios
SDL_Surface* scaleBC(SDL_Surface* inimage, float xratio, float yratio);
//Call given one ratio
SDL_Surface* scaleBC(SDL_Surface* inimage, float ratio)
{return scaleBC(inimage, ratio, ratio);}
//Call given new width and height
SDL_Surface* scaleBC(SDL_Surface* inimage, int w, int h)
{return scaleBC(inimage, float(w)/float(inimage->w), float(h)/float(inimage->h));}
#endif