~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

Viewing changes to libgimpmath/gimpmath.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* LIBGIMP - The GIMP Library
 
2
 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
 
3
 *
 
4
 * gimpmath.h
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with this library; if not, write to the
 
18
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
19
 * Boston, MA 02111-1307, USA.
 
20
 */
 
21
 
 
22
#ifndef __GIMP_MATH_H__
 
23
#define __GIMP_MATH_H__
 
24
 
 
25
#include <math.h>
 
26
 
 
27
#ifdef HAVE_IEEEFP_H
 
28
#include <ieeefp.h>
 
29
#endif
 
30
 
 
31
#ifdef G_OS_WIN32
 
32
#include <float.h>
 
33
#endif
 
34
 
 
35
#include <libgimpmath/gimpmathtypes.h>
 
36
 
 
37
#include <libgimpmath/gimpmatrix.h>
 
38
#include <libgimpmath/gimpmd5.h>
 
39
#include <libgimpmath/gimpvector.h>
 
40
 
 
41
G_BEGIN_DECLS
 
42
 
 
43
/* Some portability enhancing stuff. For use both by the gimp app
 
44
 * as well as plug-ins and modules.
 
45
 *
 
46
 * Include this instead of just <math.h>.
 
47
 */
 
48
 
 
49
/* Use RINT() instead of rint() */
 
50
#ifdef HAVE_RINT
 
51
#define RINT(x) rint(x)
 
52
#else
 
53
#define RINT(x) floor ((x) + 0.5)
 
54
#endif
 
55
 
 
56
#define ROUND(x) ((int) ((x) + 0.5))
 
57
 
 
58
/* Square */
 
59
#define SQR(x) ((x) * (x))
 
60
 
 
61
/* Limit a (0->511) int to 255 */
 
62
#define MAX255(a)  ((a) | (((a) & 256) - (((a) & 256) >> 8)))
 
63
 
 
64
/* Clamp a >>int32<<-range int between 0 and 255 inclusive */
 
65
#define CLAMP0255(a)  CLAMP(a,0,255)
 
66
 
 
67
#define gimp_deg_to_rad(angle) ((angle) * (2.0 * G_PI) / 360.0)
 
68
#define gimp_rad_to_deg(angle) ((angle) * 360.0 / (2.0 * G_PI))
 
69
 
 
70
 
 
71
G_END_DECLS
 
72
 
 
73
#endif /* __GIMP_MATH_H__ */