]> 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   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   char
316     filename[MaxTextExtent],        /* images input filename */
317     magick_filename[MaxTextExtent], /* given image filename (with read mods) */
318     magick[MaxTextExtent];          /* images file format (file magic) */
319
320   size_t
321     magick_columns,
322     magick_rows;
323
324   BlobInfo
325     *blob;             /* image file as in-memory string of 'extent' */
326
327   MagickBooleanType
328     debug;             /* debug output attribute */
329
330   volatile ssize_t
331     reference_count;   /* image data sharing memory management */
332
333   SemaphoreInfo
334     *semaphore;
335
336   struct _Image
337     *previous,         /* Image sequence list links */
338     *list,
339     *next;
340
341   size_t
342     signature;
343 };
344
345 struct _ImageInfo
346 {
347   CompressionType
348     compression;
349
350   OrientationType
351     orientation;
352
353   MagickBooleanType
354     temporary,
355     adjoin,
356     affirm,
357     antialias;
358
359   char
360     *size,
361     *extract,
362     *page,
363     *scenes;
364
365   size_t
366     scene,
367     number_scenes,
368     depth;
369
370   InterlaceType
371     interlace;          /* interlace for image write */
372
373   EndianType
374     endian;             /* integer endian order for raw image data */
375
376   ResolutionType
377     units;              /* denisty pixels/inch or pixel/cm */
378
379   size_t
380     quality;            /* compression quality */
381
382   char
383     *sampling_factor,   /* JPEG write sampling factor */
384     *server_name,       /* X windows server name - display/animate */
385     *font,              /* draw_info */
386     *texture,           /* montage/display background tile */
387     *density;           /* for image and draw_info */
388
389   double
390     pointsize,
391     fuzz;               /* current color fuzz attribute */
392
393   PixelInfo
394     background_color,
395     border_color,
396     matte_color;
397
398   MagickBooleanType
399     dither,            /* dither enable-disable */
400     monochrome;        /* read/write pcl,pdf,ps,xps as monocrome image */
401
402   ColorspaceType
403     colorspace;
404
405   ImageType
406     type;
407
408   PreviewType
409     preview_type;
410
411   ssize_t
412     group;
413
414   MagickBooleanType
415     ping,                    /* fast read image attributes, not image data */
416     verbose;                 /* verbose output enable/disable */
417
418   char
419     *view;
420     /* authenticate -- moved to ImageOptions() */
421
422   ChannelType
423     channel;
424
425   void
426     *options;                /* splay tree of use options */
427
428   VirtualPixelMethod
429     virtual_pixel_method;
430
431   PixelInfo
432     transparent_color;
433
434   void
435     *profile;
436
437   MagickBooleanType
438     synchronize;
439
440   MagickProgressMonitor
441     progress_monitor;
442
443   void
444     *client_data,
445     *cache;
446
447   StreamHandler
448     stream;
449
450   FILE
451     *file;
452
453   void
454     *blob;
455
456   size_t
457     length;
458
459   char
460     magick[MaxTextExtent],    /* image file format (file magick) */
461     unique[MaxTextExtent],    /* unique tempory filename - delegates */
462     zero[MaxTextExtent],      /* unique filename ? - delegates */
463     filename[MaxTextExtent];  /* filename when reading/writing image */
464
465   MagickBooleanType
466     debug;
467
468   size_t
469     signature;
470 };
471
472 extern MagickExport const char
473   DefaultTileGeometry[],
474   DefaultTileLabel[],
475   LoadImageTag[],
476   LoadImagesTag[],
477   PSDensityGeometry[],
478   PSPageGeometry[],
479   SaveImageTag[],
480   SaveImagesTag[];
481
482 extern MagickExport const double
483   DefaultResolution;
484
485 extern MagickExport ExceptionType
486   CatchImageException(Image *);
487
488 extern MagickExport FILE
489   *GetImageInfoFile(const ImageInfo *);
490
491 extern MagickExport Image
492   *AcquireImage(const ImageInfo *,ExceptionInfo *),
493   *AppendImages(const Image *,const MagickBooleanType,ExceptionInfo *),
494   *CloneImage(const Image *,const size_t,const size_t,const MagickBooleanType,
495     ExceptionInfo *),
496   *CombineImages(const Image *,ExceptionInfo *),
497   *DestroyImage(Image *),
498   *GetImageClipMask(const Image *,ExceptionInfo *),
499   *GetImageMask(const Image *,ExceptionInfo *),
500   *NewMagickImage(const ImageInfo *,const size_t,const size_t,const PixelInfo *,
501     ExceptionInfo *),
502   *ReferenceImage(Image *),
503   *SeparateImages(const Image *,ExceptionInfo *),
504   *SmushImages(const Image *,const MagickBooleanType,const ssize_t,
505     ExceptionInfo *);
506
507 extern MagickExport ImageInfo
508   *AcquireImageInfo(void),
509   *CloneImageInfo(const ImageInfo *),
510   *DestroyImageInfo(ImageInfo *);
511
512 extern MagickExport MagickBooleanType
513   ClipImage(Image *,ExceptionInfo *),
514   ClipImagePath(Image *,const char *,const MagickBooleanType,ExceptionInfo *),
515   GetImageAlphaChannel(const Image *),
516   IsTaintImage(const Image *),
517   IsHighDynamicRangeImage(const Image *,ExceptionInfo *),
518   IsImageObject(const Image *),
519   ListMagickInfo(FILE *,ExceptionInfo *),
520   ModifyImage(Image **,ExceptionInfo *),
521   ResetImagePage(Image *,const char *),
522   SeparateImage(Image *,ExceptionInfo *),
523   SetImageAlpha(Image *,const Quantum,ExceptionInfo *),
524   SetImageAlphaChannel(Image *,const AlphaChannelType,ExceptionInfo *),
525   SetImageBackgroundColor(Image *,ExceptionInfo *),
526   SetImageClipMask(Image *,const Image *,ExceptionInfo *),
527   SetImageColor(Image *,const PixelInfo *,ExceptionInfo *),
528   SetImageExtent(Image *,const size_t,const size_t,ExceptionInfo *),
529   SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *),
530   SetImageMask(Image *,const Image *,ExceptionInfo *),
531   SetImageStorageClass(Image *,const ClassType,ExceptionInfo *),
532   SetImageType(Image *,const ImageType,ExceptionInfo *),
533   StripImage(Image *,ExceptionInfo *),
534   SyncImage(Image *,ExceptionInfo *),
535   SyncImageSettings(const ImageInfo *,Image *,ExceptionInfo *),
536   SyncImagesSettings(ImageInfo *,Image *,ExceptionInfo *);
537
538 extern MagickExport size_t
539   InterpretImageFilename(const ImageInfo *,Image *,const char *,int,char *,
540     ExceptionInfo *);
541
542 extern MagickExport ssize_t
543   GetImageReferenceCount(Image *);
544
545 extern MagickExport VirtualPixelMethod
546   GetImageVirtualPixelMethod(const Image *),
547   SetImageVirtualPixelMethod(const Image *,const VirtualPixelMethod);
548
549 extern MagickExport void
550   AcquireNextImage(const ImageInfo *,Image *,ExceptionInfo *),
551   DestroyImagePixels(Image *),
552   DisassociateImageStream(Image *),
553   GetImageInfo(ImageInfo *),
554   SetImageInfoBlob(ImageInfo *,const void *,const size_t),
555   SetImageInfoFile(ImageInfo *,FILE *);
556
557 #if defined(__cplusplus) || defined(c_plusplus)
558 }
559 #endif
560
561 #endif