mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-22 12:32:37 +00:00
cd28dee822
2002-11-20 Dave Neary <bolsh@gimp.org> * configure.in * app/core/gimpbrushpipe.c * app/gui/about-dialog.c * app/paint-funcs/paint-funcs-generic.h * app/paint-funcs/paint-funcs.c * libgimpmath/gimpmath.h * libgimpwidgets/gimpwidgets.c * plug-ins/common/CML_explorer.c * plug-ins/common/blur.c * plug-ins/common/cubism.c * plug-ins/common/gee.c * plug-ins/common/gee_zoom.c * plug-ins/common/gqbist.c * plug-ins/common/jigsaw.c * plug-ins/common/lic.c * plug-ins/common/noisify.c * plug-ins/common/nova.c * plug-ins/common/papertile.c * plug-ins/common/plasma.c * plug-ins/common/randomize.c * plug-ins/common/sample_colorize.c * plug-ins/common/scatter_hsv.c * plug-ins/common/shift.c * plug-ins/common/sinus.c * plug-ins/common/smooth_palette.c * plug-ins/common/snoise.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/spread.c * plug-ins/common/warp.c * plug-ins/common/wind.c * plug-ins/flame/cmap.c * plug-ins/flame/flame.c * plug-ins/flame/libifs.c * plug-ins/gflare/gflare.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/gimpressionist/gimpressionist.h * plug-ins/gimpressionist/plasma.c * plug-ins/gimpressionist/repaint.c * plug-ins/ifscompose/ifscompose_utils.c * plug-ins/maze/algorithms.c * plug-ins/maze/maze.c * plug-ins/maze/maze.h * plug-ins/mosaic/mosaic.c: Change all occurrences of RAND_MAX, G_MAXRAND, rand(), srand(), lrand48(), srand48(), random(), srandom(), RAND_FUNC and SRAND_FUNC to the appropriate g_rand* equivalent. Programs which require seed setting for reproducible results, and anything in the core, gets a dedicated GRand * for the lifetime required. Programs which only ever used random numbers for tossing a coin, rolling a dice, etc use g_random functions. For the rest, judgement was used. Where it was easy, a GRand * object was used and g_rand_* functions were preferred. This fixes bug #67386 in HEAD.
74 lines
1.9 KiB
C
74 lines
1.9 KiB
C
/* LIBGIMP - The GIMP Library
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
|
*
|
|
* gimpmath.h
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#ifndef __GIMP_MATH_H__
|
|
#define __GIMP_MATH_H__
|
|
|
|
#include <math.h>
|
|
|
|
#ifdef HAVE_IEEEFP_H
|
|
#include <ieeefp.h>
|
|
#endif
|
|
|
|
#ifdef G_OS_WIN32
|
|
#include <float.h>
|
|
#endif
|
|
|
|
#include <libgimpmath/gimpmathtypes.h>
|
|
|
|
#include <libgimpmath/gimpmatrix.h>
|
|
#include <libgimpmath/gimpmd5.h>
|
|
#include <libgimpmath/gimpvector.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
/* Some portability enhancing stuff. For use both by the gimp app
|
|
* as well as plug-ins and modules.
|
|
*
|
|
* Include this instead of just <math.h>.
|
|
*/
|
|
|
|
/* Use RINT() instead of rint() */
|
|
#ifdef HAVE_RINT
|
|
#define RINT(x) rint(x)
|
|
#else
|
|
#define RINT(x) floor ((x) + 0.5)
|
|
#endif
|
|
|
|
#define ROUND(x) ((int) ((x) + 0.5))
|
|
|
|
/* Square */
|
|
#define SQR(x) ((x) * (x))
|
|
|
|
/* Limit a (0->511) int to 255 */
|
|
#define MAX255(a) ((a) | (((a) & 256) - (((a) & 256) >> 8)))
|
|
|
|
/* Clamp a >>int32<<-range int between 0 and 255 inclusive */
|
|
#define CLAMP0255(a) CLAMP(a,0,255)
|
|
|
|
#define gimp_deg_to_rad(angle) ((angle) * (2.0 * G_PI) / 360.0)
|
|
#define gimp_rad_to_deg(angle) ((angle) * 360.0 / (2.0 * G_PI))
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __GIMP_MATH_H__ */
|