MagickCore  6.7.5
image.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 methods.
00017 */
00018 #ifndef _MAGICKCORE_IMAGE_H
00019 #define _MAGICKCORE_IMAGE_H
00020 
00021 #if defined(__cplusplus) || defined(c_plusplus)
00022 extern "C" {
00023 #endif
00024 
00025 #include <MagickCore/color.h>
00026 
00027 #define OpaqueAlpha  ((Quantum) QuantumRange)
00028 #define TransparentAlpha  ((Quantum) 0UL)
00029 
00030 typedef enum
00031 {
00032   UndefinedAlphaChannel,
00033   ActivateAlphaChannel,
00034   BackgroundAlphaChannel,
00035   CopyAlphaChannel,
00036   DeactivateAlphaChannel,
00037   ExtractAlphaChannel,
00038   OpaqueAlphaChannel,
00039   RemoveAlphaChannel,
00040   SetAlphaChannel,
00041   ShapeAlphaChannel,
00042   TransparentAlphaChannel
00043 } AlphaChannelType;
00044 
00045 typedef enum
00046 {
00047   UndefinedType,
00048   BilevelType,
00049   GrayscaleType,
00050   GrayscaleMatteType,
00051   PaletteType,
00052   PaletteMatteType,
00053   TrueColorType,
00054   TrueColorMatteType,
00055   ColorSeparationType,
00056   ColorSeparationMatteType,
00057   OptimizeType,
00058   PaletteBilevelMatteType
00059 } ImageType;
00060 
00061 typedef enum
00062 {
00063   UndefinedInterlace,
00064   NoInterlace,
00065   LineInterlace,
00066   PlaneInterlace,
00067   PartitionInterlace,
00068   GIFInterlace,
00069   JPEGInterlace,
00070   PNGInterlace
00071 } InterlaceType;
00072 
00073 typedef enum
00074 {
00075   UndefinedOrientation,
00076   TopLeftOrientation,
00077   TopRightOrientation,
00078   BottomRightOrientation,
00079   BottomLeftOrientation,
00080   LeftTopOrientation,
00081   RightTopOrientation,
00082   RightBottomOrientation,
00083   LeftBottomOrientation
00084 } OrientationType;
00085 
00086 typedef enum
00087 {
00088   UndefinedResolution,
00089   PixelsPerInchResolution,
00090   PixelsPerCentimeterResolution
00091 } ResolutionType;
00092 
00093 typedef struct _PrimaryInfo
00094 {
00095   double
00096     x,
00097     y,
00098     z;
00099 } PrimaryInfo;
00100 
00101 typedef struct _SegmentInfo
00102 {
00103   double
00104     x1,
00105     y1,
00106     x2,
00107     y2;
00108 } SegmentInfo;
00109 
00110 typedef enum
00111 {
00112   UndefinedTransmitType,
00113   FileTransmitType,
00114   BlobTransmitType,
00115   StreamTransmitType,
00116   ImageTransmitType
00117 } TransmitType;
00118 
00119 typedef struct _ChromaticityInfo
00120 {
00121   PrimaryInfo
00122     red_primary,
00123     green_primary,
00124     blue_primary,
00125     white_point;
00126 } ChromaticityInfo;
00127 
00128 #include "MagickCore/blob.h"
00129 #include "MagickCore/colorspace.h"
00130 #include "MagickCore/cache-view.h"
00131 #include "MagickCore/color.h"
00132 #include "MagickCore/composite.h"
00133 #include "MagickCore/compress.h"
00134 #include "MagickCore/effect.h"
00135 #include "MagickCore/geometry.h"
00136 #include "MagickCore/layer.h"
00137 #include "MagickCore/locale_.h"
00138 #include "MagickCore/monitor.h"
00139 #include "MagickCore/pixel.h"
00140 #include "MagickCore/profile.h"
00141 #include "MagickCore/quantum.h"
00142 #include "MagickCore/resample.h"
00143 #include "MagickCore/resize.h"
00144 #include "MagickCore/semaphore.h"
00145 #include "MagickCore/stream.h"
00146 #include "MagickCore/timer.h"
00147 
00148 struct _Image
00149 {
00150   ClassType
00151     storage_class;
00152 
00153   ColorspaceType
00154     colorspace;         /* colorspace of image data */
00155 
00156   CompressionType
00157     compression;        /* compression of image when read/write */
00158 
00159   size_t
00160     quality;            /* compression quality setting, meaning varies */
00161 
00162   OrientationType
00163     orientation;        /* photo orientation of image */
00164 
00165   MagickBooleanType
00166     taint,              /* has image been modified since reading */
00167     matte;              /* is transparency channel defined and active */
00168 
00169   size_t
00170     columns,            /* physical size of image */
00171     rows,
00172     depth,              /* depth of image on read/write */
00173     colors;             /* Size of color table, or actual color count */
00174                         /* Only valid if image is not DirectClass */
00175 
00176   PixelInfo
00177     *colormap,
00178     background_color,   /* current background color attribute */
00179     border_color,       /* current bordercolor attribute */
00180     matte_color,        /* current mattecolor attribute */
00181     transparent_color;  /* color for 'transparent' color index in GIF */
00182 
00183   double
00184     gamma;
00185 
00186   ChromaticityInfo
00187     chromaticity;
00188 
00189   RenderingIntent
00190     rendering_intent;
00191 
00192   void
00193     *profiles;
00194 
00195   ResolutionType
00196     units;          /* resolution/density  ppi or ppc */
00197 
00198   char
00199     *montage,
00200     *directory,
00201     *geometry;
00202 
00203   ssize_t
00204     offset;
00205 
00206   PointInfo
00207     resolution;     /* image resolution/density */
00208 
00209   RectangleInfo
00210     page,           /* virtual canvas size and offset of image */
00211     extract_info;
00212 
00213   double
00214     bias,           /* FUTURE: depreciated -- convolve bias */
00215     blur,           /* FUTURE: depreciated -- resize file blur */
00216     fuzz;           /* current color fuzz attribute - make image_info */
00217 
00218   FilterTypes
00219     filter;         /* resize/distort filter to apply */
00220 
00221   InterlaceType
00222     interlace;
00223 
00224   EndianType
00225     endian;         /* raw data integer ordering on read/write */
00226 
00227   GravityType
00228     gravity;        /* Gravity attribute for positioning in image */
00229 
00230   CompositeOperator
00231     compose;        /* alpha composition method for layered images */
00232 
00233   DisposeType
00234     dispose;        /* GIF animation disposal method */
00235 
00236   size_t
00237     scene,          /* index of image in multi-image file */
00238     delay;          /* Animation delay time */
00239 
00240   ssize_t
00241     ticks_per_second;  /* units for delay time, default 100 for GIF */
00242 
00243   size_t
00244     iterations,
00245     total_colors;
00246 
00247   ssize_t
00248     start_loop;
00249 
00250   PixelInterpolateMethod
00251     interpolate;       /* Interpolation of color for between pixel lookups */
00252 
00253   MagickBooleanType
00254     black_point_compensation;
00255 
00256   RectangleInfo
00257     tile_offset;
00258 
00259   void
00260     *properties,       /* per image properities */
00261     *artifacts;        /* per image sequence image artifacts */
00262 
00263   ImageType
00264     type;
00265 
00266   MagickBooleanType
00267     dither;            /* dithering on/off */
00268 
00269   MagickSizeType
00270     extent;            /* Size of image read from disk */
00271 
00272   MagickBooleanType
00273     ping;
00274 
00275   MagickBooleanType
00276     mask;
00277 
00278   size_t
00279     number_channels,
00280     number_meta_channels,
00281     metacontent_extent;
00282 
00283   ChannelType
00284     channel_mask;
00285 
00286   PixelChannelMap
00287     *channel_map;
00288 
00289   void
00290     *cache;
00291 
00292   ErrorInfo
00293     error;
00294 
00295   TimerInfo
00296     timer;
00297 
00298   MagickProgressMonitor
00299     progress_monitor;
00300 
00301   void
00302     *client_data;
00303 
00304   Ascii85Info
00305     *ascii85;
00306 
00307   ProfileInfo
00308     *generic_profile;
00309 
00310   char
00311     filename[MaxTextExtent],        /* images input filename */
00312     magick_filename[MaxTextExtent], /* given image filename (with read mods) */
00313     magick[MaxTextExtent];          /* images file format (file magic) */
00314 
00315   size_t
00316     magick_columns,
00317     magick_rows;
00318 
00319   BlobInfo
00320     *blob;             /* image file as in-memory string of 'extent' */
00321 
00322   MagickBooleanType
00323     debug;             /* debug output attribute */
00324 
00325   volatile ssize_t
00326     reference_count;   /* image data sharing memory management */
00327 
00328   SemaphoreInfo
00329     *semaphore;
00330 
00331   struct _Image
00332     *previous,         /* Image sequence list links */
00333     *list,
00334     *next;
00335 
00336   size_t
00337     signature;
00338 };
00339 
00340 struct _ImageInfo
00341 {
00342   CompressionType
00343     compression;        /* compression method when reading/saving image */
00344 
00345   OrientationType
00346     orientation;        /* orientation setting */
00347 
00348   MagickBooleanType
00349     temporary,
00350     adjoin,             /* save images to seperate scene files */
00351     affirm,
00352     antialias;
00353 
00354   char
00355     *size,              /* image generation size */
00356     *extract,           /* crop/resize string on image read */
00357     *page,
00358     *scenes;            /* scene numbers that is to be read in */
00359 
00360   size_t
00361     scene,              /* starting value for image save numbering */
00362     number_scenes,      /* total number of images in list - for escapes */
00363     depth;              /* current read/save depth of images */
00364 
00365   InterlaceType
00366     interlace;          /* interlace for image write */
00367 
00368   EndianType
00369     endian;             /* integer endian order for raw image data */
00370 
00371   ResolutionType
00372     units;              /* denisty pixels/inch or pixel/cm */
00373 
00374   size_t
00375     quality;            /* compression quality */
00376 
00377   char
00378     *sampling_factor,   /* JPEG write sampling factor */
00379     *server_name,       /* X windows server name - display/animate */
00380     *font,              /* DUP for draw_info */
00381     *texture,           /* montage/display background tile */
00382     *density;           /* DUP for image and draw_info */
00383 
00384   double
00385     pointsize,
00386     fuzz;               /* current color fuzz attribute */
00387 
00388   PixelInfo
00389     background_color,   /* user set background color */
00390     border_color,       /* user set border color */
00391     matte_color,        /* matte (frame) color */
00392     transparent_color;  /* color for transparent index in color tables */
00393                         /* NB: fill color is only needed in draw_info! */
00394                         /* the same for undercolor (for font drawing) */
00395 
00396   MagickBooleanType
00397     dither,             /* dither enable-disable */
00398     monochrome;         /* read/write pcl,pdf,ps,xps as monocrome image */
00399 
00400   ColorspaceType
00401     colorspace;
00402 
00403   CompositeOperator
00404     compose;
00405 
00406   ImageType
00407     type;
00408 
00409   PreviewType
00410     preview_type;
00411 
00412   ssize_t
00413     group;
00414 
00415   MagickBooleanType
00416     ping,                    /* fast read image attributes, not image data */
00417     verbose;                 /* verbose output enable/disable */
00418 
00419   char
00420     *view;
00421 
00422   ChannelType
00423     channel;
00424 
00425   void
00426     *options;                /* splay tree of use options */
00427 
00428   void
00429     *profile;
00430 
00431   MagickBooleanType
00432     synchronize;
00433 
00434   MagickProgressMonitor
00435     progress_monitor;
00436 
00437   void
00438     *client_data,
00439     *cache;
00440 
00441   StreamHandler
00442     stream;
00443 
00444   FILE
00445     *file;
00446 
00447   void
00448     *blob;
00449 
00450   size_t
00451     length;
00452 
00453   char
00454     magick[MaxTextExtent],    /* image file format (file magick) */
00455     unique[MaxTextExtent],    /* unique tempory filename - delegates */
00456     zero[MaxTextExtent],      /* unique filename ? - delegates */
00457     filename[MaxTextExtent];  /* filename when reading/writing image */
00458 
00459   MagickBooleanType
00460     debug;
00461 
00462   size_t
00463     signature;
00464 };
00465 
00466 extern MagickExport const char
00467   DefaultTileGeometry[],
00468   DefaultTileLabel[],
00469   LoadImageTag[],
00470   LoadImagesTag[],
00471   PSDensityGeometry[],
00472   PSPageGeometry[],
00473   SaveImageTag[],
00474   SaveImagesTag[];
00475 
00476 extern MagickExport const double
00477   DefaultResolution;
00478 
00479 extern MagickExport ExceptionType
00480   CatchImageException(Image *);
00481 
00482 extern MagickExport FILE
00483   *GetImageInfoFile(const ImageInfo *);
00484 
00485 extern MagickExport Image
00486   *AcquireImage(const ImageInfo *,ExceptionInfo *),
00487   *AppendImages(const Image *,const MagickBooleanType,ExceptionInfo *),
00488   *CloneImage(const Image *,const size_t,const size_t,const MagickBooleanType,
00489     ExceptionInfo *),
00490   *CombineImages(const Image *,ExceptionInfo *),
00491   *DestroyImage(Image *),
00492   *GetImageClipMask(const Image *,ExceptionInfo *),
00493   *GetImageMask(const Image *,ExceptionInfo *),
00494   *NewMagickImage(const ImageInfo *,const size_t,const size_t,const PixelInfo *,
00495     ExceptionInfo *),
00496   *ReferenceImage(Image *),
00497   *SeparateImage(const Image *,const ChannelType,ExceptionInfo *),
00498   *SeparateImages(const Image *,ExceptionInfo *),
00499   *SmushImages(const Image *,const MagickBooleanType,const ssize_t,
00500     ExceptionInfo *);
00501 
00502 extern MagickExport ImageInfo
00503   *AcquireImageInfo(void),
00504   *CloneImageInfo(const ImageInfo *),
00505   *DestroyImageInfo(ImageInfo *);
00506 
00507 extern MagickExport MagickBooleanType
00508   ClipImage(Image *,ExceptionInfo *),
00509   ClipImagePath(Image *,const char *,const MagickBooleanType,ExceptionInfo *),
00510   GetImageAlphaChannel(const Image *),
00511   IsTaintImage(const Image *),
00512   IsHighDynamicRangeImage(const Image *,ExceptionInfo *),
00513   IsImageObject(const Image *),
00514   ListMagickInfo(FILE *,ExceptionInfo *),
00515   ModifyImage(Image **,ExceptionInfo *),
00516   ResetImagePage(Image *,const char *),
00517   SetImageAlpha(Image *,const Quantum,ExceptionInfo *),
00518   SetImageAlphaChannel(Image *,const AlphaChannelType,ExceptionInfo *),
00519   SetImageBackgroundColor(Image *,ExceptionInfo *),
00520   SetImageColor(Image *,const PixelInfo *,ExceptionInfo *),
00521   SetImageExtent(Image *,const size_t,const size_t,ExceptionInfo *),
00522   SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *),
00523   SetImageMask(Image *,const Image *,ExceptionInfo *),
00524   SetImageStorageClass(Image *,const ClassType,ExceptionInfo *),
00525   SetImageType(Image *,const ImageType,ExceptionInfo *),
00526   StripImage(Image *,ExceptionInfo *),
00527   SyncImage(Image *,ExceptionInfo *),
00528   SyncImageSettings(const ImageInfo *,Image *,ExceptionInfo *),
00529   SyncImagesSettings(ImageInfo *,Image *,ExceptionInfo *);
00530 
00531 extern MagickExport size_t
00532   InterpretImageFilename(const ImageInfo *,Image *,const char *,int,char *,
00533     ExceptionInfo *);
00534 
00535 extern MagickExport ssize_t
00536   GetImageReferenceCount(Image *);
00537 
00538 extern MagickExport VirtualPixelMethod
00539   GetImageVirtualPixelMethod(const Image *),
00540   SetImageVirtualPixelMethod(const Image *,const VirtualPixelMethod);
00541 
00542 extern MagickExport void
00543   AcquireNextImage(const ImageInfo *,Image *,ExceptionInfo *),
00544   DestroyImagePixels(Image *),
00545   DisassociateImageStream(Image *),
00546   GetImageInfo(ImageInfo *),
00547   SetImageInfoBlob(ImageInfo *,const void *,const size_t),
00548   SetImageInfoFile(ImageInfo *,FILE *);
00549 
00550 #if defined(__cplusplus) || defined(c_plusplus)
00551 }
00552 #endif
00553 
00554 #endif