]> 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   PointInfo
205     resolution;     /* image resolution/density */
206
207   RectangleInfo
208     page,           /* virtual canvas size and offset of image */
209     extract_info;
210
211   double
212     bias,           /* FUTURE: depreciated -- convolve bias */
213     blur,           /* FUTURE: depreciated -- resize file blur */
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   struct _Image
235     *clip_mask;
236
237   size_t
238     scene,          /* index of image in multi-image file */
239     delay;          /* Animation delay time */
240
241   ssize_t
242     ticks_per_second;  /* units for delay time, default 100 for GIF */
243
244   size_t
245     iterations,
246     total_colors;
247
248   ssize_t
249     start_loop;
250
251   PixelInterpolateMethod
252     interpolate;       /* Interpolation of color for between pixel lookups */
253
254   MagickBooleanType
255     black_point_compensation;
256
257   PixelInfo
258     transparent_color; /* color for 'transparent' color index in GIF */
259
260   struct _Image
261     *mask;
262
263   RectangleInfo
264     tile_offset;
265
266   void
267     *properties,       /* per image properities */
268     *artifacts;        /* per image sequence image artifacts */
269
270   ImageType
271     type;
272
273   MagickBooleanType
274     dither;            /* dithering on/off */
275
276   MagickSizeType
277     extent;            /* Size of image read from disk */
278
279   MagickBooleanType
280     ping;
281
282   size_t
283     number_channels,
284     number_meta_channels,
285     metacontent_extent;
286
287   ChannelType
288     channel_mask;
289
290   PixelChannelMap
291     *channel_map;
292
293   void
294     *cache;
295
296   ErrorInfo
297     error;
298
299   TimerInfo
300     timer;
301
302   MagickProgressMonitor
303     progress_monitor;
304
305   void
306     *client_data;
307
308   Ascii85Info
309     *ascii85;
310
311   ProfileInfo
312     *generic_profile;
313
314   char
315     filename[MaxTextExtent],        /* images input filename */
316     magick_filename[MaxTextExtent], /* given image filename (with read mods) */
317     magick[MaxTextExtent];          /* images file format (file magic) */
318
319   size_t
320     magick_columns,
321     magick_rows;
322
323   BlobInfo
324     *blob;             /* image file as in-memory string of 'extent' */
325
326   MagickBooleanType
327     debug;             /* debug output attribute */
328
329   volatile ssize_t
330     reference_count;   /* image data sharing memory management */
331
332   SemaphoreInfo
333     *semaphore;
334
335   struct _Image
336     *previous,         /* Image sequence list links */
337     *list,
338     *next;
339
340   size_t
341     signature;
342 };
343
344 struct _ImageInfo
345 {
346   CompressionType
347     compression;
348
349   OrientationType
350     orientation;
351
352   MagickBooleanType
353     temporary,
354     adjoin,
355     affirm,
356     antialias;
357
358   char
359     *size,
360     *extract,
361     *page,
362     *scenes;
363
364   size_t
365     scene,
366     number_scenes,
367     depth;
368
369   InterlaceType
370     interlace;          /* interlace for image write */
371
372   EndianType
373     endian;             /* integer endian order for raw image data */
374
375   ResolutionType
376     units;              /* denisty pixels/inch or pixel/cm */
377
378   size_t
379     quality;            /* compression quality */
380
381   char
382     *sampling_factor,   /* JPEG write sampling factor */
383     *server_name,       /* X windows server name - display/animate */
384     *font,              /* draw_info */
385     *texture,           /* montage/display background tile */
386     *density;           /* for image and draw_info */
387
388   double
389     pointsize,
390     fuzz;               /* current color fuzz attribute */
391
392   PixelInfo
393     background_color,
394     border_color,
395     matte_color;
396
397   MagickBooleanType
398     dither,            /* dither enable-disable */
399     monochrome;        /* read/write pcl,pdf,ps,xps as monocrome image */
400
401   ColorspaceType
402     colorspace;
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     /* authenticate -- moved to ImageOptions() */
420
421   ChannelType
422     channel;
423
424   void
425     *options;                /* splay tree of use options */
426
427   VirtualPixelMethod
428     virtual_pixel_method;
429
430   PixelInfo
431     transparent_color;
432
433   void
434     *profile;
435
436   MagickBooleanType
437     synchronize;
438
439   MagickProgressMonitor
440     progress_monitor;
441
442   void
443     *client_data,
444     *cache;
445
446   StreamHandler
447     stream;
448
449   FILE
450     *file;
451
452   void
453     *blob;
454
455   size_t
456     length;
457
458   char
459     magick[MaxTextExtent],    /* image file format (file magick) */
460     unique[MaxTextExtent],    /* unique tempory filename - delegates */
461     zero[MaxTextExtent],      /* unique filename ? - delegates */
462     filename[MaxTextExtent];  /* filename when reading/writing image */
463
464   MagickBooleanType
465     debug;
466
467   size_t
468     signature;
469 };
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   *CombineImages(const Image *,ExceptionInfo *),
496   *DestroyImage(Image *),
497   *GetImageClipMask(const Image *,ExceptionInfo *),
498   *GetImageMask(const Image *,ExceptionInfo *),
499   *NewMagickImage(const ImageInfo *,const size_t,const size_t,const PixelInfo *,
500     ExceptionInfo *),
501   *ReferenceImage(Image *),
502   *SeparateImages(const Image *,ExceptionInfo *),
503   *SmushImages(const Image *,const MagickBooleanType,const ssize_t,
504     ExceptionInfo *);
505
506 extern MagickExport ImageInfo
507   *AcquireImageInfo(void),
508   *CloneImageInfo(const ImageInfo *),
509   *DestroyImageInfo(ImageInfo *);
510
511 extern MagickExport MagickBooleanType
512   ClipImage(Image *,ExceptionInfo *),
513   ClipImagePath(Image *,const char *,const MagickBooleanType,ExceptionInfo *),
514   GetImageAlphaChannel(const Image *),
515   IsTaintImage(const Image *),
516   IsHighDynamicRangeImage(const Image *,ExceptionInfo *),
517   IsImageObject(const Image *),
518   ListMagickInfo(FILE *,ExceptionInfo *),
519   ModifyImage(Image **,ExceptionInfo *),
520   ResetImagePage(Image *,const char *),
521   SeparateImage(Image *,ExceptionInfo *),
522   SetImageAlpha(Image *,const Quantum,ExceptionInfo *),
523   SetImageAlphaChannel(Image *,const AlphaChannelType,ExceptionInfo *),
524   SetImageBackgroundColor(Image *,ExceptionInfo *),
525   SetImageClipMask(Image *,const Image *,ExceptionInfo *),
526   SetImageColor(Image *,const PixelInfo *,ExceptionInfo *),
527   SetImageExtent(Image *,const size_t,const size_t,ExceptionInfo *),
528   SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *),
529   SetImageMask(Image *,const Image *,ExceptionInfo *),
530   SetImageStorageClass(Image *,const ClassType,ExceptionInfo *),
531   SetImageType(Image *,const ImageType,ExceptionInfo *),
532   StripImage(Image *,ExceptionInfo *),
533   SyncImage(Image *,ExceptionInfo *),
534   SyncImageSettings(const ImageInfo *,Image *,ExceptionInfo *),
535   SyncImagesSettings(ImageInfo *,Image *,ExceptionInfo *);
536
537 extern MagickExport size_t
538   InterpretImageFilename(const ImageInfo *,Image *,const char *,int,char *,
539     ExceptionInfo *);
540
541 extern MagickExport ssize_t
542   GetImageReferenceCount(Image *);
543
544 extern MagickExport VirtualPixelMethod
545   GetImageVirtualPixelMethod(const Image *),
546   SetImageVirtualPixelMethod(const Image *,const VirtualPixelMethod);
547
548 extern MagickExport void
549   AcquireNextImage(const ImageInfo *,Image *,ExceptionInfo *),
550   DestroyImagePixels(Image *),
551   DisassociateImageStream(Image *),
552   GetImageInfo(ImageInfo *),
553   SetImageInfoBlob(ImageInfo *,const void *,const size_t),
554   SetImageInfoFile(ImageInfo *,FILE *);
555
556 #if defined(__cplusplus) || defined(c_plusplus)
557 }
558 #endif
559
560 #endif