Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
TiffImg.h
Go to the documentation of this file.
1/*
2 File: TiffImg.cpp
3
4 Contains: Implementation of the CTiffImg class.
5
6 Version: V1
7
8 Copyright: (c) see below
9*/
10
11/*
12 * The ICC Software License, Version 0.2
13 *
14 *
15 * Copyright (c) 2003-2010 The International Color Consortium. All rights
16 * reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 *
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 *
25 * 2. Redistributions in binary form must reproduce the above copyright
26 * notice, this list of conditions and the following disclaimer in
27 * the documentation and/or other materials provided with the
28 * distribution.
29 *
30 * 3. In the absence of prior written permission, the names "ICC" and "The
31 * International Color Consortium" must not be used to imply that the
32 * ICC organization endorses or promotes products derived from this
33 * software.
34 *
35 *
36 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39 * DISCLAIMED. IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
40 * ITS CONTRIBUTING MEMBERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This software consists of voluntary contributions made by many
51 * individuals on behalf of the The International Color Consortium.
52 *
53 *
54 * Membership in the ICC is encouraged when this software is used for
55 * commercial purposes.
56 *
57 *
58 * For more information on The International Color Consortium, please
59 * see <http://www.color.org/>.
60 *
61 *
62 */
63
64//////////////////////////////////////////////////////////////////////
65// HISTORY:
66//
67// -Initial implementation by Max Derhak 5-15-2003
68//
69//////////////////////////////////////////////////////////////////////
70
71#if !defined(_TIFFIMG_H)
72#define _TIFFIMG_H
73
74#include "tiffio.h" // need tiff library
75#include "IccProfLibConf.h"
76#include "icProfileHeader.h"
77
78#define PHOTO_MINISBLACK 0
79#define PHOTO_MINISWHITE 1
80#define PHOTO_CIELAB 2
81#define PHOTO_ICCLAB 3
82
84{
85public:
86 CTiffImg();
87 virtual ~CTiffImg();
88
89 void Close();
90
91 bool Create(const char *szFname, unsigned int nWidth, unsigned int nHeight,
92 unsigned int nBPS, unsigned int nPhoto, unsigned int nSamples,
93 float fXRes, float fYRes, bool bCompress=true, bool bSep=false);
94 bool Open(const char *szFname);
95
96 bool ReadLine(unsigned char *pBuf);
97 bool WriteLine(unsigned char *pBuf);
98
99 unsigned int GetWidth() { return m_nWidth;}
100 unsigned int GetHeight() { return m_nHeight;}
101 double GetWidthIn() { return (double)m_nWidth / m_fXRes; }
102 double GetHeightIn() { return (double)m_nHeight / m_fYRes; }
103 unsigned int GetBitsPerSample() { return m_nBitsPerSample;}
104 unsigned int GetPhoto();
105 unsigned int GetSamples() { return m_nSamples;}
106 unsigned int GetExtraSamples() { return m_nExtraSamples; }
107 unsigned int GetCompress() { return m_nCompress; }
108 unsigned int GetPlanar() { return m_nPlanar; }
109 float GetXRes() {return m_fXRes;}
110 float GetYRes() {return m_fYRes;}
111
112 unsigned int GetBytesPerLine() { return m_nBytesPerLine; }
113
114 bool GetIccProfile(unsigned char *&pProfile, unsigned int &nLen);
115 bool SetIccProfile(unsigned char *pProfile, unsigned int nLen);
116
117protected:
118 TIFF *m_hTif;
120
121 unsigned int m_nWidth;
122 unsigned int m_nHeight;
130
131 float m_fXRes;
132 float m_fYRes;
133
134 unsigned int m_nBytesPerLine;
135 unsigned int m_nRowsPerStrip;
136 unsigned int m_nStripSize;
137 unsigned int m_nStripSamples;
138 unsigned int m_nStripsPerSample;
140
141 unsigned char *m_pStripBuf;
142
143 unsigned int m_nCurLine;
144 unsigned int m_nCurStrip;
145
146 unsigned char *m_pProfile;
147 unsigned int m_nProfileLength;
148};
149
150#endif // !defined(_TIFFIMG_H)
File: IccProfLibConf.h.
unsigned int m_nProfileLength
Definition TiffImg.h:147
float GetYRes()
Definition TiffImg.h:110
bool Open(const char *szFname)
Definition TiffImg.cpp:228
float m_fXRes
Definition TiffImg.h:131
void Close()
Definition TiffImg.cpp:104
unsigned int GetBitsPerSample()
Definition TiffImg.h:103
unsigned int m_nWidth
Definition TiffImg.h:121
unsigned int m_nStripsPerSample
Definition TiffImg.h:138
unsigned int GetWidth()
Definition TiffImg.h:99
bool m_bRead
Definition TiffImg.h:119
icUInt16Number m_nExtraSamples
Definition TiffImg.h:127
unsigned int m_nRowsPerStrip
Definition TiffImg.h:135
icUInt16Number m_nCompress
Definition TiffImg.h:129
icUInt16Number m_nPlanar
Definition TiffImg.h:128
unsigned int m_nStripSamples
Definition TiffImg.h:137
unsigned int GetPlanar()
Definition TiffImg.h:108
icUInt16Number m_nSamples
Definition TiffImg.h:126
double GetHeightIn()
Definition TiffImg.h:102
virtual ~CTiffImg()
Definition TiffImg.cpp:99
double GetWidthIn()
Definition TiffImg.h:101
float GetXRes()
Definition TiffImg.h:109
unsigned char * m_pProfile
Definition TiffImg.h:146
unsigned int GetPhoto()
Definition TiffImg.cpp:391
unsigned int m_nCurStrip
Definition TiffImg.h:144
TIFF * m_hTif
Definition TiffImg.h:118
bool Create(const char *szFname, unsigned int nWidth, unsigned int nHeight, unsigned int nBPS, unsigned int nPhoto, unsigned int nSamples, float fXRes, float fYRes, bool bCompress=true, bool bSep=false)
Definition TiffImg.cpp:124
unsigned int m_nHeight
Definition TiffImg.h:122
unsigned int GetSamples()
Definition TiffImg.h:105
unsigned int GetExtraSamples()
Definition TiffImg.h:106
float m_fYRes
Definition TiffImg.h:132
unsigned int GetHeight()
Definition TiffImg.h:100
icUInt16Number m_nPhoto
Definition TiffImg.h:125
bool WriteLine(unsigned char *pBuf)
Definition TiffImg.cpp:353
unsigned int GetBytesPerLine()
Definition TiffImg.h:112
unsigned int m_nStripSize
Definition TiffImg.h:136
bool ReadLine(unsigned char *pBuf)
Definition TiffImg.cpp:302
bool SetIccProfile(unsigned char *pProfile, unsigned int nLen)
Definition TiffImg.cpp:420
bool GetIccProfile(unsigned char *&pProfile, unsigned int &nLen)
Definition TiffImg.cpp:410
unsigned int m_nCurLine
Definition TiffImg.h:143
unsigned char * m_pStripBuf
Definition TiffImg.h:141
unsigned int m_nBytesPerLine
Definition TiffImg.h:134
unsigned int GetCompress()
Definition TiffImg.h:107
icUInt16Number m_nBitsPerSample
Definition TiffImg.h:123
icUInt16Number m_nBytesPerSample
Definition TiffImg.h:124
unsigned int m_nBytesPerStripLine
Definition TiffImg.h:139
File: icProfileHeader.h.
unsigned short icUInt16Number