root / ImageMagick / branches / ImageMagick-6.3.5 / magick / image-private.h

Revision 7647, 2.5 kB (checked in by cristy, 15 months ago)
Line 
1/*
2  Copyright 1999-2007 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4
5  You may not use this file except in compliance with the License.
6  obtain a copy of the License at
7
8    http://www.imagemagick.org/script/license.php
9
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15
16  MagickCore image private methods.
17*/
18#ifndef _MAGICKCORE_IMAGE_PRIVATE_H
19#define _MAGICKCORE_IMAGE_PRIVATE_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25#define MagickPI  3.14159265358979323846264338327950288419716939937510
26#define MagickSQ1_2  0.7071067811865475244008443621048490
27#define MagickSQ2PI  2.50662827463100024161235523934010416269302368164062
28#define QuantumScale  ((MagickRealType) 1.0/(MagickRealType) QuantumRange)
29#define UndefinedTicksPerSecond  100L
30#define UndefinedCompressionQuality  0UL
31
32extern MagickExport const char
33  *BackgroundColor,
34  *BorderColor,
35  *DefaultTileFrame,
36  *DefaultTileGeometry,
37  *DefaultTileLabel,
38  *ForegroundColor,
39  *MatteColor,
40  *LoadImageTag,
41  *LoadImagesTag,
42  *PSDensityGeometry,
43  *PSPageGeometry,
44  *SaveImageTag,
45  *SaveImagesTag;
46
47extern MagickExport const double
48  DefaultResolution;
49
50static inline double DegreesToRadians(const double degrees)
51{
52  return(MagickPI*degrees/180.0);
53}
54
55static inline MagickBooleanType QuantumTick(const MagickOffsetType offset,
56  const MagickSizeType span)
57{
58  if ((offset & (offset-1)) == 0)
59    return(MagickTrue);
60  if ((offset & 0x7f) == 0)
61    return(MagickTrue);
62  if (offset == (MagickOffsetType) (span-1))
63    return(MagickTrue);
64  return(MagickFalse);
65}
66
67static inline MagickRealType RadiansToDegrees(const MagickRealType radians)
68{
69  return(180.0*radians/MagickPI);
70}
71
72static inline unsigned char ScaleColor5to8(const unsigned long color)
73{
74  return((unsigned char) (((color) << 3) | ((color) >> 2)));
75}
76
77static inline unsigned char ScaleColor6to8(const unsigned long color)
78{
79  return((unsigned char) (((color) << 2) | ((color) >> 4)));
80}
81
82static inline unsigned long ScaleColor8to5(const unsigned char color)
83{
84  return((unsigned long) (((color) & ~0x07) >> 3));
85}
86
87static inline unsigned long ScaleColor8to6(const unsigned char color)
88{
89  return((unsigned long) (((color) & ~0x03) >> 2));
90}
91
92#if defined(__cplusplus) || defined(c_plusplus)
93}
94#endif
95
96#endif
Note: See TracBrowser for help on using the browser.