Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | /* |
michael@0 | 6 | * iccprofile.h |
michael@0 | 7 | * |
michael@0 | 8 | * This file provides code to read and write International Color Consortium |
michael@0 | 9 | * (ICC) device profiles embedded in JFIF JPEG image files. The ICC has |
michael@0 | 10 | * defined a standard format for including such data in JPEG "APP2" markers. |
michael@0 | 11 | * The code given here does not know anything about the internal structure |
michael@0 | 12 | * of the ICC profile data; it just knows how to put the profile data into |
michael@0 | 13 | * a JPEG file being written, or get it back out when reading. |
michael@0 | 14 | * |
michael@0 | 15 | * This code depends on new features added to the IJG JPEG library as of |
michael@0 | 16 | * IJG release 6b; it will not compile or work with older IJG versions. |
michael@0 | 17 | * |
michael@0 | 18 | * NOTE: this code would need surgery to work on 16-bit-int machines |
michael@0 | 19 | * with ICC profiles exceeding 64K bytes in size. See iccprofile.c |
michael@0 | 20 | * for details. |
michael@0 | 21 | */ |
michael@0 | 22 | |
michael@0 | 23 | #include <stdio.h> /* needed to define "FILE", "NULL" */ |
michael@0 | 24 | #include "jpeglib.h" |
michael@0 | 25 | |
michael@0 | 26 | /* |
michael@0 | 27 | * Reading a JPEG file that may contain an ICC profile requires two steps: |
michael@0 | 28 | * |
michael@0 | 29 | * 1. After jpeg_create_decompress() but before jpeg_read_header(), |
michael@0 | 30 | * call setup_read_icc_profile(). This routine tells the IJG library |
michael@0 | 31 | * to save in memory any APP2 markers it may find in the file. |
michael@0 | 32 | * |
michael@0 | 33 | * 2. After jpeg_read_header(), call read_icc_profile() to find out |
michael@0 | 34 | * whether there was a profile and obtain it if so. |
michael@0 | 35 | */ |
michael@0 | 36 | |
michael@0 | 37 | |
michael@0 | 38 | /* |
michael@0 | 39 | * Prepare for reading an ICC profile |
michael@0 | 40 | */ |
michael@0 | 41 | |
michael@0 | 42 | extern void setup_read_icc_profile JPP((j_decompress_ptr cinfo)); |
michael@0 | 43 | |
michael@0 | 44 | |
michael@0 | 45 | /* |
michael@0 | 46 | * See if there was an ICC profile in the JPEG file being read; |
michael@0 | 47 | * if so, reassemble and return the profile data. |
michael@0 | 48 | * |
michael@0 | 49 | * TRUE is returned if an ICC profile was found, FALSE if not. |
michael@0 | 50 | * If TRUE is returned, *icc_data_ptr is set to point to the |
michael@0 | 51 | * returned data, and *icc_data_len is set to its length. |
michael@0 | 52 | * |
michael@0 | 53 | * IMPORTANT: the data at **icc_data_ptr has been allocated with malloc() |
michael@0 | 54 | * and must be freed by the caller with free() when the caller no longer |
michael@0 | 55 | * needs it. (Alternatively, we could write this routine to use the |
michael@0 | 56 | * IJG library's memory allocator, so that the data would be freed implicitly |
michael@0 | 57 | * at jpeg_finish_decompress() time. But it seems likely that many apps |
michael@0 | 58 | * will prefer to have the data stick around after decompression finishes.) |
michael@0 | 59 | */ |
michael@0 | 60 | |
michael@0 | 61 | extern boolean read_icc_profile JPP((j_decompress_ptr cinfo, |
michael@0 | 62 | JOCTET **icc_data_ptr, |
michael@0 | 63 | unsigned int *icc_data_len)); |