File: libgimpmath-GimpMath.html

package info (click to toggle)
gimp 2.2.6-1sarge4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 97,088 kB
  • ctags: 43,756
  • sloc: ansic: 525,782; xml: 36,543; lisp: 9,851; sh: 9,007; makefile: 7,974; python: 2,622; perl: 2,589; yacc: 520; lex: 334
file content (88 lines) | stat: -rw-r--r-- 7,691 bytes parent folder | download
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>GimpMath</title><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"><link rel="start" href="index.html" title="GIMP Math Library Reference Manual"><link rel="up" href="libgimpmath.html" title="PartI.GIMP Math Library"><link rel="prev" href="libgimpmath.html" title="PartI.GIMP Math Library"><link rel="next" href="libgimpmath-GimpMatrix.html" title="GimpMatrix"><meta name="generator" content="GTK-Doc V1.2 (XML mode)"><style type="text/css">
        .synopsis, .classsynopsis {
            background: #eeeeee;
            border: solid 1px #aaaaaa;
            padding: 0.5em;
        }
        .programlisting {
            background: #eeeeff;
            border: solid 1px #aaaaff;
            padding: 0.5em;
        }
        .variablelist {
            padding: 4px;
            margin-left: 3em;
        }
        .navigation {
            background: #ffeeee;
            border: solid 1px #ffaaaa;
            margin-top: 0.5em;
            margin-bottom: 0.5em;
        }
        .navigation a {
            color: #770000;
        }
        .navigation a:visited {
            color: #550000;
        }
        .navigation .title {
            font-size: 200%;
        }
      </style></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libgimpmath.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="libgimpmath.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GIMP Math Library Reference Manual</th><td><a accesskey="n" href="libgimpmath-GimpMatrix.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="libgimpmath-GimpMath"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">GimpMath</span></h2><p>GimpMath &#8212; Mathematical definitions and macros.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">



#define     <a href="libgimpmath-GimpMath.html#RINT-CAPS">RINT</a>                            (x)
#define     <a href="libgimpmath-GimpMath.html#ROUND-CAPS">ROUND</a>                           (x)
#define     <a href="libgimpmath-GimpMath.html#SQR-CAPS">SQR</a>                             (x)
#define     <a href="libgimpmath-GimpMath.html#MAX255-CAPS">MAX255</a>                          (a)
#define     <a href="libgimpmath-GimpMath.html#CLAMP0255-CAPS">CLAMP0255</a>                       (a)
#define     <a href="libgimpmath-GimpMath.html#gimp-deg-to-rad">gimp_deg_to_rad</a>                 (angle)
#define     <a href="libgimpmath-GimpMath.html#gimp-rad-to-deg">gimp_rad_to_deg</a>                 (angle)
</pre></div><div class="refsect1" lang="en"><a name="id2468677"></a><h2>Description</h2><p>
Mathematical definitions and macros. These macros should be used
rather than the ones from math.h for enhanced portability.
</p></div><div class="refsect1" lang="en"><a name="id2468689"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2468694"></a><h3><a name="RINT-CAPS"></a>RINT()</h3><a class="indexterm" name="id2468703"></a><pre class="programlisting">#define     RINT(x)</pre><p>
This macro rounds its argument <i class="parameter"><tt>x</tt></i> to an integer value in floating point
format.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>the value to be rounded.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2468731"></a><h3><a name="ROUND-CAPS"></a>ROUND()</h3><a class="indexterm" name="id2468740"></a><pre class="programlisting">#define ROUND(x) ((int) ((x) + 0.5))
</pre><p>
This macro rounds its argument <i class="parameter"><tt>x</tt></i> to the nearest integer.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>the value to be rounded.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2467253"></a><h3><a name="SQR-CAPS"></a>SQR()</h3><a class="indexterm" name="id2467261"></a><pre class="programlisting">#define SQR(x) ((x) * (x))
</pre><p>
This macro squares its argument <i class="parameter"><tt>x</tt></i>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>the value to be squared.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2467289"></a><h3><a name="MAX255-CAPS"></a>MAX255()</h3><a class="indexterm" name="id2467297"></a><pre class="programlisting">#define MAX255(a)  ((a) | (((a) &amp; 256) - (((a) &amp; 256) &gt;&gt; 8)))
</pre><p>
This macro limits it argument <i class="parameter"><tt>a</tt></i>, an (0-511) int, to 255.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>a</tt></i>:</span></td><td>the value to be limited.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2467326"></a><h3><a name="CLAMP0255-CAPS"></a>CLAMP0255()</h3><a class="indexterm" name="id2467334"></a><pre class="programlisting">#define CLAMP0255(a)  CLAMP(a,0,255)
</pre><p>
This macro clamps its argument <i class="parameter"><tt>a</tt></i>, an int32-range int, between 0 and
255 inclusive.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>a</tt></i>:</span></td><td>the value to be clamped.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2467364"></a><h3><a name="gimp-deg-to-rad"></a>gimp_deg_to_rad()</h3><a class="indexterm" name="id2467372"></a><pre class="programlisting">#define gimp_deg_to_rad(angle) ((angle) * (2.0 * G_PI) / 360.0)
</pre><p>
This macro converts its argument <i class="parameter"><tt>angle</tt></i> from degree to radian.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>angle</tt></i>:</span></td><td>the angle to be converted.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2467401"></a><h3><a name="gimp-rad-to-deg"></a>gimp_rad_to_deg()</h3><a class="indexterm" name="id2467409"></a><pre class="programlisting">#define gimp_rad_to_deg(angle) ((angle) * 360.0 / (2.0 * G_PI))
</pre><p>
This macro converts its argument <i class="parameter"><tt>angle</tt></i> from radian to degree.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>angle</tt></i>:</span></td><td>the angle to be converted.


</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="libgimpmath.html"><b>&lt;&lt;PartI.GIMP Math Library</b></a></td><td align="right"><a accesskey="n" href="libgimpmath-GimpMatrix.html"><b>GimpMatrix&gt;&gt;</b></a></td></tr></table></body></html>