Parent Directory
|
Revision Log
Release 2.0.5 tag
1 /* 2 DDS GIMP plugin 3 4 Copyright (C) 2004-2008 Shawn Kirst <skirst@insightbb.com>, 5 with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified. 6 7 This program is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public 9 License as published by the Free Software Foundation; either 10 version 2 of the License, or (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; see the file COPYING. If not, write to 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 Boston, MA 02111-1307, USA. 21 */ 22 23 #ifndef IMATH_H 24 #define IMATH_H 25 26 #ifndef MIN 27 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 28 #endif 29 #ifndef MAX 30 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 31 #endif 32 33 static inline int mul8bit(int a, int b) 34 { 35 int t = a * b + 128; 36 return((t + (t >> 8)) >> 8); 37 } 38 39 static inline int blerp(int a, int b, int x) 40 { 41 return(a + mul8bit(b - a, x)); 42 } 43 44 static inline int icerp(int a, int b, int c, int d, int x) 45 { 46 int p = (d - c) - (a - b); 47 int q = (a - b) - p; 48 int r = c - a; 49 return((x * (x * (x * p + (q << 7)) + (r << 14)) + (b << 21)) >> 21); 50 } 51 52 #endif
| ViewVC Help | |
| Powered by ViewVC 1.0.4 |