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