MagickCore  7.1.1-43
Convert, Edit, Or Compose Bitmap Images
image.h
1 /*
2  Copyright @ 1999 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. You may
6  obtain a copy of the License at
7 
8  https://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 #define OpaqueAlpha ((Quantum) QuantumRange)
26 #define TransparentAlpha ((Quantum) 0)
27 
28 typedef enum
29 {
30  UndefinedType,
31  BilevelType,
32  GrayscaleType,
33  GrayscaleAlphaType,
34  PaletteType,
35  PaletteAlphaType,
36  TrueColorType,
37  TrueColorAlphaType,
38  ColorSeparationType,
39  ColorSeparationAlphaType,
40  OptimizeType,
41  PaletteBilevelAlphaType
42 } ImageType;
43 
44 typedef enum
45 {
46  UndefinedInterlace,
47  NoInterlace,
48  LineInterlace,
49  PlaneInterlace,
50  PartitionInterlace,
51  GIFInterlace,
52  JPEGInterlace,
53  PNGInterlace
54 } InterlaceType;
55 
56 typedef enum
57 {
58  UndefinedOrientation,
59  TopLeftOrientation,
60  TopRightOrientation,
61  BottomRightOrientation,
62  BottomLeftOrientation,
63  LeftTopOrientation,
64  RightTopOrientation,
65  RightBottomOrientation,
66  LeftBottomOrientation
67 } OrientationType;
68 
69 typedef enum
70 {
71  UndefinedResolution,
72  PixelsPerInchResolution,
73  PixelsPerCentimeterResolution
74 } ResolutionType;
75 
76 typedef struct _PrimaryInfo
77 {
78  double
79  x,
80  y,
81  z;
82 } PrimaryInfo;
83 
84 typedef struct _SegmentInfo
85 {
86  double
87  x1,
88  y1,
89  x2,
90  y2;
91 } SegmentInfo;
92 
93 typedef enum
94 {
95  UndefinedTransmitType,
96  FileTransmitType,
97  BlobTransmitType,
98  StreamTransmitType,
99  ImageTransmitType
100 } TransmitType;
101 
102 typedef struct _ChromaticityInfo
103 {
105  red_primary,
106  green_primary,
107  blue_primary,
108  white_point;
110 
111 #include "MagickCore/blob.h"
112 #include "MagickCore/colorspace.h"
113 #include "MagickCore/cache-view.h"
114 #include "MagickCore/color.h"
115 #include "MagickCore/composite.h"
116 #include "MagickCore/compress.h"
117 #include "MagickCore/effect.h"
118 #include "MagickCore/geometry.h"
119 #include "MagickCore/layer.h"
120 #include "MagickCore/locale_.h"
121 #include "MagickCore/monitor.h"
122 #include "MagickCore/pixel.h"
123 #include "MagickCore/profile.h"
124 #include "MagickCore/quantum.h"
125 #include "MagickCore/resample.h"
126 #include "MagickCore/resize.h"
127 #include "MagickCore/semaphore.h"
128 #include "MagickCore/stream.h"
129 #include "MagickCore/timer.h"
130 
131 struct _Image
132 {
133  ClassType
134  storage_class;
135 
136  ColorspaceType
137  colorspace; /* colorspace of image data */
138 
139  CompressionType
140  compression; /* compression of image when read/write */
141 
142  size_t
143  quality; /* compression quality setting, meaning varies */
144 
145  OrientationType
146  orientation; /* photo orientation of image */
147 
148  MagickBooleanType
149  taint; /* has image been modified since reading */
150 
151  size_t
152  columns, /* physical size of image */
153  rows,
154  depth, /* depth of image on read/write */
155  colors; /* Size of color table, or actual color count */
156  /* Only valid if image is not DirectClass */
157 
158  PixelInfo
159  *colormap,
160  alpha_color, /* deprecated */
161  background_color, /* current background color attribute */
162  border_color, /* current bordercolor attribute */
163  transparent_color; /* color for 'transparent' color index in GIF */
164 
165  double
166  gamma;
167 
169  chromaticity;
170 
171  RenderingIntent
172  rendering_intent;
173 
174  void
175  *profiles;
176 
177  ResolutionType
178  units; /* resolution/density ppi or ppc */
179 
180  char
181  *montage,
182  *directory,
183  *geometry;
184 
185  ssize_t
186  offset; /* ??? */
187 
188  PointInfo
189  resolution; /* image resolution/density */
190 
192  page, /* virtual canvas size and offset of image */
193  extract_info;
194 
195  double
196  fuzz; /* current color fuzz attribute - move to image_info */
197 
198  FilterType
199  filter; /* resize/distort filter to apply */
200 
201  PixelIntensityMethod
202  intensity; /* method to generate an intensity value from a pixel */
203 
204  InterlaceType
205  interlace;
206 
207  EndianType
208  endian; /* raw data integer ordering on read/write */
209 
210  GravityType
211  gravity; /* Gravity attribute for positioning in image */
212 
213  CompositeOperator
214  compose; /* alpha composition method for layered images */
215 
216  DisposeType
217  dispose; /* GIF animation disposal method */
218 
219  size_t
220  scene, /* index of image in multi-image file */
221  delay, /* Animation delay time */
222  duration; /* Total animation duration sum(delay*iterations) */
223 
224  ssize_t
225  ticks_per_second; /* units for delay time, default 100 for GIF */
226 
227  size_t
228  iterations, /* number of interactions for GIF animations */
229  total_colors;
230 
231  ssize_t
232  start_loop; /* ??? */
233 
234  PixelInterpolateMethod
235  interpolate; /* Interpolation of color for between pixel lookups */
236 
237  MagickBooleanType
238  black_point_compensation;
239 
241  tile_offset;
242 
243  ImageType
244  type;
245 
246  MagickBooleanType
247  dither; /* dithering on/off */
248 
249  MagickSizeType
250  extent; /* Size of image read from disk */
251 
252  MagickBooleanType
253  ping; /* no image data read, just attributes */
254 
255  MagickBooleanType
256  read_mask,
257  write_mask;
258 
259  PixelTrait
260  alpha_trait; /* is transparency channel defined and active */
261 
262  size_t
263  number_channels,
264  number_meta_channels,
265  metacontent_extent;
266 
267  ChannelType
268  channel_mask;
269 
271  *channel_map;
272 
273  void
274  *cache;
275 
276  ErrorInfo
277  error;
278 
279  TimerInfo
280  timer;
281 
282  MagickProgressMonitor
283  progress_monitor;
284 
285  void
286  *client_data;
287 
289  *ascii85;
290 
292  *generic_profile;
293 
294  void
295  *properties, /* general settings, to save with image */
296  *artifacts; /* general operational/coder settings, not saved */
297 
298  char
299  filename[MagickPathExtent], /* images input filename */
300  magick_filename[MagickPathExtent], /* given image filename (with read mods) */
301  magick[MagickPathExtent]; /* images file format (file magic) */
302 
303  size_t
304  magick_columns, /* size of image when read/created */
305  magick_rows;
306 
307  BlobInfo
308  *blob; /* image file as in-memory string of 'extent' */
309 
310  time_t
311  timestamp;
312 
313  MagickBooleanType
314  debug; /* debug output attribute */
315 
316  ssize_t
317  reference_count; /* image data sharing memory management */
318 
320  *semaphore;
321 
322  struct _ImageInfo
323  *image_info; /* (Optional) Image belongs to this ImageInfo 'list'
324  * For access to 'global options' when no per-image
325  * attribute, prosperity, or artifact has been set.
326  */
327 
328  struct _Image
329  *list, /* Undo/Redo image processing list (for display) */
330  *previous, /* Image list links */
331  *next;
332 
333  size_t
334  signature;
335 
336  PixelInfo
337  matte_color; /* current mattecolor attribute */
338 
339  MagickBooleanType
340  composite_mask;
341 
342  PixelTrait
343  mask_trait; /* apply the clip or composite mask */
344 
345  ChannelType
346  channels;
347 
348  time_t
349  ttl;
350 };
351 
352 /*
353  ImageInfo structure:
354  Stores an image list, as well as all global settings used by all images
355  held, -- unless overridden for that specific image. See SyncImagesettings()
356  which maps any global setting that always overrides specific image settings.
357 */
359 {
360  CompressionType
361  compression; /* compression method when reading/saving image */
362 
363  OrientationType
364  orientation; /* orientation setting */
365 
366  MagickBooleanType
367  temporary, /* image file to be deleted after read "ephemeral:" */
368  adjoin, /* save images to separate scene files */
369  affirm,
370  antialias;
371 
372  char
373  *size, /* image generation size */
374  *extract, /* crop/resize string on image read */
375  *page,
376  *scenes; /* scene numbers that is to be read in */
377 
378  size_t
379  scene, /* starting value for image save numbering */
380  number_scenes, /* total number of images in list - for escapes */
381  depth; /* current read/save depth of images */
382 
383  InterlaceType
384  interlace; /* interlace for image write */
385 
386  EndianType
387  endian; /* integer endian order for raw image data */
388 
389  ResolutionType
390  units; /* density pixels/inch or pixel/cm */
391 
392  size_t
393  quality; /* compression quality */
394 
395  char
396  *sampling_factor, /* Chroma subsampling ratio string */
397  *server_name, /* X windows server name - display/animate */
398  *font, /* DUP for draw_info */
399  *texture, /* montage/display background tile */
400  *density; /* DUP for image and draw_info */
401 
402  double
403  pointsize,
404  fuzz; /* current color fuzz attribute */
405 
406  PixelInfo
407  alpha_color, /* deprecated */
408  background_color, /* user set background color */
409  border_color, /* user set border color */
410  transparent_color; /* color for transparent index in color tables */
411  /* NB: fill color is only needed in draw_info! */
412  /* the same for undercolor (for font drawing) */
413 
414  MagickBooleanType
415  dither, /* dither enable-disable */
416  monochrome; /* read/write pcl,pdf,ps,xps as monochrome image */
417 
418  ColorspaceType
419  colorspace;
420 
421  CompositeOperator
422  compose;
423 
424  ImageType
425  type;
426 
427  MagickBooleanType
428  ping, /* fast read image attributes, not image data */
429  verbose; /* verbose output enable/disable */
430 
431  ChannelType
432  channel;
433 
434  void
435  *options; /* splay tree of global options */
436 
437  void
438  *profile;
439 
440  MagickBooleanType
441  synchronize;
442 
443  MagickProgressMonitor
444  progress_monitor;
445 
446  void
447  *client_data,
448  *cache;
449 
450  StreamHandler
451  stream;
452 
453  FILE
454  *file;
455 
456  void
457  *blob;
458 
459  size_t
460  length;
461 
462  char
463  magick[MagickPathExtent], /* image file format (file magick) */
464  unique[MagickPathExtent], /* unique temporary filename - delegates */
465  filename[MagickPathExtent]; /* filename when reading/writing image */
466 
467  MagickBooleanType
468  debug;
469 
470  size_t
471  signature;
472 
474  *custom_stream;
475 
476  PixelInfo
477  matte_color; /* matte (frame) color */
478 };
479 
480 extern MagickExport ChannelType
481  SetImageChannelMask(Image *,const ChannelType);
482 
483 extern MagickExport ExceptionType
484  CatchImageException(Image *);
485 
486 extern MagickExport FILE
487  *GetImageInfoFile(const ImageInfo *);
488 
489 extern MagickExport Image
490  *AcquireImage(const ImageInfo *,ExceptionInfo *),
491  *AppendImages(const Image *,const MagickBooleanType,ExceptionInfo *),
492  *CloneImage(const Image *,const size_t,const size_t,const MagickBooleanType,
493  ExceptionInfo *),
494  *DestroyImage(Image *),
495  *GetImageMask(const Image *,const PixelMask,ExceptionInfo *),
496  *NewMagickImage(const ImageInfo *,const size_t,const size_t,const PixelInfo *,
497  ExceptionInfo *),
498  *ReferenceImage(Image *),
499  *SmushImages(const Image *,const MagickBooleanType,const ssize_t,
500  ExceptionInfo *);
501 
502 extern MagickExport ImageInfo
503  *AcquireImageInfo(void),
504  *CloneImageInfo(const ImageInfo *),
505  *DestroyImageInfo(ImageInfo *);
506 
507 extern MagickExport MagickBooleanType
508  ClipImage(Image *,ExceptionInfo *),
509  ClipImagePath(Image *,const char *,const MagickBooleanType,ExceptionInfo *),
510  CopyImagePixels(Image *,const Image *,const RectangleInfo *,
511  const OffsetInfo *,ExceptionInfo *),
512  IsTaintImage(const Image *),
513  IsHighDynamicRangeImage(const Image *,ExceptionInfo *),
514  IsImageObject(const Image *),
515  ListMagickInfo(FILE *,ExceptionInfo *),
516  ModifyImage(Image **,ExceptionInfo *),
517  ResetImagePage(Image *,const char *),
518  ResetImagePixels(Image *,ExceptionInfo *),
519  SetImageAlpha(Image *,const Quantum,ExceptionInfo *),
520  SetImageBackgroundColor(Image *,ExceptionInfo *),
521  SetImageColor(Image *,const PixelInfo *,ExceptionInfo *),
522  SetImageExtent(Image *,const size_t,const size_t,ExceptionInfo *),
523  SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *),
524  SetImageMask(Image *,const PixelMask type,const Image *,ExceptionInfo *),
525  SetImageRegionMask(Image *,const PixelMask type,const RectangleInfo *,
526  ExceptionInfo *),
527  SetImageStorageClass(Image *,const ClassType,ExceptionInfo *),
528  StripImage(Image *,ExceptionInfo *),
529  SyncImage(Image *,ExceptionInfo *),
530  SyncImageSettings(const ImageInfo *,Image *,ExceptionInfo *),
531  SyncImagesSettings(ImageInfo *,Image *,ExceptionInfo *);
532 
533 extern MagickExport size_t
534  InterpretImageFilename(const ImageInfo *,Image *,const char *,int,char *,
535  ExceptionInfo *);
536 
537 extern MagickExport ssize_t
538  GetImageReferenceCount(Image *);
539 
540 extern MagickExport VirtualPixelMethod
541  GetImageVirtualPixelMethod(const Image *),
542  SetImageVirtualPixelMethod(Image *,const VirtualPixelMethod,ExceptionInfo *);
543 
544 extern MagickExport void
545  AcquireNextImage(const ImageInfo *,Image *,ExceptionInfo *),
546  DestroyImagePixels(Image *),
547  DisassociateImageStream(Image *),
548  GetImageInfo(ImageInfo *),
549  SetImageInfoBlob(ImageInfo *,const void *,const size_t),
550  SetImageInfoFile(ImageInfo *,FILE *),
551  SetImageInfoCustomStream(ImageInfo *,CustomStreamInfo *);
552 
553 #if defined(__cplusplus) || defined(c_plusplus)
554 }
555 #endif
556 
557 #endif
_RectangleInfo
Definition: geometry.h:129
_ProfileInfo
Definition: profile.c:97
_SegmentInfo
Definition: image.h:84
_BlobInfo
Definition: blob.c:135
SemaphoreInfo
Definition: semaphore.c:60
_Image
Definition: image.h:131
_PixelInfo
Definition: pixel.h:181
_ImageInfo
Definition: image.h:358
_CustomStreamInfo
Definition: blob.c:198
_ChromaticityInfo
Definition: image.h:102
_PrimaryInfo
Definition: image.h:76
_OffsetInfo
Definition: geometry.h:115
_Ascii85Info
Definition: compress.c:69
_TimerInfo
Definition: timer.h:40
_ExceptionInfo
Definition: exception.h:101
_PixelChannelMap
Definition: pixel.h:169
_PointInfo
Definition: geometry.h:122
_ErrorInfo
Definition: color.h:76