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