Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TTIO_JPG_INCLUDED
Toshihiro Shimizu 890ddd
#define TTIO_JPG_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tiio.h"
Toshihiro Shimizu 890ddd
#include "tproperty.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
extern "C" {
Toshihiro Shimizu 890ddd
#define XMD_H
Toshihiro Shimizu 890ddd
#include "jpeglib.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*
Toshihiro Shimizu 890ddd
 * <setjmp.h> is used for the optional error recovery mechanism shown in</setjmp.h>
Toshihiro Shimizu 890ddd
 * the second part of the example.
Toshihiro Shimizu 890ddd
 */
Toshihiro Shimizu 890ddd
#include <setjmp.h></setjmp.h>
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#ifdef TNZCORE_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
namespace Tiio
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI JpgReader : public Tiio::Reader
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	struct jpeg_decompress_struct m_cinfo;
Toshihiro Shimizu 890ddd
	struct jpeg_error_mgr m_jerr;
Toshihiro Shimizu 890ddd
	FILE *m_chan;
Toshihiro Shimizu 890ddd
	JSAMPARRAY m_buffer;
Toshihiro Shimizu 890ddd
	bool m_isOpen;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	JpgReader();
Toshihiro Shimizu 890ddd
	~JpgReader();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	Tiio::RowOrder getRowOrder() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void open(FILE *file);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void readLine(char *buffer, int x0, int x1, int shrink);
Toshihiro Shimizu 890ddd
	int skipLines(int lineCount);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI Tiio::ReaderMaker makeJpgReader;
Toshihiro Shimizu 890ddd
DVAPI Tiio::WriterMaker makeJpgWriter;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI JpgWriterProperties : public TPropertyGroup
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TIntProperty m_quality;
Toshihiro Shimizu 890ddd
	TIntProperty m_smoothing;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	static const std::string QUALITY;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	JpgWriterProperties()
Toshihiro Shimizu 890ddd
		: m_quality(QUALITY, 0, 100, 90), m_smoothing("Smoothing", 0, 100, 0)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		bind(m_quality);
Toshihiro Shimizu 890ddd
		bind(m_smoothing);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
} // namespace
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif