/*=====================================================================
 IMPress V3

 Copyright (C) 2007-2008 IT Access.,Co.Ltd. All Rights Reserved.

 This software is the confidential and proprietary information
 of IT Access.,Co.Ltd.
=====================================================================*/
#ifndef _INC_LSTIFF_H
#define _INC_LSTIFF_H

#ifdef __cplusplus
extern "C" {
#endif

/*=====================================================================
	Includes
=====================================================================*/
#include "impress.h"
#include "lsimage.h"

/* Compression */
#define	TIFF_COMPRESSION_NONE				1
#define	TIFF_COMPRESSION_JPEG				6

/* PhotometricInterPretation */
#define	TIFF_PHOTOMETRICINTERPRETATION_RGB		2
#define	TIFF_PHOTOMETRICINTERPRETATION_YCbCr	6

/* ResolutionUnit */
#define	TIFF_RESOLUTIONUNIT_INCH	2
#define	TIFF_RESOLUTIONUNIT_CENTI	3

/* YCbCrSubSampling */
#define	TIFF_YCbCrSUBSAMPLING_420	0x00020002
#define	TIFF_YCbCrSUBSAMPLING_422	0x00020001

#define	TIFF_STRING_MAX		256
#define	TIFF_DT_NUM			20
#define	TIFF_STRIPNUM_MAX	256

typedef	unsigned long	tulong;
typedef	unsigned short	tushort;
typedef	unsigned char	tuchar;

/*======== Structures ========*/

/*
	M:主画像
	T:サムネイル

	R:非圧縮点順次RGB
	Y:非圧縮点順次YCbCr
	J:Jpeg圧縮

	x:非設定タグ
	o:設定タグ
	D:Jpeg-DCFモード時のみ設定されるタグ

	HEX:タグ番号
	TYPE:タグタイプ
	Offs:オフセットデータ

	r:読み込みのみ、書き出し時には適切な値がライブラリ内部でセットされる
	r/w:読み書き可能、書き出し時には任意の値を設定できる
*/

typedef struct _LsTiffInfo {
												/* M   T                           */
												/* RYJ RYJ  HEX TYPE    Offs   r/w */
	/* 0th-1st IFD */
	tulong	ImageWidth;							/* oox oox  100 LONG           r   */
	tulong	ImageLength;						/* oox oox  101 LONG           r   */
	tushort	BitsPerSample[3];					/* oox oox  102 SHORT*3 Offs   r   */
	tushort	pad1  ;	/* padding to avoid struct packing 090821 */
	tulong	Compression;						/* oox ooo  103 SHORT          r   */
	tushort	PhotometricInterpretation;			/* oox oox  106 SHORT          r/w */
	tushort	pad2  ;	/* padding to avoid struct packing 090821 */
	tuchar	ImageDescription[TIFF_STRING_MAX];	/* ooo xxx  10e ASCII   Offs   r/w */
	tuchar	Make[TIFF_STRING_MAX];				/* ooo xxx  10f ASCII   Offs   r/w */
	tuchar	Model[TIFF_STRING_MAX];				/* ooo xxx  110 ASCII   Offs   r/w */
	tulong	StripOffsets[TIFF_STRIPNUM_MAX];	/* oox oox  111 LONG    (Offs) r   */
	tushort	Orientation;						/* ooo xxx  112 SHORT          r   */
	tushort	SapmlesPerPixel;					/* oox oox  115 SHORT          r   */
	tulong	RowsPerStrip;						/* oox oox  116 LONG           r   */
	tulong	StripByteCounts[TIFF_STRIPNUM_MAX];	/* oox oox  117 LONG    (Offs) r   */
	tulong	XResolution[2];						/* ooo ooo  11a RATIO   Offs   r/w */
	tulong	YResolution[2];						/* ooo ooo  11b RATIO   Offs   r/w */
	tushort	PlanarConfiguration;				/* oox oox  11c SHORT          r   */
	tushort	ResolutionUnit;						/* ooo ooo  128 SHORT          r/w */
	tuchar	DateTime[TIFF_DT_NUM];				/* ooo xxx  132 ASCII   Offs   r/w */
	tulong	JPEGInterchangeFormat;				/* xxx xxo  201 LONG           r   */
	tulong	JPEGInterchangeFormatLength;		/* xxx xxo  202 LONG           r   */
	tulong	YCbCrSubSampling;					/* xox xox  212 SHORT*2        r/w */
	tushort	YCbCrPositioning;					/* xoo xxx  213 SHORT          r   */
	tushort	pad3  ;	/* padding to avoid struct packing 090821 */
	tulong	ExifIFDPointer;						/* ooo xxx 8769 LONG           r   */
	/* Exif IFD */
	tuchar	ExifVersion[4];						/* ooo xxx 9000 UNDEF          r   */
	tuchar	DateTimeOriginal[TIFF_DT_NUM];		/* ooo xxx 9003 ASCII   Offs   r/w */
	tuchar	DateTimeDigitized[TIFF_DT_NUM];		/* ooo xxx 9004 ASCII   Offs   r/w */
	tulong	ComponentsConfiguration;			/* xxo xxx 9101 UNDEF          r   */
	tuchar	FlashPixVersion[4];					/* ooo xxx a000 UNDEF          r   */
	tushort	ColorSpace;							/* ooo xxx a001 SHORT          r   */
	tushort	pad4  ;	/* padding to avoid struct packing 090821 */
	tulong	PixelXDimension;					/* xxo xxx a002 SHORT          r   */
	tulong	PixelYDimension;					/* xxo xxx a003 SHORT          r   */
	tulong	InteroperabiliyIFDPointer;			/* xxD xxx a005 LONG           r   */
	/* Interoperabiliy IFD */
	tuchar	InteroperabiliyIndex[4];			/* xxD xxx    1 ASCII          r   */
	tuchar	InteroperabiliyVersion[4];			/* xxD xxx    2 UNDEF          r   */
} LsTiffInfo;

#ifdef __cplusplus
	}
#endif

#endif		/* _INC_LSTIFF_H */

