image/decoders/iccjpeg.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/image/decoders/iccjpeg.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +/*
     1.9 + * iccprofile.h
    1.10 + *
    1.11 + * This file provides code to read and write International Color Consortium
    1.12 + * (ICC) device profiles embedded in JFIF JPEG image files.  The ICC has
    1.13 + * defined a standard format for including such data in JPEG "APP2" markers.
    1.14 + * The code given here does not know anything about the internal structure
    1.15 + * of the ICC profile data; it just knows how to put the profile data into
    1.16 + * a JPEG file being written, or get it back out when reading.
    1.17 + *
    1.18 + * This code depends on new features added to the IJG JPEG library as of
    1.19 + * IJG release 6b; it will not compile or work with older IJG versions.
    1.20 + *
    1.21 + * NOTE: this code would need surgery to work on 16-bit-int machines
    1.22 + * with ICC profiles exceeding 64K bytes in size.  See iccprofile.c
    1.23 + * for details.
    1.24 + */
    1.25 +
    1.26 +#include <stdio.h>		/* needed to define "FILE", "NULL" */
    1.27 +#include "jpeglib.h"
    1.28 +
    1.29 +/*
    1.30 + * Reading a JPEG file that may contain an ICC profile requires two steps:
    1.31 + *
    1.32 + * 1. After jpeg_create_decompress() but before jpeg_read_header(),
    1.33 + *    call setup_read_icc_profile().  This routine tells the IJG library
    1.34 + *    to save in memory any APP2 markers it may find in the file.
    1.35 + *
    1.36 + * 2. After jpeg_read_header(), call read_icc_profile() to find out
    1.37 + *    whether there was a profile and obtain it if so.
    1.38 + */
    1.39 +
    1.40 +
    1.41 +/*
    1.42 + * Prepare for reading an ICC profile
    1.43 + */
    1.44 +
    1.45 +extern void setup_read_icc_profile JPP((j_decompress_ptr cinfo));
    1.46 +
    1.47 +
    1.48 +/*
    1.49 + * See if there was an ICC profile in the JPEG file being read;
    1.50 + * if so, reassemble and return the profile data.
    1.51 + *
    1.52 + * TRUE is returned if an ICC profile was found, FALSE if not.
    1.53 + * If TRUE is returned, *icc_data_ptr is set to point to the
    1.54 + * returned data, and *icc_data_len is set to its length.
    1.55 + *
    1.56 + * IMPORTANT: the data at **icc_data_ptr has been allocated with malloc()
    1.57 + * and must be freed by the caller with free() when the caller no longer
    1.58 + * needs it.  (Alternatively, we could write this routine to use the
    1.59 + * IJG library's memory allocator, so that the data would be freed implicitly
    1.60 + * at jpeg_finish_decompress() time.  But it seems likely that many apps
    1.61 + * will prefer to have the data stick around after decompression finishes.)
    1.62 + */
    1.63 +
    1.64 +extern boolean read_icc_profile JPP((j_decompress_ptr cinfo,
    1.65 +				     JOCTET **icc_data_ptr,
    1.66 +				     unsigned int *icc_data_len));

mercurial