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
shun-iwasawa e87e08
#include <qcoreapplication></qcoreapplication>
shun-iwasawa e87e08
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
Shinya Kitaoka 120a6e
namespace Tiio {
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI JpgReader final : public Tiio::Reader {
Shinya Kitaoka 120a6e
  struct jpeg_decompress_struct m_cinfo;
Shinya Kitaoka 120a6e
  struct jpeg_error_mgr m_jerr;
Shinya Kitaoka 120a6e
  FILE *m_chan;
Shinya Kitaoka 120a6e
  JSAMPARRAY m_buffer;
Shinya Kitaoka 120a6e
  bool m_isOpen;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  JpgReader();
Shinya Kitaoka 120a6e
  ~JpgReader();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  Tiio::RowOrder getRowOrder() const override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void open(FILE *file) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void readLine(char *buffer, int x0, int x1, int shrink) override;
Shinya Kitaoka 473e70
  int skipLines(int lineCount) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI Tiio::ReaderMaker makeJpgReader;
Toshihiro Shimizu 890ddd
DVAPI Tiio::WriterMaker makeJpgWriter;
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI JpgWriterProperties final : public TPropertyGroup {
shun-iwasawa e87e08
  Q_DECLARE_TR_FUNCTIONS(JpgWriterProperties)
shun-iwasawa e87e08
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TIntProperty m_quality;
Shinya Kitaoka 120a6e
  TIntProperty m_smoothing;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  static const std::string QUALITY;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  JpgWriterProperties()
Shinya Kitaoka 120a6e
      : m_quality(QUALITY, 0, 100, 90), m_smoothing("Smoothing", 0, 100, 0) {
Shinya Kitaoka 120a6e
    bind(m_quality);
Shinya Kitaoka 120a6e
    bind(m_smoothing);
Shinya Kitaoka 120a6e
  }
shun-iwasawa e87e08
shun-iwasawa e87e08
  void updateTranslation() override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
}  // namespace
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif