]> granicus.if.org Git - imagemagick/blob - MagickCore/image.h
Renamed FilterTypes to FilterType.
[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   ssize_t
439     group;
440
441   MagickBooleanType
442     ping,                    /* fast read image attributes, not image data */
443     verbose;                 /* verbose output enable/disable */
444
445   ChannelType
446     channel;
447
448   void
449     *options;                /* splay tree of global options */
450
451   void
452     *profile;
453
454   MagickBooleanType
455     synchronize;
456
457   MagickProgressMonitor
458     progress_monitor;
459
460   void
461     *client_data,
462     *cache;
463
464   StreamHandler
465     stream;
466
467   FILE
468     *file;
469
470   void
471     *blob;
472
473   size_t
474     length;
475
476   char
477     magick[MagickPathExtent],    /* image file format (file magick) */
478     unique[MagickPathExtent],    /* unique tempory filename - delegates */
479     zero[MagickPathExtent],      /* unique filename ? - delegates */
480     filename[MagickPathExtent];  /* filename when reading/writing image */
481
482   MagickBooleanType
483     debug;
484
485   size_t
486     signature;
487 };
488
489 extern MagickExport ChannelType
490   SetImageChannelMask(Image *,const ChannelType);
491
492 extern MagickExport const char
493   DefaultTileGeometry[],
494   DefaultTileLabel[],
495   LoadImageTag[],
496   LoadImagesTag[],
497   PSDensityGeometry[],
498   PSPageGeometry[],
499   SaveImageTag[],
500   SaveImagesTag[];
501
502 extern MagickExport const double
503   DefaultResolution;
504
505 extern MagickExport ExceptionType
506   CatchImageException(Image *);
507
508 extern MagickExport FILE
509   *GetImageInfoFile(const ImageInfo *);
510
511 extern MagickExport Image
512   *AcquireImage(const ImageInfo *,ExceptionInfo *),
513   *AppendImages(const Image *,const MagickBooleanType,ExceptionInfo *),
514   *CloneImage(const Image *,const size_t,const size_t,const MagickBooleanType,
515     ExceptionInfo *),
516   *DestroyImage(Image *),
517   *GetImageMask(const Image *,const PixelMask,ExceptionInfo *),
518   *NewMagickImage(const ImageInfo *,const size_t,const size_t,const PixelInfo *,
519     ExceptionInfo *),
520   *ReferenceImage(Image *),
521   *SmushImages(const Image *,const MagickBooleanType,const ssize_t,
522     ExceptionInfo *);
523
524 extern MagickExport ImageInfo
525   *AcquireImageInfo(void),
526   *CloneImageInfo(const ImageInfo *),
527   *DestroyImageInfo(ImageInfo *);
528
529 extern MagickExport MagickBooleanType
530   ClipImage(Image *,ExceptionInfo *),
531   ClipImagePath(Image *,const char *,const MagickBooleanType,ExceptionInfo *),
532   CopyImagePixels(Image *,const Image *,const RectangleInfo *,
533     const OffsetInfo *,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 PixelMask type,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