MagickCore  6.7.5
image-private.h
Go to the documentation of this file.
00001 /*
00002   Copyright 1999-2012 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 Magick2PI    6.28318530717958647692528676655900576839433879875020L
00026 #define MagickPHI    1.61803398874989484820458683436563811772030917980576L
00027 #define MagickPI2    1.57079632679489661923132169163975144209858469968755L
00028 #define MagickSQ1_2  0.70710678118654752440084436210484903928483593768847L
00029 #define MagickSQ2    1.41421356237309504880168872420969807856967187537695L
00030 #define MagickSQ2PI  2.50662827463100024161235523934010416269302368164062L
00031 #define UndefinedTicksPerSecond  100L
00032 #define UndefinedCompressionQuality  0UL
00033 
00034 extern MagickPrivate const char
00035   BackgroundColor[],
00036   BorderColor[],
00037   ForegroundColor[],
00038   DefaultTileFrame[],
00039   MatteColor[];
00040 
00041 static inline double DegreesToRadians(const double degrees)
00042 {
00043   return((double) (MagickPI*degrees/180.0));
00044 }
00045 
00046 static inline MagickRealType RadiansToDegrees(const MagickRealType radians)
00047 {
00048   return((MagickRealType) (180.0*radians/MagickPI));
00049 }
00050 
00051 static inline unsigned char ScaleColor5to8(const unsigned int color)
00052 {
00053   return((unsigned char) (((color) << 3) | ((color) >> 2)));
00054 }
00055 
00056 static inline unsigned char ScaleColor6to8(const unsigned int color)
00057 {
00058   return((unsigned char) (((color) << 2) | ((color) >> 4)));
00059 }
00060 
00061 static inline unsigned int ScaleColor8to5(const unsigned char color)
00062 {
00063   return((unsigned int) (((color) & ~0x07) >> 3));
00064 }
00065 
00066 static inline unsigned int ScaleColor8to6(const unsigned char color)
00067 {
00068   return((unsigned int) (((color) & ~0x03) >> 2));
00069 }
00070 
00071 #if defined(__cplusplus) || defined(c_plusplus)
00072 }
00073 #endif
00074 
00075 #endif