|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TIIO_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define TIIO_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
#include <string></string>
|
|
Toshihiro Shimizu |
890ddd |
#include <qstringlist></qstringlist>
|
|
Toshihiro Shimizu |
890ddd |
#include "timageinfo.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TNZCORE_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TVectorImage;
|
|
Toshihiro Shimizu |
890ddd |
class TPropertyGroup;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace Tiio
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum RowOrder { BOTTOM2TOP,
|
|
Toshihiro Shimizu |
890ddd |
TOP2BOTTOM };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI Exception
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI Reader
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
TImageInfo m_info;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Reader();
|
|
Toshihiro Shimizu |
890ddd |
virtual ~Reader();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void open(FILE *file) = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
const TImageInfo &getImageInfo() const { return m_info; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual TPropertyGroup *getProperties() const { return 0; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void readLine(char *buffer) { readLine(buffer, 0, m_info.m_lx - 1, 1); }
|
|
Toshihiro Shimizu |
890ddd |
void readLine(short *buffer) { readLine(buffer, 0, m_info.m_lx - 1, 1); }
|
|
Toshihiro Shimizu |
890ddd |
virtual void readLine(char *buffer, int x0, int x1, int shrink) = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual void readLine(short *, int, int, int) { assert(false); }
|
|
Toshihiro Shimizu |
890ddd |
// Returns skipped lines number.
|
|
Toshihiro Shimizu |
890ddd |
// If not implemented returns 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual int skipLines(int lineCount) = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual RowOrder getRowOrder() const { return BOTTOM2TOP; }
|
|
Toshihiro Shimizu |
890ddd |
virtual bool read16BitIsEnabled() const { return false; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// this function enables/disables the 64 bit reading.
|
|
Toshihiro Shimizu |
890ddd |
//If disabled, 64 bit images will be automatically scaled down to 32 bit.
|
|
Toshihiro Shimizu |
890ddd |
//The default behaviour for formats that support 64 bit images is "Enabled"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void enable16BitRead(bool) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
3bfa54 |
virtual void getTzpPaletteColorNames(std::map<int, std::pair<std::string,="" std::string="">> &pltColorNames) const { assert(false); }</int,>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
Reader(const Reader &);
|
|
Toshihiro Shimizu |
890ddd |
Reader &operator=(const Reader &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI Writer
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
TImageInfo m_info;
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *m_properties;
|
|
Toshihiro Shimizu |
890ddd |
static int m_bwThreshold;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
static void getSupportedFormats(QStringList &formats, bool onlyRenderFormats);
|
|
Toshihiro Shimizu |
890ddd |
static void setBlackAndWhiteThreshold(int threshold) { m_bwThreshold = threshold; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Writer();
|
|
Toshihiro Shimizu |
890ddd |
virtual ~Writer();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void open(FILE *file, const TImageInfo &inafo) = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *getProperties() { return m_properties; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void writeLine(char *buffer) = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual void writeLine(short *) { assert(false); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void flush() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual RowOrder getRowOrder() const { return BOTTOM2TOP; }
|
|
Toshihiro Shimizu |
890ddd |
virtual bool write64bitSupported() const { return false; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setProperties(TPropertyGroup *properties);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
Writer(const Writer &);
|
|
Toshihiro Shimizu |
890ddd |
Writer &operator=(const Writer &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI VectorReader
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
VectorReader() {}
|
|
Toshihiro Shimizu |
890ddd |
virtual ~VectorReader() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void open(FILE *file) = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual TVectorImage *read() = 0;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI VectorWriter
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
VectorWriter() {}
|
|
Toshihiro Shimizu |
890ddd |
virtual ~VectorWriter() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void open(FILE *file) = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual void write(TVectorImage *) = 0;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
typedef Reader *ReaderMaker();
|
|
Toshihiro Shimizu |
890ddd |
typedef Writer *WriterMaker();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
typedef VectorReader *VectorReaderMaker();
|
|
Toshihiro Shimizu |
890ddd |
typedef VectorWriter *VectorWriterMaker();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI Tiio::Reader *makeReader(std::string ext);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI Tiio::Writer *makeWriter(std::string ext);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI Tiio::VectorReader *makeVectorReader(std::string ext);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI Tiio::VectorWriter *makeVectorWriter(std::string ext);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI TPropertyGroup *makeWriterProperties(std::string ext);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void defineReaderMaker(const char *ext, Tiio::ReaderMaker *fn);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void defineWriterMaker(const char *ext, Tiio::WriterMaker *fn, bool isRenderFormat);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void defineVectorReaderMaker(const char *ext, Tiio::VectorReaderMaker *fn);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void defineVectorWriterMaker(const char *ext, Tiio::VectorWriterMaker *fn, bool isRenderFormat);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void defineWriterProperties(const char *ext, TPropertyGroup *);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI bool isQuicktimeInstalled();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} // namespace
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|