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