image.h revision 018f07f7333b25743d0afff892450cebdb905c1a
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)
22extern "C" {
23#endif
24
25#include <MagickCore/color.h>
26
27#define OpaqueAlpha  ((Quantum) QuantumRange)
28#define TransparentAlpha  ((Quantum) 0UL)
29
30typedef 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
44typedef 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
60typedef enum
61{
62  UndefinedInterlace,
63  NoInterlace,
64  LineInterlace,
65  PlaneInterlace,
66  PartitionInterlace,
67  GIFInterlace,
68  JPEGInterlace,
69  PNGInterlace
70} InterlaceType;
71
72typedef enum
73{
74  UndefinedOrientation,
75  TopLeftOrientation,
76  TopRightOrientation,
77  BottomRightOrientation,
78  BottomLeftOrientation,
79  LeftTopOrientation,
80  RightTopOrientation,
81  RightBottomOrientation,
82  LeftBottomOrientation
83} OrientationType;
84
85typedef enum
86{
87  UndefinedResolution,
88  PixelsPerInchResolution,
89  PixelsPerCentimeterResolution
90} ResolutionType;
91
92typedef struct _PrimaryInfo
93{
94  double
95    x,
96    y,
97    z;
98} PrimaryInfo;
99
100typedef struct _SegmentInfo
101{
102  double
103    x1,
104    y1,
105    x2,
106    y2;
107} SegmentInfo;
108
109typedef enum
110{
111  UndefinedTransmitType,
112  FileTransmitType,
113  BlobTransmitType,
114  StreamTransmitType,
115  ImageTransmitType
116} TransmitType;
117
118typedef 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
147struct _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 on read */
173
174  PixelPacket
175    *colormap,
176    background_color, /* current background color attribute */
177    border_color,     /* current bordercolor attribute */
178    matte_color;      /* current mattecolor attribute */
179
180  double
181    gamma;
182
183  ChromaticityInfo
184    chromaticity;
185
186  RenderingIntent
187    rendering_intent;
188
189  void
190    *profiles;
191
192  ResolutionType
193    units;          /* resolution/density  ppi or ppc */
194
195  char
196    *montage,
197    *directory,
198    *geometry;
199
200  ssize_t
201    offset;
202
203  double
204    x_resolution,   /* image resolution/density */
205    y_resolution;
206
207  RectangleInfo
208    page,           /* virtual canvas size and offset of image */
209    extract_info;
210
211  double
212    bias,
213    blur,
214    fuzz;           /* current color fuzz attribute */
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  InterpolatePixelMethod
252    interpolate;       /* Interpolation of color for between pixel lookups */
253
254  MagickBooleanType
255    black_point_compensation;
256
257  PixelPacket
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 method during color reduction */
275
276  MagickSizeType
277    extent;
278
279  MagickBooleanType
280    ping;
281
282  size_t
283    number_channels,
284    number_meta_channels,
285    metacontent_extent;
286
287  MagickBooleanType
288    sync;
289
290  ChannelType
291    channel_mask;
292
293  PixelChannelMap
294    *channel_map;
295
296  void
297    *cache;
298
299  ErrorInfo
300    error;
301
302  TimerInfo
303    timer;
304
305  MagickProgressMonitor
306    progress_monitor;
307
308  void
309    *client_data;
310
311  Ascii85Info
312    *ascii85;
313
314  ProfileInfo
315    color_profile,
316    iptc_profile,
317    *generic_profile;
318
319  char
320    filename[MaxTextExtent],   /* images input filename */
321    magick_filename[MaxTextExtent],
322    magick[MaxTextExtent];
323
324  size_t
325    magick_columns,
326    magick_rows;
327
328  BlobInfo
329    *blob;
330
331  ExceptionInfo
332    exception;        /* Error handling report */
333
334  MagickBooleanType
335    debug;            /* debug output attribute */
336
337  volatile ssize_t
338    reference_count;
339
340  SemaphoreInfo
341    *semaphore;
342
343  struct _Image
344    *previous,         /* Image sequence list links */
345    *list,
346    *next;
347
348  size_t
349    signature;
350};
351
352struct _ImageInfo
353{
354  CompressionType
355    compression;
356
357  OrientationType
358    orientation;
359
360  MagickBooleanType
361    temporary,
362    adjoin,
363    affirm,
364    antialias;
365
366  char
367    *size,
368    *extract,
369    *page,
370    *scenes;
371
372  size_t
373    scene,
374    number_scenes,
375    depth;
376
377  InterlaceType
378    interlace;
379
380  EndianType
381    endian;
382
383  ResolutionType
384    units;
385
386  size_t
387    quality;
388
389  char
390    *sampling_factor,
391    *server_name,
392    *font,
393    *texture,
394    *density;
395
396  double
397    pointsize,
398    fuzz;
399
400  PixelPacket
401    background_color,
402    border_color,
403    matte_color;
404
405  MagickBooleanType
406    dither,
407    monochrome;
408
409  size_t
410    colors;
411
412  ColorspaceType
413    colorspace;
414
415  ImageType
416    type;
417
418  PreviewType
419    preview_type;
420
421  ssize_t
422    group;
423
424  MagickBooleanType
425    ping,
426    verbose;
427
428  char
429    *view,
430    *authenticate;
431
432  ChannelType
433    channel;
434
435  void
436    *options;
437
438  VirtualPixelMethod
439    virtual_pixel_method;
440
441  PixelPacket
442    transparent_color;
443
444  void
445    *profile;
446
447  MagickBooleanType
448    synchronize;
449
450  MagickProgressMonitor
451    progress_monitor;
452
453  void
454    *client_data,
455    *cache;
456
457  StreamHandler
458    stream;
459
460  FILE
461    *file;
462
463  void
464    *blob;
465
466  size_t
467    length;
468
469  char
470    magick[MaxTextExtent],
471    unique[MaxTextExtent],
472    zero[MaxTextExtent],
473    filename[MaxTextExtent];
474
475  MagickBooleanType
476    debug;
477
478  size_t
479    signature;
480};
481
482extern MagickExport const char
483  DefaultTileFrame[],
484  DefaultTileGeometry[],
485  DefaultTileLabel[],
486  LoadImageTag[],
487  LoadImagesTag[],
488  PSDensityGeometry[],
489  PSPageGeometry[],
490  SaveImageTag[],
491  SaveImagesTag[];
492
493extern MagickExport const double
494  DefaultResolution;
495
496extern MagickExport ExceptionType
497  CatchImageException(Image *);
498
499extern MagickExport FILE
500  *GetImageInfoFile(const ImageInfo *);
501
502extern MagickExport Image
503  *AcquireImage(const ImageInfo *),
504  *AppendImages(const Image *,const MagickBooleanType,ExceptionInfo *),
505  *CloneImage(const Image *,const size_t,const size_t,const MagickBooleanType,
506    ExceptionInfo *),
507  *CombineImages(const Image *,ExceptionInfo *),
508  *DestroyImage(Image *),
509  *GetImageClipMask(const Image *,ExceptionInfo *),
510  *GetImageMask(const Image *,ExceptionInfo *),
511  *NewMagickImage(const ImageInfo *,const size_t,const size_t,
512    const PixelInfo *),
513  *ReferenceImage(Image *),
514  *SeparateImages(const Image *,ExceptionInfo *),
515  *SmushImages(const Image *,const MagickBooleanType,const ssize_t,
516    ExceptionInfo *);
517
518extern MagickExport ImageInfo
519  *AcquireImageInfo(void),
520  *CloneImageInfo(const ImageInfo *),
521  *DestroyImageInfo(ImageInfo *);
522
523extern MagickExport MagickBooleanType
524  ClipImage(Image *,ExceptionInfo *),
525  ClipImagePath(Image *,const char *,const MagickBooleanType,ExceptionInfo *),
526  GetImageAlphaChannel(const Image *),
527  IsTaintImage(const Image *),
528  IsMagickConflict(const char *),
529  IsHighDynamicRangeImage(const Image *,ExceptionInfo *),
530  IsImageObject(const Image *),
531  ListMagickInfo(FILE *,ExceptionInfo *),
532  ModifyImage(Image **,ExceptionInfo *),
533  ResetImagePage(Image *,const char *),
534  SeparateImage(Image *),
535  SetImageAlphaChannel(Image *,const AlphaChannelType,ExceptionInfo *),
536  SetImageBackgroundColor(Image *),
537  SetImageClipMask(Image *,const Image *,ExceptionInfo *),
538  SetImageColor(Image *,const PixelInfo *),
539  SetImageExtent(Image *,const size_t,const size_t,ExceptionInfo *),
540  SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *),
541  SetImageMask(Image *,const Image *,ExceptionInfo *),
542  SetImageOpacity(Image *,const Quantum),
543  SetImageStorageClass(Image *,const ClassType,ExceptionInfo *),
544  SetImageType(Image *,const ImageType,ExceptionInfo *),
545  StripImage(Image *),
546  SyncImage(Image *),
547  SyncImageSettings(const ImageInfo *,Image *),
548  SyncImagesSettings(ImageInfo *,Image *);
549
550extern MagickExport size_t
551  InterpretImageFilename(const ImageInfo *,Image *,const char *,int,char *);
552
553extern MagickExport ssize_t
554  GetImageReferenceCount(Image *);
555
556extern MagickExport VirtualPixelMethod
557  GetImageVirtualPixelMethod(const Image *),
558  SetImageVirtualPixelMethod(const Image *,const VirtualPixelMethod);
559
560extern MagickExport void
561  AcquireNextImage(const ImageInfo *,Image *),
562  DestroyImagePixels(Image *),
563  DisassociateImageStream(Image *),
564  GetImageException(Image *,ExceptionInfo *),
565  GetImageInfo(ImageInfo *),
566  SetImageInfoBlob(ImageInfo *,const void *,const size_t),
567  SetImageInfoFile(ImageInfo *,FILE *);
568
569#if defined(__cplusplus) || defined(c_plusplus)
570}
571#endif
572
573#endif
574