tahoma2d/toonz/sources/include/tiio_jpg.h

74 lines
1.3 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef TTIO_JPG_INCLUDED
#define TTIO_JPG_INCLUDED
#include "tiio.h"
#include "tproperty.h"
#include <QCoreApplication>
2016-03-19 06:57:51 +13:00
extern "C" {
#define XMD_H
#include "jpeglib.h"
/*
* <setjmp.h> is used for the optional error recovery mechanism shown in
* the second part of the example.
*/
#include <setjmp.h>
}
#undef DVAPI
#ifdef TNZCORE_EXPORTS
#define DVAPI DV_EXPORT_API
#else
#define DVAPI DV_IMPORT_API
#endif
2016-06-15 18:43:10 +12:00
namespace Tiio {
2016-03-19 06:57:51 +13:00
class DVAPI JpgReader final : public Tiio::Reader {
2016-06-15 18:43:10 +12:00
struct jpeg_decompress_struct m_cinfo;
struct jpeg_error_mgr m_jerr;
FILE *m_chan;
JSAMPARRAY m_buffer;
bool m_isOpen;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
JpgReader();
~JpgReader();
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
Tiio::RowOrder getRowOrder() const override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void open(FILE *file) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void readLine(char *buffer, int x0, int x1, int shrink) override;
int skipLines(int lineCount) override;
2016-03-19 06:57:51 +13:00
};
DVAPI Tiio::ReaderMaker makeJpgReader;
DVAPI Tiio::WriterMaker makeJpgWriter;
class DVAPI JpgWriterProperties final : public TPropertyGroup {
Q_DECLARE_TR_FUNCTIONS(JpgWriterProperties)
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TIntProperty m_quality;
TIntProperty m_smoothing;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
static const std::string QUALITY;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
JpgWriterProperties()
: m_quality(QUALITY, 0, 100, 90), m_smoothing("Smoothing", 0, 100, 0) {
bind(m_quality);
bind(m_smoothing);
}
void updateTranslation() override;
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
} // namespace
2016-03-19 06:57:51 +13:00
#endif