]> granicus.if.org Git - imagemagick/blob - MagickCore/image.h
(no commit message)
[imagemagick] / MagickCore / image.h
1 /*
2   Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization
3   dedicated to making software imaging solutions freely available.
4
5   You may not use this file except in compliance with the License.
6   obtain a copy of the License at
7
8     http://www.imagemagick.org/script/license.php
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15
16   MagickCore image methods.
17 */
18 #ifndef _MAGICKCORE_IMAGE_H
19 #define _MAGICKCORE_IMAGE_H
20
21 #include "MagickCore/color.h"
22 #include "MagickCore/pixel.h"
23
24 #if defined(__cplusplus) || defined(c_plusplus)
25 extern "C" {
26 #endif
27
28 #define OpaqueAlpha  ((Quantum) QuantumRange)
29 #define TransparentAlpha  ((Quantum) 0)
30
31 typedef enum
32 {
33   UndefinedAlphaChannel,
34   ActivateAlphaChannel,
35   AssociateAlphaChannel,
36   BackgroundAlphaChannel,
37   CopyAlphaChannel,
38   DeactivateAlphaChannel,
39   DiscreteAlphaChannel,
40   DisassociateAlphaChannel,
41   ExtractAlphaChannel,
42   OpaqueAlphaChannel,
43   RemoveAlphaChannel,
44   SetAlphaChannel,
45   ShapeAlphaChannel,
46   TransparentAlphaChannel
47 } AlphaChannelOption;
48
49 typedef enum
50 {
51   UndefinedType,
52   BilevelType,
53   GrayscaleType,
54   GrayscaleMatteType,
55   PaletteType,
56   PaletteMatteType,
57   TrueColorType,
58   TrueColorMatteType,
59   ColorSeparationType,
60   ColorSeparationMatteType,
61   OptimizeType,
62   PaletteBilevelMatteType
63 } ImageType;
64
65 typedef enum
66 {
67   UndefinedInterlace,
68   NoInterlace,
69   LineInterlace,
70   PlaneInterlace,
71   PartitionInterlace,
72   GIFInterlace,
73   JPEGInterlace,
74   PNGInterlace
75 } InterlaceType;
76
77 typedef enum
78 {
79   UndefinedOrientation,
80   TopLeftOrientation,
81   TopRightOrientation,
82   BottomRightOrientation,
83   BottomLeftOrientation,
84   LeftTopOrientation,
85   RightTopOrientation,
86   RightBottomOrientation,
87   LeftBottomOrientation
88 } OrientationType;
89
90 typedef enum
91 {
92   UndefinedResolution,
93   PixelsPerInchResolution,
94   PixelsPerCentimeterResolution
95 } ResolutionType;
96
97 typedef struct _PrimaryInfo
98 {
99   double
100     x,
101     y,
102     z;
103 } PrimaryInfo;
104
105 typedef struct _SegmentInfo
106 {
107   double
108     x1,
109     y1,
110     x2,
111     y2;
112 } SegmentInfo;
113
114 typedef enum
115 {
116   UndefinedTransmitType,
117   FileTransmitType,
118   BlobTransmitType,
119   StreamTransmitType,
120   ImageTransmitType
121 } TransmitType;
122
123 typedef struct _ChromaticityInfo
124 {
125   PrimaryInfo
126     red_primary,
127     green_primary,
128     blue_primary,
129     white_point;
130 } ChromaticityInfo;
131
132 #include "MagickCore/blob.h"
133 #include "MagickCore/colorspace.h"
134 #include "MagickCore/cache-view.h"
135 #include "MagickCore/color.h"
136 #include "MagickCore/composite.h"
137 #include "MagickCore/compress.h"
138 #include "MagickCore/effect.h"
139 #include "MagickCore/geometry.h"
140 #include "MagickCore/layer.h"
141 #include "MagickCore/locale_.h"
142 #include "MagickCore/monitor.h"
143 #include "MagickCore/pixel.h"
144 #include "MagickCore/profile.h"
145 #include "MagickCore/quantum.h"
146 #include "MagickCore/resample.h"
147 #include "MagickCore/resize.h"
148 #include "MagickCore/semaphore.h"
149 #include "MagickCore/stream.h"
150 #include "MagickCore/timer.h"
151
152 struct _Image
153 {
154   ClassType
155     storage_class;
156
157   ColorspaceType
158     colorspace;         /* colorspace of image data */
159
160   CompressionType
161     compression;        /* compression of image when read/write */
162
163   size_t
164     quality;            /* compression quality setting, meaning varies */
165
166   OrientationType
167     orientation;        /* photo orientation of image */
168
169   MagickBooleanType
170     taint;              /* has image been modified since reading */
171
172   size_t
173     columns,            /* physical size of image */
174     rows,
175     depth,              /* depth of image on read/write */
176     colors;             /* Size of color table, or actual color count */
177                         /* Only valid if image is not DirectClass */
178
179   PixelInfo
180     *colormap,
181     background_color,   /* current background color attribute */
182     border_color,       /* current bordercolor attribute */
183     matte_color,        /* current mattecolor attribute */
184     transparent_color;  /* color for 'transparent' color index in GIF */
185
186   double
187     gamma;
188
189   ChromaticityInfo
190     chromaticity;
191
192   RenderingIntent
193     rendering_intent;
194
195   void
196     *profiles;
197
198   ResolutionType
199     units;          /* resolution/density  ppi or ppc */
200
201   char
202     *montage,
203     *directory,
204     *geometry;
205
206   ssize_t
207     offset;         /* ??? */
208
209   PointInfo
210     resolution;     /* image resolution/density */
211
212   RectangleInfo
213     page,           /* virtual canvas size and offset of image */
214     extract_info;
215
216   double
217     fuzz;           /* current color fuzz attribute - move to image_info */
218
219   FilterTypes
220     filter;         /* resize/distort filter to apply */
221
222   PixelIntensityMethod
223     intensity;      /* method to generate an intensity value from a pixel */
224
225   InterlaceType
226     interlace;
227
228   EndianType
229     endian;         /* raw data integer ordering on read/write */
230
231   GravityType
232     gravity;        /* Gravity attribute for positioning in image */
233
234   CompositeOperator
235     compose;        /* alpha composition method for layered images */
236
237   DisposeType
238     dispose;        /* GIF animation disposal method */
239
240   size_t
241     scene,          /* index of image in multi-image file */
242     delay,          /* Animation delay time */
243     duration;       /* Total animation duration sum(delay*iterations) */
244
245   ssize_t
246     ticks_per_second;  /* units for delay time, default 100 for GIF */
247
248   size_t
249     iterations,        /* number of interations for GIF animations */
250     total_colors;
251
252   ssize_t
253     start_loop;        /* ??? */
254
255   PixelInterpolateMethod
256     interpolate;       /* Interpolation of color for between pixel lookups */
257
258   MagickBooleanType
259     black_point_compensation;
260
261   RectangleInfo
262     tile_offset;
263
264   ImageType
265     type;
266
267   MagickBooleanType
268     dither;            /* dithering on/off */
269
270   MagickSizeType
271     extent;            /* Size of image read from disk */
272
273   MagickBooleanType
274     ping;              /* no image data read, just attributes */
275
276   MagickBooleanType
277     read_mask,
278     write_mask;
279
280   PixelTrait
281     alpha_trait;       /* is transparency channel defined and active */
282
283   size_t
284     number_channels,
285     number_meta_channels,
286     metacontent_extent;
287
288   ChannelType
289     channel_mask;
290
291   PixelChannelMap
292     *channel_map;
293
294   void
295     *cache;
296
297   ErrorInfo
298     error;
299
300   TimerInfo
301     timer;
302
303   MagickProgressMonitor
304     progress_monitor;
305
306   void
307     *client_data;
308
309   Ascii85Info
310     *ascii85;
311
312   ProfileInfo
313     *generic_profile;
314
315   void
316     *properties,       /* general settings, to save with image */
317     *artifacts;        /* general operational/coder settings, not saved */
318
319   char
320     filename[MaxTextExtent],        /* images input filename */
321     magick_filename[MaxTextExtent], /* given image filename (with read mods) */
322     magick[MaxTextExtent];          /* images file format (file magic) */
323
324   size_t
325     magick_columns,     /* size of image when read/created */
326     magick_rows;
327
328   BlobInfo
329     *blob;             /* image file as in-memory string of 'extent' */
330
331   time_t
332     timestamp;
333
334   MagickBooleanType
335     debug;             /* debug output attribute */
336
337   volatile ssize_t
338     reference_count;   /* image data sharing memory management */
339
340   SemaphoreInfo
341     *semaphore;
342
343   const struct _ImageInfo
344     *image_info;       /* (Optional) Image belongs to this ImageInfo 'list'
345                         * For access to 'global options' when no per-image
346                         * attribute, properity, or artifact has been set.
347                         * It may be set or unset as needed, but never freed.
348                         */
349
350   struct _Image
351     *list,             /* Undo/Redo image processing list (for display) */
352     *previous,         /* Image list links */
353     *next;
354
355   size_t
356     signature;
357 };
358
359 /* ImageInfo structure
360  * Stores an image list, as well as all global settings used by
361  * all images held, -- unless overridden for that specific image.
362  * See SyncImagesettings() which maps any global setting that always
363  * overrides specific image settings.
364  */
365 struct _ImageInfo
366 {
367   CompressionType
368     compression;        /* compression method when reading/saving image */
369
370   OrientationType
371     orientation;        /* orientation setting */
372
373   MagickBooleanType
374     temporary,          /* image file to be deleted after read "empemeral:" */
375     adjoin,             /* save images to seperate scene files */
376     affirm,
377     antialias;
378
379   char
380     *size,              /* image generation size */
381     *extract,           /* crop/resize string on image read */
382     *page,
383     *scenes;            /* scene numbers that is to be read in */
384
385   size_t
386     scene,              /* starting value for image save numbering */
387     number_scenes,      /* total number of images in list - for escapes */
388     depth;              /* current read/save depth of images */
389
390   InterlaceType
391     interlace;          /* interlace for image write */
392
393   EndianType
394     endian;             /* integer endian order for raw image data */
395
396   ResolutionType
397     units;              /* denisty pixels/inch or pixel/cm */
398
399   size_t
400     quality;            /* compression quality */
401
402   char
403     *sampling_factor,   /* JPEG write sampling factor */
404     *server_name,       /* X windows server name - display/animate */
405     *font,              /* DUP for draw_info */
406     *texture,           /* montage/display background tile */
407     *density;           /* DUP for image and draw_info */
408
409   double
410     pointsize,
411     fuzz;               /* current color fuzz attribute */
412
413   PixelInfo
414     background_color,   /* user set background color */
415     border_color,       /* user set border color */
416     matte_color,        /* matte (frame) color */
417     transparent_color;  /* color for transparent index in color tables */
418                         /* NB: fill color is only needed in draw_info! */
419                         /* the same for undercolor (for font drawing) */
420
421   MagickBooleanType
422     dither,             /* dither enable-disable */
423     monochrome;         /* read/write pcl,pdf,ps,xps as monocrome image */
424
425   ColorspaceType
426     colorspace;
427
428   CompositeOperator
429     compose;
430
431   ImageType
432     type;
433
434   PreviewType
435     preview_type;
436
437   ssize_t
438     group;
439
440   MagickBooleanType
441     ping,                    /* fast read image attributes, not image data */
442     verbose;                 /* verbose output enable/disable */
443
444   char
445     *view;
446
447   ChannelType
448     channel;
449
450   void
451     *options;                /* splay tree of global options */
452
453   void
454     *profile;
455
456   MagickBooleanType
457     synchronize;
458
459   MagickProgressMonitor
460     progress_monitor;
461
462   void
463     *client_data,
464     *cache;
465
466   StreamHandler
467     stream;
468
469   FILE
470     *file;
471
472   void
473     *blob;
474
475   size_t
476     length;
477
478   char
479     magick[MaxTextExtent],    /* image file format (file magick) */
480     unique[MaxTextExtent],    /* unique tempory filename - delegates */
481     zero[MaxTextExtent],      /* unique filename ? - delegates */
482     filename[MaxTextExtent];  /* filename when reading/writing image */
483
484   MagickBooleanType
485     debug;
486
487   size_t
488     signature;
489 };
490
491 extern MagickExport ChannelType
492   SetImageChannelMask(Image *,const ChannelType);
493
494 extern MagickExport const char
495   DefaultTileGeometry[],
496   DefaultTileLabel[],
497   LoadImageTag[],
498   LoadImagesTag[],
499   PSDensityGeometry[],
500   PSPageGeometry[],
501   SaveImageTag[],
502   SaveImagesTag[];
503
504 extern MagickExport const double
505   DefaultResolution;
506
507 extern MagickExport ExceptionType
508   CatchImageException(Image *);
509
510 extern MagickExport FILE
511   *GetImageInfoFile(const ImageInfo *);
512
513 extern MagickExport Image
514   *AcquireImage(const ImageInfo *,ExceptionInfo *),
515   *AppendImages(const Image *,const MagickBooleanType,ExceptionInfo *),
516   *CloneImage(const Image *,const size_t,const size_t,const MagickBooleanType,
517     ExceptionInfo *),
518   *DestroyImage(Image *),
519   *GetImageMask(const Image *,ExceptionInfo *),
520   *NewMagickImage(const ImageInfo *,const size_t,const size_t,const PixelInfo *,
521     ExceptionInfo *),
522   *ReferenceImage(Image *),
523   *SmushImages(const Image *,const MagickBooleanType,const ssize_t,
524     ExceptionInfo *);
525
526 extern MagickExport ImageInfo
527   *AcquireImageInfo(void),
528   *CloneImageInfo(const ImageInfo *),
529   *DestroyImageInfo(ImageInfo *);
530
531 extern MagickExport MagickBooleanType
532   ClipImage(Image *,ExceptionInfo *),
533   ClipImagePath(Image *,const char *,const MagickBooleanType,ExceptionInfo *),
534   IsTaintImage(const Image *),
535   IsHighDynamicRangeImage(const Image *,ExceptionInfo *),
536   IsImageObject(const Image *),
537   ListMagickInfo(FILE *,ExceptionInfo *),
538   ModifyImage(Image **,ExceptionInfo *),
539   ResetImagePage(Image *,const char *),
540   SetImageAlpha(Image *,const Quantum,ExceptionInfo *),
541   SetImageBackgroundColor(Image *,ExceptionInfo *),
542   SetImageColor(Image *,const PixelInfo *,ExceptionInfo *),
543   SetImageExtent(Image *,const size_t,const size_t,ExceptionInfo *),
544   SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *),
545   SetImageMask(Image *,const Image *,ExceptionInfo *),
546   SetImageStorageClass(Image *,const ClassType,ExceptionInfo *),
547   StripImage(Image *,ExceptionInfo *),
548   SyncImage(Image *,ExceptionInfo *),
549   SyncImageSettings(const ImageInfo *,Image *,ExceptionInfo *),
550   SyncImagesSettings(ImageInfo *,Image *,ExceptionInfo *);
551
552 extern MagickExport size_t
553   InterpretImageFilename(const ImageInfo *,Image *,const char *,int,char *,
554     ExceptionInfo *);
555
556 extern MagickExport ssize_t
557   GetImageReferenceCount(Image *);
558
559 extern MagickExport VirtualPixelMethod
560   GetImageVirtualPixelMethod(const Image *),
561   SetImageVirtualPixelMethod(Image *,const VirtualPixelMethod,ExceptionInfo *);
562
563 extern MagickExport void
564   AcquireNextImage(const ImageInfo *,Image *,ExceptionInfo *),
565   DestroyImagePixels(Image *),
566   DisassociateImageStream(Image *),
567   GetImageInfo(ImageInfo *),
568   SetImageInfoBlob(ImageInfo *,const void *,const size_t),
569   SetImageInfoFile(ImageInfo *,FILE *);
570
571 #if defined(__cplusplus) || defined(c_plusplus)
572 }
573 #endif
574
575 #endif