MagickCore  6.7.5
pixel.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 constitute methods.
00017 */
00018 #ifndef _MAGICKCORE_PIXEL_H
00019 #define _MAGICKCORE_PIXEL_H
00020 
00021 #if defined(__cplusplus) || defined(c_plusplus)
00022 extern "C" {
00023 #endif
00024 
00025 #include <MagickCore/colorspace.h>
00026 
00027 #define MaxPixelChannels  32
00028 #undef index
00029 
00030 typedef enum
00031 {
00032   UndefinedChannel = 0x0000,
00033   RedChannel = 0x0001,
00034   GrayChannel = 0x0001,
00035   CyanChannel = 0x0001,
00036   GreenChannel = 0x0002,
00037   MagentaChannel = 0x0002,
00038   BlueChannel = 0x0004,
00039   YellowChannel = 0x0004,
00040   BlackChannel = 0x0008,
00041   AlphaChannel = 0x0010,
00042   OpacityChannel = 0x0010,
00043   IndexChannel = 0x0020,
00044   MaskChannel = 0x0040,
00045   MetaChannel = 0x0080,
00046   CompositeChannels = 0x002F,
00047   AllChannels = 0x7ffffff,
00048   /*
00049     Special purpose channel types.
00050   */
00051   TrueAlphaChannel = 0x0100, /* extract actual alpha channel from opacity */
00052   RGBChannels = 0x0200,      /* set alpha from grayscale mask in RGB */
00053   GrayChannels = 0x0400,
00054   SyncChannels = 0x1000,     /* channels should be modified equally */
00055   DefaultChannels = ((AllChannels | SyncChannels) &~ AlphaChannel)
00056 } ChannelType;  /* must correspond to PixelChannel */
00057 
00058 typedef enum
00059 {
00060   UndefinedInterpolatePixel,
00061   AverageInterpolatePixel,
00062   BicubicInterpolatePixel,
00063   BilinearInterpolatePixel,
00064   FilterInterpolatePixel,
00065   IntegerInterpolatePixel,
00066   MeshInterpolatePixel,
00067   NearestNeighborInterpolatePixel,
00068   SplineInterpolatePixel
00069 } PixelInterpolateMethod;
00070 
00071 typedef enum
00072 {
00073   UndefinedPixelChannel = 0,
00074   RedPixelChannel = 0,
00075   CyanPixelChannel = 0,
00076   GrayPixelChannel = 0,
00077   YPixelChannel = 0,
00078   GreenPixelChannel = 1,
00079   MagentaPixelChannel = 1,
00080   CbPixelChannel = 1,
00081   BluePixelChannel = 2,
00082   YellowPixelChannel = 2,
00083   CrPixelChannel = 2,
00084   BlackPixelChannel = 3,
00085   AlphaPixelChannel = 4,
00086   IndexPixelChannel = 5,
00087   MaskPixelChannel = 6,
00088   MetaPixelChannel = 7,
00089   IntensityPixelChannel = MaxPixelChannels,
00090   CompositePixelChannel = MaxPixelChannels,
00091   SyncPixelChannel = MaxPixelChannels+1
00092 } PixelChannel;  /* must correspond to ChannelType */
00093 
00094 typedef enum
00095 {
00096   UndefinedPixelTrait = 0x000000,
00097   CopyPixelTrait = 0x000001,
00098   UpdatePixelTrait = 0x000002,
00099   BlendPixelTrait = 0x000004
00100 } PixelTrait;
00101 
00102 typedef struct _PixelChannelMap
00103 {
00104   PixelChannel
00105     channel;
00106 
00107   PixelTrait
00108     traits;
00109 
00110   ssize_t
00111     offset;
00112 } PixelChannelMap;
00113 
00114 typedef struct _PixelInfo
00115 {
00116   ClassType
00117     storage_class;
00118 
00119   ColorspaceType
00120     colorspace;
00121 
00122   MagickBooleanType
00123     matte;
00124 
00125   double
00126     fuzz;
00127 
00128   size_t
00129     depth;
00130 
00131   MagickSizeType
00132     count;
00133 
00134   double
00135     red,
00136     green,
00137     blue,
00138     black,
00139     alpha,
00140     index;
00141 } PixelInfo;
00142 
00143 typedef struct _PixelPacket
00144 {
00145   unsigned int
00146     red,
00147     green,
00148     blue,
00149     alpha,
00150     black;
00151 } PixelPacket;
00152 
00153 typedef enum
00154 {
00155   UndefinedPixel,
00156   CharPixel,
00157   DoublePixel,
00158   FloatPixel,
00159   LongPixel,
00160   LongLongPixel,
00161   QuantumPixel,
00162   ShortPixel
00163 } StorageType;
00164 
00165 typedef struct _CacheView
00166   CacheView_;
00167 
00168 extern MagickExport ChannelType
00169   SetPixelChannelMask(Image *,const ChannelType);
00170 
00171 extern MagickExport MagickBooleanType
00172   ExportImagePixels(const Image *,const ssize_t,const ssize_t,const size_t,
00173     const size_t,const char *,const StorageType,void *,ExceptionInfo *),
00174   ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
00175     const size_t,const char *,const StorageType,const void *,ExceptionInfo *),
00176   InterpolatePixelChannel(const Image *,const CacheView_ *,
00177     const PixelChannel,const PixelInterpolateMethod,const double,const double,
00178     double *,ExceptionInfo *),
00179   InterpolatePixelChannels(const Image *,const CacheView_ *,const Image *,
00180     const PixelInterpolateMethod,const double,const double,Quantum *,
00181     ExceptionInfo *),
00182   InterpolatePixelInfo(const Image *,const CacheView_ *,
00183     const PixelInterpolateMethod,const double,const double,PixelInfo *,
00184     ExceptionInfo *),
00185   IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *,
00186     const Quantum *),
00187   IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *);
00188 
00189 extern MagickExport PixelChannelMap
00190   *AcquirePixelChannelMap(void),
00191   *ClonePixelChannelMap(PixelChannelMap *),
00192   *DestroyPixelChannelMap(PixelChannelMap *);
00193 
00194 extern MagickExport PixelInfo
00195   *ClonePixelInfo(const PixelInfo *);
00196 
00197 extern MagickExport void
00198   InitializePixelChannelMap(Image *),
00199   GetPixelInfo(const Image *,PixelInfo *),
00200   SetPixelChannelMapMask(Image *,const ChannelType);
00201 
00202 #if defined(__cplusplus) || defined(c_plusplus)
00203 }
00204 #endif
00205 
00206 #endif