# image-private.h

Go to the documentation of this file.

    00001 /*
    00002   Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization
    00003   dedicated to making software imaging solutions freely available.
    00004
    00005   You may not use this file except in compliance with the License.
    00006   obtain a copy of the License at
    00007
    00008     http://www.imagemagick.org/script/license.php
    00009
    00010   Unless required by applicable law or agreed to in writing, software
    00011   distributed under the License is distributed on an "AS IS" BASIS,
    00012   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013   See the License for the specific language governing permissions and
    00014   limitations under the License.
    00015
    00016   MagickCore image private methods.
    00017 */
    00018 #ifndef _MAGICKCORE_IMAGE_PRIVATE_H
    00019 #define _MAGICKCORE_IMAGE_PRIVATE_H
    00020
    00021 #if defined(__cplusplus) || defined(c_plusplus)
    00022 extern "C" {
    00023 #endif
    00024
    00025 #define MagickPI  3.14159265358979323846264338327950288419716939937510
    00026 #define MagickSQ1_2  0.7071067811865475244008443621048490
    00027 #define MagickSQ2PI  2.50662827463100024161235523934010416269302368164062
    00028 #define QuantumScale  ((double) 1.0/(double) QuantumRange)
    00029 #define UndefinedTicksPerSecond  100L
    00030 #define UndefinedCompressionQuality  0UL
    00031
    00032 extern MagickExport const char
    00033   *BackgroundColor,
    00034   *BorderColor,
    00035   *DefaultTileFrame,
    00036   *DefaultTileGeometry,
    00037   *DefaultTileLabel,
    00038   *ForegroundColor,
    00039   *MatteColor,
    00040   *LoadImageTag,
    00041   *LoadImagesTag,
    00042   *PSDensityGeometry,
    00043   *PSPageGeometry,
    00044   *SaveImageTag,
    00045   *SaveImagesTag;
    00046
    00047 extern MagickExport const double
    00048   DefaultResolution;
    00049
    00050 static inline double DegreesToRadians(const double degrees)
    00051 {
    00052   return(MagickPI*degrees/180.0);
    00053 }
    00054
    00055 static inline MagickBooleanType QuantumTick(const MagickOffsetType offset,
    00056   const MagickSizeType span)
    00057 {
    00058   if ((offset & (offset-1)) == 0)
    00059     return(MagickTrue);
    00060   if ((offset & 0x7f) == 0)
    00061     return(MagickTrue);
    00062   if (offset == (MagickOffsetType) (span-1))
    00063     return(MagickTrue);
    00064   return(MagickFalse);
    00065 }
    00066
    00067 static inline MagickRealType RadiansToDegrees(const MagickRealType radians)
    00068 {
    00069   return(180.0*radians/MagickPI);
    00070 }
    00071
    00072 static inline unsigned char ScaleColor5to8(const unsigned long color)
    00073 {
    00074   return((unsigned char) (((color) << 3) | ((color) >> 2)));
    00075 }
    00076
    00077 static inline unsigned char ScaleColor6to8(const unsigned long color)
    00078 {
    00079   return((unsigned char) (((color) << 2) | ((color) >> 4)));
    00080 }
    00081
    00082 static inline unsigned long ScaleColor8to5(const unsigned char color)
    00083 {
    00084   return((unsigned long) (((color) & ~0x07) >> 3));
    00085 }
    00086
    00087 static inline unsigned long ScaleColor8to6(const unsigned char color)
    00088 {
    00089   return((unsigned long) (((color) & ~0x03) >> 2));
    00090 }
    00091
    00092 #if defined(__cplusplus) || defined(c_plusplus)
    00093 }
    00094 #endif
    00095
    00096 #endif