00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
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