/usr/include/GraphicsMagick/magick/blob.h is in libgraphicsmagick1-dev 1.3.28-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | /*
Copyright (C) 2003-2017 GraphicsMagick Group
Copyright (C) 2002 ImageMagick Studio
Copyright 1991-1999 E. I. du Pont de Nemours and Company
This program is covered by multiple licenses, which are described in
Copyright.txt. You should have received a copy of Copyright.txt with this
package; otherwise see http://www.graphicsmagick.org/www/Copyright.html.
Image Compression/Decompression Methods.
*/
#ifndef _MAGICK_BLOB_H
#define _MAGICK_BLOB_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#include "magick/image.h"
/*
Minimum input file size before considering for memory map.
*/
#define MinBlobExtent 32768L
/*
Forward declarations.
*/
typedef struct _BlobInfo BlobInfo;
/*
*
* BlobInfo methods
*
*/
/*
Makes a duplicate of the given blob info structure, or if blob info
is NULL, a new one.
*/
extern MagickExport BlobInfo* CloneBlobInfo(const BlobInfo *blob_info);
/*
Increments the reference count associated with the pixel blob,
returning a pointer to the blob.
*/
extern MagickExport BlobInfo* ReferenceBlob(BlobInfo *blob);
/*
Deallocate memory associated with the BlobInfo structure.
*/
extern MagickExport void DestroyBlobInfo(BlobInfo *blob) MAGICK_FUNC_DEPRECATED;
/*
If BLOB is a memory mapping then unmap it. Reset BlobInfo structure
to its default state.
*/
extern MagickExport void DetachBlob(BlobInfo *blob);
/*
Initialize a BlobInfo structure.
*/
extern MagickExport void GetBlobInfo(BlobInfo *blob);
/*
Attach memory buffer to a BlobInfo structure.
*/
extern MagickExport void AttachBlob(BlobInfo *blob_info,
const void *blob,
const size_t length);
/*
*
* Functions for managing a BLOB (type BlobInfo) attached to an Image.
*
*/
/*
Deallocate all memory associated with an Image blob (reference counted).
*/
extern MagickExport void DestroyBlob(Image *image);
/*
*
* Formatted image I/O functions
*
*/
/*
Read an Image from a formatted in-memory "file" image ("BLOB").
*/
extern MagickExport Image* BlobToImage(const ImageInfo *image_info,
const void *blob,
const size_t length,
ExceptionInfo *exception);
/*
Return an Image populated with salient information regarding a
formatted in-memory "file" image ("BLOB") but without reading the
image pixels.
*/
extern MagickExport Image* PingBlob(const ImageInfo *image_info,
const void *blob,
const size_t length,
ExceptionInfo *exception);
/*
Writes an Image to a formatted (like a file) in-memory
representation.
*/
extern MagickExport void *ImageToBlob(const ImageInfo *image_info,
Image *image,
size_t *length,
ExceptionInfo *exception);
/*
*
* Core File or BLOB I/O functions.
*
*/
/*
Blob open modes.
*/
typedef enum
{
UndefinedBlobMode, /* Undefined */
ReadBlobMode, /* Open for reading (text) */ /* only locale.c */
ReadBinaryBlobMode, /* Open for reading (binary) */
WriteBlobMode, /* Open for writing (text) */ /* only mvg.c txt.c */
WriteBinaryBlobMode /* Open for writing (binary) */
} BlobMode;
/*
Open an input or output stream for access. May also use a stream
provided via image_info->stream.
*/
extern MagickExport MagickPassFail OpenBlob(const ImageInfo *image_info,
Image *image,
const BlobMode mode,
ExceptionInfo *exception);
/*
Close I/O to the file or BLOB.
*/
extern MagickExport MagickPassFail CloseBlob(Image *image);
/*
Read data from the file or BLOB into a buffer.
*/
extern MagickExport size_t ReadBlob(Image *image,
const size_t length,
void *data);
/*
Read data from the file or BLOB into a buffer, but support zero-copy
if possible.
*/
extern MagickExport size_t ReadBlobZC(Image *image,
const size_t length,
void **data);
/*
Write data from a buffer to the file or BLOB.
*/
extern MagickExport size_t WriteBlob(Image *image,
const size_t length,
const void *data);
/*
Move the current read or write offset position in the file or BLOB.
*/
extern MagickExport magick_off_t SeekBlob(Image *image,
const magick_off_t offset,
const int whence);
/*
Obtain the current read or write offset position in the file or
BLOB.
*/
extern MagickExport magick_off_t TellBlob(const Image *image);
/*
Test to see if EOF has been detected while reading the file or BLOB.
*/
extern MagickExport int EOFBlob(const Image *image);
/*
Test to see if an error has been encountered while doing I/O to the file
or BLOB. Non-zero is returned if an error occured.
*/
extern MagickExport int GetBlobStatus(const Image *image);
/*
Return the first errno present when an error has been encountered while
doing I/O to the file or BLOB. This is only useful if GetBlobStatus() has
already reported that an error occured.
*/
extern MagickExport int GetBlobFirstErrno(const Image *image);
/*
Test to see if blob is currently open.
*/
extern MagickExport MagickBool GetBlobIsOpen(const Image *image);
/*
Obtain the current size of the file or BLOB. Zero is returned if
the size can not be determined. If BLOB is no longer open, then
return the size when the BLOB was closed.
*/
extern MagickExport magick_off_t GetBlobSize(const Image *image);
/*
Obtain the underlying stdio FILE* for the file (if any).
*/
extern MagickExport FILE *GetBlobFileHandle(const Image *image);
/*
Obtain a pointer to the base of where BLOB data is stored. The data
is only available if the data is stored on the heap, or is memory
mapped. Otherwise NULL is returned.
*/
extern MagickExport unsigned char *GetBlobStreamData(const Image *image);
/*
*
* Formatted File or BLOB I/O functions.
*
*/
/*
Read a single byte from the file or BLOB. Returns an EOF character if EOF
has been detected.
*/
extern MagickExport int ReadBlobByte(Image *image);
/*
Read a 16-bit little-endian unsigned "short" value from the file or BLOB.
*/
extern MagickExport magick_uint16_t ReadBlobLSBShort(Image *image);
/*
Read a 16-bit little-endian signed "short" value from the file or BLOB.
*/
extern MagickExport magick_int16_t ReadBlobLSBSignedShort(Image *image);
/*
Read an array of little-endian unsigned 16-bit "short" values from the
file or BLOB.
*/
extern MagickExport size_t ReadBlobLSBShorts(Image *image, size_t octets,
magick_uint16_t *data);
/*
Read a 16-bit big-endian unsigned "short" value from the file or
BLOB.
*/
extern MagickExport magick_uint16_t ReadBlobMSBShort(Image *image);
/*
Read a 16-bit big-endian signed "short" value from the file or BLOB.
*/
extern MagickExport magick_int16_t ReadBlobMSBSignedShort(Image *image);
/*
Read an array of big-endian 16-bit "short" values from the file or BLOB.
*/
extern MagickExport size_t ReadBlobMSBShorts(Image *image, size_t octets,
magick_uint16_t *data);
/*
Read a 32-bit little-endian unsigned "long" value from the file or BLOB.
*/
extern MagickExport magick_uint32_t ReadBlobLSBLong(Image *image);
/*
Read a 32-bit little-endian signed "long" value from the file or BLOB.
*/
extern MagickExport magick_int32_t ReadBlobLSBSignedLong(Image *image);
/*
Read an array of little-endian 32-bit "long" values from the file or BLOB.
*/
extern MagickExport size_t ReadBlobLSBLongs(Image *image, size_t octets,
magick_uint32_t *data);
/*
Read a 32-bit big-endian unsigned "long" value from the file or BLOB.
*/
extern MagickExport magick_uint32_t ReadBlobMSBLong(Image *image);
/*
Read a 32-bit big-endian signed "long" value from the file or BLOB.
*/
extern MagickExport magick_int32_t ReadBlobMSBSignedLong(Image *image);
/*
Read an array of big-endian 32-bit "long" values from the file or BLOB.
*/
extern MagickExport size_t ReadBlobMSBLongs(Image *image, size_t octets,
magick_uint32_t *data);
/*
Read a little-endian 32-bit "float" value from the file or BLOB.
*/
extern MagickExport float ReadBlobLSBFloat(Image *image);
/*
Read an array of little-endian 32-bit "float" values from the file or
BLOB.
*/
extern MagickExport size_t ReadBlobLSBFloats(Image *image, size_t octets,
float *data);
/*
Read a big-endian 32-bit "float" value from the file or BLOB.
*/
extern MagickExport float ReadBlobMSBFloat(Image *image);
/*
Read an array of big-endian 32-bit "float" values from the file or BLOB.
*/
extern MagickExport size_t ReadBlobMSBFloats(Image *image, size_t octets,
float *data);
/*
Read a little-endian 64-bit "double" value from the file or BLOB.
*/
extern MagickExport double ReadBlobLSBDouble(Image *image);
/*
Read an array of little-endian 64-bit "double" values from the file or
BLOB.
*/
extern MagickExport size_t ReadBlobLSBDoubles(Image *image, size_t octets,
double *data);
/*
Read a big-endian 64-bit "double" value from the file or BLOB.
*/
extern MagickExport double ReadBlobMSBDouble(Image *image);
/*
Read an array of big-endian 64-bit "double" values from the file or BLOB.
*/
extern MagickExport size_t ReadBlobMSBDoubles(Image *image, size_t octets,
double *data);
/*
Read a string from the file or blob until a newline character is read or
an end-of-file condition is encountered.
*/
extern MagickExport char *ReadBlobString(Image *image,
char *string);
/*
Write a single byte to the file or BLOB.
*/
extern MagickExport size_t WriteBlobByte(Image *image,
const magick_uint8_t value);
/*
Write the content of an entire disk file to the file or BLOB.
*/
extern MagickExport MagickPassFail WriteBlobFile(Image *image,
const char *filename);
/*
Write a 16-bit signed "short" value to the file or BLOB in little-endian
order.
*/
extern MagickExport size_t WriteBlobLSBShort(Image *image,
const magick_uint16_t value);
/*
Write a 16-bit signed "short" value to the file or BLOB in little-endian
order.
*/
extern MagickExport size_t WriteBlobLSBSignedShort(Image *image,
const magick_int16_t value);
/*
Write a 32-bit unsigned "long" value to the file or BLOB in little-endian
order.
*/
extern MagickExport size_t WriteBlobLSBLong(Image *image,
const magick_uint32_t value);
/*
Write a 32-bit signed "long" value to the file or BLOB in little-endian
order.
*/
extern MagickExport size_t WriteBlobLSBSignedLong(Image *image,
const magick_int32_t value);
/*
Write a 32-bit unsigned "long" value to the file or BLOB in big-endian
order.
*/
extern MagickExport size_t WriteBlobMSBLong(Image *image,
const magick_uint32_t value);
/*
Write a 32-bit signed "long" value to the file or BLOB in big-endian
order.
*/
extern MagickExport size_t WriteBlobMSBSignedLong(Image *image,
const magick_int32_t value);
/*
Write a 16-bit unsigned "short" value to the file or BLOB in big-endian
order.
*/
extern MagickExport size_t WriteBlobMSBShort(Image *image,
const magick_uint16_t value);
/*
Write a 16-bit signed "short" value to the file or BLOB in big-endian
order.
*/
extern MagickExport size_t WriteBlobMSBSignedShort(Image *image,
const magick_int16_t value);
/*
Write a C string to the file or BLOB, without the terminating NULL byte.
*/
extern MagickExport size_t WriteBlobString(Image *image,
const char *string);
/*
*
* BLOB attribute access.
*
*/
/*
Blob supports seek operations. BlobSeek() and BlobTell() may safely be
used.
*/
extern MagickExport MagickBool BlobIsSeekable(const Image *image);
/*
Allow file descriptor to be closed (if True).
*/
extern MagickExport void SetBlobClosable(Image *image,
MagickBool closable);
/*
Blob is for a temporary file which should be deleted (if True).
*/
extern MagickExport void SetBlobTemporary(Image *image,
MagickBool isTemporary);
/*
Returns MagickTrue if the file associated with the blob is a temporary
file and should be removed when the associated image is destroyed.
*/
extern MagickExport MagickBool GetBlobTemporary(const Image *image);
/*
*
* Memory mapped file support.
*
*/
/*
Memory mapping modes.
*/
typedef enum
{
ReadMode, /* Map for read-only access */
WriteMode, /* Map for write-only access (useless) */
IOMode /* Map for read/write access */
} MapMode;
/*
Release memory mapping for a region.
*/
extern MagickExport MagickPassFail UnmapBlob(void *map,
const size_t length);
/*
Perform a requested memory mapping of a file descriptor.
*/
extern MagickExport void *MapBlob(int file,
const MapMode mode,
magick_off_t offset,
size_t length);
/*
*
* Buffer to File / File to Buffer functions.
*
*/
/*
Writes a buffer to a named file.
*/
extern MagickExport MagickPassFail BlobToFile(const char *filename,
const void *blob,
const size_t length,
ExceptionInfo *exception);
/*
Read the contents of a file into memory.
*/
extern MagickExport void *FileToBlob(const char *filename,
size_t *length,
ExceptionInfo *exception);
/*
*
* Junk yet to be categorized.
*
*/
/*
Reserve space for a specified output size.
*/
extern MagickExport MagickPassFail BlobReserveSize(Image *image, magick_off_t size);
/*
Copies data from the input stream to a file. Useful in case it is
necessary to perform seek operations on the input data.
*/
extern MagickExport MagickPassFail ImageToFile(Image *image,
const char *filename,
ExceptionInfo *exception);
/*
Search for a configuration file (".mgk" file) using appropriate
rules and return as an in-memory buffer.
*/
extern MagickExport void *GetConfigureBlob(const char *filename,
char *path,
size_t *length,
ExceptionInfo *exception);
/*
Converts a least-significant byte first buffer of integers to
most-significant byte first.
*/
extern MagickExport void MSBOrderLong(unsigned char *buffer,
const size_t length);
/*
Converts a least-significant byte first buffer of integers to
most-significant byte first.
*/
extern MagickExport void MSBOrderShort(unsigned char *p,
const size_t length);
/*
Checks if the blob of the specified image is referenced by other images. If
the reference count is higher then 1 a new blob is assigned to the image.
*/
extern MagickExport void DisassociateBlob(Image *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif
/*
* Local Variables:
* mode: c
* c-basic-offset: 2
* fill-column: 78
* End:
*/
|