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