]> 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  (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
330   struct _Image
331     *list,             /* Undo/Redo image processing list (for display) */
332     *previous,         /* Image list links */
333     *next;
334
335   size_t
336     signature;
337 };
338
339 struct _ImageInfo
340 {
341   CompressionType
342     compression;        /* compression method when reading/saving image */
343
344   OrientationType
345     orientation;        /* orientation setting */
346
347   MagickBooleanType
348     temporary,          /* image file to be deleted after read "empemeral:" */
349     adjoin,             /* save images to seperate scene files */
350     affirm,
351     antialias;
352
353   char
354     *size,              /* image generation size */
355     *extract,           /* crop/resize string on image read */
356     *page,
357     *scenes;            /* scene numbers that is to be read in */
358
359   size_t
360     scene,              /* starting value for image save numbering */
361     number_scenes,      /* total number of images in list - for escapes */
362     depth;              /* current read/save depth of images */
363
364   InterlaceType
365     interlace;          /* interlace for image write */
366
367   EndianType
368     endian;             /* integer endian order for raw image data */
369
370   ResolutionType
371     units;              /* denisty pixels/inch or pixel/cm */
372
373   size_t
374     quality;            /* compression quality */
375
376   char
377     *sampling_factor,   /* JPEG write sampling factor */
378     *server_name,       /* X windows server name - display/animate */
379     *font,              /* DUP for draw_info */
380     *texture,           /* montage/display background tile */
381     *density;           /* DUP for image and draw_info */
382
383   double
384     pointsize,
385     fuzz;               /* current color fuzz attribute */
386
387   PixelInfo
388     background_color,   /* user set background color */
389     border_color,       /* user set border color */
390     matte_color,        /* matte (frame) color */
391     transparent_color;  /* color for transparent index in color tables */
392                         /* NB: fill color is only needed in draw_info! */
393                         /* the same for undercolor (for font drawing) */
394
395   MagickBooleanType
396     dither,             /* dither enable-disable */
397     monochrome;         /* read/write pcl,pdf,ps,xps as monocrome image */
398
399   ColorspaceType
400     colorspace;
401
402   CompositeOperator
403     compose;
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
421   ChannelType
422     channel;
423
424   void
425     *options;                /* splay tree of use options */
426
427   void
428     *profile;
429
430   MagickBooleanType
431     synchronize;
432
433   MagickProgressMonitor
434     progress_monitor;
435
436   void
437     *client_data,
438     *cache;
439
440   StreamHandler
441     stream;
442
443   FILE
444     *file;
445
446   void
447     *blob;
448
449   size_t
450     length;
451
452   char
453     magick[MaxTextExtent],    /* image file format (file magick) */
454     unique[MaxTextExtent],    /* unique tempory filename - delegates */
455     zero[MaxTextExtent],      /* unique filename ? - delegates */
456     filename[MaxTextExtent];  /* filename when reading/writing image */
457
458   MagickBooleanType
459     debug;
460
461   size_t
462     signature;
463 };
464
465 extern MagickExport const char
466   DefaultTileGeometry[],
467   DefaultTileLabel[],
468   LoadImageTag[],
469   LoadImagesTag[],
470   PSDensityGeometry[],
471   PSPageGeometry[],
472   SaveImageTag[],
473   SaveImagesTag[];
474
475 extern MagickExport const double
476   DefaultResolution;
477
478 extern MagickExport ExceptionType
479   CatchImageException(Image *);
480
481 extern MagickExport FILE
482   *GetImageInfoFile(const ImageInfo *);
483
484 extern MagickExport Image
485   *AcquireImage(const ImageInfo *,ExceptionInfo *),
486   *AppendImages(const Image *,const MagickBooleanType,ExceptionInfo *),
487   *CloneImage(const Image *,const size_t,const size_t,const MagickBooleanType,
488     ExceptionInfo *),
489   *DestroyImage(Image *),
490   *GetImageClipMask(const Image *,ExceptionInfo *),
491   *GetImageMask(const Image *,ExceptionInfo *),
492   *NewMagickImage(const ImageInfo *,const size_t,const size_t,const PixelInfo *,
493     ExceptionInfo *),
494   *ReferenceImage(Image *),
495   *SmushImages(const Image *,const MagickBooleanType,const ssize_t,
496     ExceptionInfo *);
497
498 extern MagickExport ImageInfo
499   *AcquireImageInfo(void),
500   *CloneImageInfo(const ImageInfo *),
501   *DestroyImageInfo(ImageInfo *);
502
503 extern MagickExport MagickBooleanType
504   ClipImage(Image *,ExceptionInfo *),
505   ClipImagePath(Image *,const char *,const MagickBooleanType,ExceptionInfo *),
506   GetImageAlphaChannel(const Image *),
507   IsTaintImage(const Image *),
508   IsHighDynamicRangeImage(const Image *,ExceptionInfo *),
509   IsImageObject(const Image *),
510   ListMagickInfo(FILE *,ExceptionInfo *),
511   ModifyImage(Image **,ExceptionInfo *),
512   ResetImagePage(Image *,const char *),
513   SetImageAlpha(Image *,const Quantum,ExceptionInfo *),
514   SetImageAlphaChannel(Image *,const AlphaChannelType,ExceptionInfo *),
515   SetImageBackgroundColor(Image *,ExceptionInfo *),
516   SetImageColor(Image *,const PixelInfo *,ExceptionInfo *),
517   SetImageExtent(Image *,const size_t,const size_t,ExceptionInfo *),
518   SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *),
519   SetImageMask(Image *,const Image *,ExceptionInfo *),
520   SetImageStorageClass(Image *,const ClassType,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