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