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