]> 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 #include <MagickCore/pixel.h>
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 - 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   PixelTrait
277     alpha_trait;       /* is transparency channel defined and active */
278
279   size_t
280     number_channels,
281     number_meta_channels,
282     metacontent_extent;
283
284   ChannelType
285     channel_mask;
286
287   PixelChannelMap
288     *channel_map;
289
290   void
291     *cache;
292
293   ErrorInfo
294     error;
295
296   TimerInfo
297     timer;
298
299   MagickProgressMonitor
300     progress_monitor;
301
302   void
303     *client_data;
304
305   Ascii85Info
306     *ascii85;
307
308   ProfileInfo
309     *generic_profile;
310
311   char
312     filename[MaxTextExtent],        /* images input filename */
313     magick_filename[MaxTextExtent], /* given image filename (with read mods) */
314     magick[MaxTextExtent];          /* images file format (file magic) */
315
316   size_t
317     magick_columns,     /* size of image when read/created */
318     magick_rows;
319
320   BlobInfo
321     *blob;             /* image file as in-memory string of 'extent' */
322
323   MagickBooleanType
324     debug;             /* debug output attribute */
325
326   volatile ssize_t
327     reference_count;   /* image data sharing memory management */
328
329   SemaphoreInfo
330     *semaphore;
331
332
333   struct _Image
334     *list,             /* Undo/Redo image processing list (for display) */
335     *previous,         /* Image list links */
336     *next;
337
338   size_t
339     signature;
340 };
341
342 struct _ImageInfo
343 {
344   CompressionType
345     compression;        /* compression method when reading/saving image */
346
347   OrientationType
348     orientation;        /* orientation setting */
349
350   MagickBooleanType
351     temporary,          /* image file to be deleted after read "empemeral:" */
352     adjoin,             /* save images to seperate scene files */
353     affirm,
354     antialias;
355
356   char
357     *size,              /* image generation size */
358     *extract,           /* crop/resize string on image read */
359     *page,
360     *scenes;            /* scene numbers that is to be read in */
361
362   size_t
363     scene,              /* starting value for image save numbering */
364     number_scenes,      /* total number of images in list - for escapes */
365     depth;              /* current read/save depth of images */
366
367   InterlaceType
368     interlace;          /* interlace for image write */
369
370   EndianType
371     endian;             /* integer endian order for raw image data */
372
373   ResolutionType
374     units;              /* denisty pixels/inch or pixel/cm */
375
376   size_t
377     quality;            /* compression quality */
378
379   char
380     *sampling_factor,   /* JPEG write sampling factor */
381     *server_name,       /* X windows server name - display/animate */
382     *font,              /* DUP for draw_info */
383     *texture,           /* montage/display background tile */
384     *density;           /* DUP for image and draw_info */
385
386   double
387     pointsize,
388     fuzz;               /* current color fuzz attribute */
389
390   PixelInfo
391     background_color,   /* user set background color */
392     border_color,       /* user set border color */
393     matte_color,        /* matte (frame) color */
394     transparent_color;  /* color for transparent index in color tables */
395                         /* NB: fill color is only needed in draw_info! */
396                         /* the same for undercolor (for font drawing) */
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   CompositeOperator
406     compose;
407
408   ImageType
409     type;
410
411   PreviewType
412     preview_type;
413
414   ssize_t
415     group;
416
417   MagickBooleanType
418     ping,                    /* fast read image attributes, not image data */
419     verbose;                 /* verbose output enable/disable */
420
421   char
422     *view;
423
424   ChannelType
425     channel;
426
427   void
428     *options;                /* splay tree of use options */
429
430   void
431     *profile;
432
433   MagickBooleanType
434     synchronize;
435
436   MagickProgressMonitor
437     progress_monitor;
438
439   void
440     *client_data,
441     *cache;
442
443   StreamHandler
444     stream;
445
446   FILE
447     *file;
448
449   void
450     *blob;
451
452   size_t
453     length;
454
455   char
456     magick[MaxTextExtent],    /* image file format (file magick) */
457     unique[MaxTextExtent],    /* unique tempory filename - delegates */
458     zero[MaxTextExtent],      /* unique filename ? - delegates */
459     filename[MaxTextExtent];  /* filename when reading/writing image */
460
461   MagickBooleanType
462     debug;
463
464   size_t
465     signature;
466 };
467
468 extern MagickExport ChannelType
469   SetImageChannelMask(Image *,const ChannelType);
470
471 extern MagickExport const char
472   DefaultTileGeometry[],
473   DefaultTileLabel[],
474   LoadImageTag[],
475   LoadImagesTag[],
476   PSDensityGeometry[],
477   PSPageGeometry[],
478   SaveImageTag[],
479   SaveImagesTag[];
480
481 extern MagickExport const double
482   DefaultResolution;
483
484 extern MagickExport ExceptionType
485   CatchImageException(Image *);
486
487 extern MagickExport FILE
488   *GetImageInfoFile(const ImageInfo *);
489
490 extern MagickExport Image
491   *AcquireImage(const ImageInfo *,ExceptionInfo *),
492   *AppendImages(const Image *,const MagickBooleanType,ExceptionInfo *),
493   *CloneImage(const Image *,const size_t,const size_t,const MagickBooleanType,
494     ExceptionInfo *),
495   *DestroyImage(Image *),
496   *GetImageClipMask(const Image *,ExceptionInfo *),
497   *GetImageMask(const Image *,ExceptionInfo *),
498   *NewMagickImage(const ImageInfo *,const size_t,const size_t,const PixelInfo *,
499     ExceptionInfo *),
500   *ReferenceImage(Image *),
501   *SmushImages(const Image *,const MagickBooleanType,const ssize_t,
502     ExceptionInfo *);
503
504 extern MagickExport ImageInfo
505   *AcquireImageInfo(void),
506   *CloneImageInfo(const ImageInfo *),
507   *DestroyImageInfo(ImageInfo *);
508
509 extern MagickExport MagickBooleanType
510   ClipImage(Image *,ExceptionInfo *),
511   ClipImagePath(Image *,const char *,const MagickBooleanType,ExceptionInfo *),
512   GetImageAlphaChannel(const Image *),
513   IsTaintImage(const Image *),
514   IsHighDynamicRangeImage(const Image *,ExceptionInfo *),
515   IsImageObject(const Image *),
516   ListMagickInfo(FILE *,ExceptionInfo *),
517   ModifyImage(Image **,ExceptionInfo *),
518   ResetImagePage(Image *,const char *),
519   SetImageAlpha(Image *,const Quantum,ExceptionInfo *),
520   SetImageAlphaChannel(Image *,const AlphaChannelOption,ExceptionInfo *),
521   SetImageBackgroundColor(Image *,ExceptionInfo *),
522   SetImageColor(Image *,const PixelInfo *,ExceptionInfo *),
523   SetImageExtent(Image *,const size_t,const size_t,ExceptionInfo *),
524   SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *),
525   SetImageMask(Image *,const Image *,ExceptionInfo *),
526   SetImageStorageClass(Image *,const ClassType,ExceptionInfo *),
527   StripImage(Image *,ExceptionInfo *),
528   SyncImage(Image *,ExceptionInfo *),
529   SyncImageSettings(const ImageInfo *,Image *,ExceptionInfo *),
530   SyncImagesSettings(ImageInfo *,Image *,ExceptionInfo *);
531
532 extern MagickExport size_t
533   InterpretImageFilename(const ImageInfo *,Image *,const char *,int,char *,
534     ExceptionInfo *);
535
536 extern MagickExport ssize_t
537   GetImageReferenceCount(Image *);
538
539 extern MagickExport VirtualPixelMethod
540   GetImageVirtualPixelMethod(const Image *),
541   SetImageVirtualPixelMethod(Image *,const VirtualPixelMethod,ExceptionInfo *);
542
543 extern MagickExport void
544   AcquireNextImage(const ImageInfo *,Image *,ExceptionInfo *),
545   DestroyImagePixels(Image *),
546   DisassociateImageStream(Image *),
547   GetImageInfo(ImageInfo *),
548   SetImageInfoBlob(ImageInfo *,const void *,const size_t),
549   SetImageInfoFile(ImageInfo *,FILE *);
550
551 #if defined(__cplusplus) || defined(c_plusplus)
552 }
553 #endif
554
555 #endif