C++程序  |  246行  |  5.03 KB

/*****************************************************************************/
// Copyright 2007-2011 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE:  Adobe permits you to use, modify, and distribute this file in
// accordance with the terms of the Adobe license agreement accompanying it.
/*****************************************************************************/

/* $Id: //mondo/dng_sdk_1_4/dng_sdk/source/dng_preview.h#1 $ */ 
/* $DateTime: 2012/05/30 13:28:51 $ */
/* $Change: 832332 $ */
/* $Author: tknoll $ */

/*****************************************************************************/

#ifndef __dng_preview__
#define __dng_preview__

/*****************************************************************************/

#include "dng_auto_ptr.h"
#include "dng_classes.h"
#include "dng_ifd.h"
#include "dng_opcode_list.h"
#include "dng_point.h"
#include "dng_sdk_limits.h"

/*****************************************************************************/

class dng_preview
	{
	
	public:
	
		dng_preview_info fInfo;
		
	protected:
	
		dng_preview ();
		
	public:
	
		virtual ~dng_preview ();
		
		virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const = 0;
		
		virtual void WriteData (dng_host &host,
								dng_image_writer &writer,
								dng_basic_tag_set &basic,
								dng_stream &stream) const = 0;
		
	};
		
/*****************************************************************************/

class dng_image_preview: public dng_preview
	{
	
	public:
	
		AutoPtr<dng_image> fImage;
		
	private:
		
		mutable dng_ifd fIFD;
		
	public:
	
		dng_image_preview ();
		
		virtual ~dng_image_preview ();
		
		virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const;
		
		virtual void WriteData (dng_host &host,
								dng_image_writer &writer,
								dng_basic_tag_set &basic,
								dng_stream &stream) const;
		
	private:
	
		// Hidden copy constructor and assignment operator.
		
		dng_image_preview (const dng_image_preview &preview);
		
		dng_image_preview & operator= (const dng_image_preview &preview);
					 
	};

/*****************************************************************************/

class dng_jpeg_preview: public dng_preview
	{
	
	public:
	
		dng_point fPreviewSize;
		
		uint16 fPhotometricInterpretation;
		
		dng_point fYCbCrSubSampling;
		
		uint16 fYCbCrPositioning;
		
		AutoPtr<dng_memory_block> fCompressedData;

	public:
	
		dng_jpeg_preview ();
		
		virtual ~dng_jpeg_preview ();
		
		virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const;
		
		virtual void WriteData (dng_host &host,
								dng_image_writer &writer,
								dng_basic_tag_set &basic,
								dng_stream &stream) const;
		
		void SpoolAdobeThumbnail (dng_stream &stream) const;
		
	private:
	
		// Hidden copy constructor and assignment operator.
		
		dng_jpeg_preview (const dng_jpeg_preview &preview);
		
		dng_jpeg_preview & operator= (const dng_jpeg_preview &preview);
					 
	};

/*****************************************************************************/

class dng_raw_preview: public dng_preview
	{
	
	public:
	
		AutoPtr<dng_image> fImage;
		
		AutoPtr<dng_memory_block> fOpcodeList2Data;
		
		int32 fCompressionQuality;

	private:
		
		mutable dng_ifd fIFD;
		
	public:
	
		dng_raw_preview ();
		
		virtual ~dng_raw_preview ();
		
		virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const;
		
		virtual void WriteData (dng_host &host,
								dng_image_writer &writer,
								dng_basic_tag_set &basic,
								dng_stream &stream) const;
		
	private:
	
		// Hidden copy constructor and assignment operator.
		
		dng_raw_preview (const dng_raw_preview &preview);
		
		dng_raw_preview & operator= (const dng_raw_preview &preview);
					 
	};

/*****************************************************************************/

class dng_mask_preview: public dng_preview
	{
	
	public:
	
		AutoPtr<dng_image> fImage;
		
		int32 fCompressionQuality;

	private:
		
		mutable dng_ifd fIFD;
		
	public:
	
		dng_mask_preview ();
		
		virtual ~dng_mask_preview ();
		
		virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const;
		
		virtual void WriteData (dng_host &host,
								dng_image_writer &writer,
								dng_basic_tag_set &basic,
								dng_stream &stream) const;
		
	private:
	
		// Hidden copy constructor and assignment operator.
		
		dng_mask_preview (const dng_mask_preview &preview);
		
		dng_mask_preview & operator= (const dng_mask_preview &preview);
					 
	};

/*****************************************************************************/

class dng_preview_list
	{
	
	private:
	
		uint32 fCount;
		
		AutoPtr<dng_preview> fPreview [kMaxDNGPreviews];
		
	public:
	
		dng_preview_list ();
		
		~dng_preview_list ();
		
		uint32 Count () const
			{
			return fCount;
			}
			
		const dng_preview & Preview (uint32 index) const
			{
			return *(fPreview [index]);
			}
			
		void Append (AutoPtr<dng_preview> &preview);
	
	};

/*****************************************************************************/

#endif
	
/*****************************************************************************/