Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tnzimage.h"
Toshihiro Shimizu 890ddd
#include "tiio.h"
Toshihiro Shimizu 890ddd
#include "tfiletype.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Shinya Kitaoka 120a6e
    TImageReader::load MUST throw an exception in case of error (file not found,
Shinya Kitaoka 120a6e
   ...)
Shinya Kitaoka 120a6e
    TImageWriter::save MUST throw an exception in case of error (write denied,
Shinya Kitaoka 120a6e
                                                                 disk full, ...)
Toshihiro Shimizu 890ddd
    N.B.: gestire nei TImageWriter il caso "disk full"!!!
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
// Math needs to be included before the rest on MAC - but I've not figured out
Shinya Kitaoka 120a6e
// why (it would be included anyway though)
Toshihiro Shimizu 890ddd
#include <math.h></math.h>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
// Platform-specific includes
Campbell Barton d869b5
#if defined(_WIN32)
Toshihiro Shimizu 890ddd
db7f14
#if !defined(x64) && !defined(__GNUC__)
Shinya Kitaoka 6526c7
Shinya Kitaoka fd19c4
#define list QuickTime_list
Shinya Kitaoka fd19c4
#define map QuickTime_map
Shinya Kitaoka fd19c4
#define iterator QuickTime_iterator
Shinya Kitaoka fd19c4
#define float_t QuickTime_float_t
Shinya Kitaoka fd19c4
#define GetProcessInformation QuickTime_GetProcessInformation
Shinya Kitaoka fd19c4
#define int_fast8_t QuickTime_int_fast8_t
Shinya Kitaoka fd19c4
#define int_fast16_t QuickTime_int_fast16_t
Shinya Kitaoka fd19c4
#define uint_fast16_t QuickTime_uint_fast16_t
Shinya Kitaoka 6526c7
Toshihiro Shimizu 890ddd
#include "QuickTimeComponents.h"
Toshihiro Shimizu 890ddd
#include "tquicktime.h"
Shinya Kitaoka 6526c7
Shinya Kitaoka fd19c4
#undef list
Shinya Kitaoka fd19c4
#undef map
Shinya Kitaoka fd19c4
#undef iterator
Toshihiro Shimizu 890ddd
#undef float_t
Toshihiro Shimizu 890ddd
#undef GetProcessInformation
Shinya Kitaoka fd19c4
#undef int_fast8_t
Shinya Kitaoka fd19c4
#undef int_fast16_t
Shinya Kitaoka fd19c4
#undef uint_fast16_t
Shinya Kitaoka 6526c7
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "./mov/tiio_mov.h"
Toshihiro Shimizu 890ddd
#include "./3gp/tiio_3gp.h"
Toshihiro Shimizu 890ddd
#include "./zcc/tiio_zcc.h"
Toshihiro Shimizu 890ddd
Campbell Barton d869b5
#elif defined(MACOSX)
Toshihiro Shimizu 890ddd
#include "./mov/tiio_movM.h"
Toshihiro Shimizu 890ddd
#include "./3gp/tiio_3gpM.h"
Toshihiro Shimizu 890ddd
Campbell Barton d869b5
#elif defined(LINUX)  // No more supported by the way...
Campbell Barton 89a491
// #include "./mov/tiio_movL.h"
Campbell Barton 89a491
#include "./mov/tiio_mov_proxy.h"
Campbell Barton 89a491
#include "./3gp/tiio_3gp_proxy.h"
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
// Common includes
Toshihiro Shimizu 890ddd
#include "./quantel/tiio_quantel.h"
Toshihiro Shimizu 890ddd
#include "./sgi/tiio_sgi.h"
Toshihiro Shimizu 890ddd
#include "./tga/tiio_tga.h"
Toshihiro Shimizu 890ddd
#include "./png/tiio_png.h"
Toshihiro Shimizu 890ddd
#include "./tif/tiio_tif.h"
Toshihiro Shimizu 890ddd
#include "./tzp/tiio_tzp.h"
Toshihiro Shimizu 890ddd
#include "./tzp/tiio_plt.h"
Toshihiro Shimizu 890ddd
#include "./psd/tiio_psd.h"
Toshihiro Shimizu 890ddd
#include "./avi/tiio_avi.h"
Toshihiro Shimizu 890ddd
#include "./pli/tiio_pli.h"
Toshihiro Shimizu 890ddd
#include "./tzl/tiio_tzl.h"
Toshihiro Shimizu 890ddd
#include "./svg/tiio_svg.h"
turtletooth 04d8fd
#include "./ffmpeg/tiio_gif.h"
turtletooth 04d8fd
#include "./ffmpeg/tiio_webm.h"
turtletooth 04d8fd
#include "./ffmpeg/tiio_mp4.h"
Toshihiro Shimizu 890ddd
#include "./mesh/tiio_mesh.h"
Jeremy Bullock 764038
#include "./sprite/tiio_sprite.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// static TPluginInfo info("imageIOPlugin");
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TLIBMAIN
Shinya Kitaoka 120a6e
void initImageIo(bool lightVersion) {
Shinya Kitaoka 120a6e
  if (!lightVersion) {
Shinya Kitaoka 120a6e
    TLevelWriter::define("pli", TLevelWriterPli::create, false);
Shinya Kitaoka 120a6e
    TLevelReader::define("pli", TLevelReaderPli::create);
Shinya Kitaoka 120a6e
    TFileType::declare("pli", TFileType::VECTOR_LEVEL);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    TLevelReader::define("svg", 0, TLevelReaderSvg::create);
Shinya Kitaoka 120a6e
    TFileType::declare("svg", TFileType::VECTOR_LEVEL);
Shinya Kitaoka 120a6e
    TLevelWriter::define("svg", TLevelWriterSvg::create, false);
Shinya Kitaoka 120a6e
    Tiio::defineWriterProperties("svg", new Tiio::SvgWriterProperties());
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    TLevelWriter::define("tzl", TLevelWriterTzl::create, false);
Shinya Kitaoka 120a6e
    TLevelReader::define("tzl", TLevelReaderTzl::create);
Shinya Kitaoka 120a6e
    TFileType::declare("tzl", TFileType::RASTER_LEVEL);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    TLevelWriter::define("tlv", TLevelWriterTzl::create, false);
Shinya Kitaoka 120a6e
    TLevelReader::define("tlv", TLevelReaderTzl::create);
Shinya Kitaoka 120a6e
    TFileType::declare("tlv", TFileType::CMAPPED_LEVEL);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    Tiio::defineReaderMaker("tzp", Tiio::makeTzpReader);
Shinya Kitaoka 120a6e
    Tiio::defineWriterMaker("tzp", Tiio::makeTzpWriter, false);
Shinya Kitaoka 120a6e
    TFileType::declare("tzp", TFileType::CMAPPED_IMAGE);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    Tiio::defineReaderMaker("tzu", Tiio::makeTzpReader);
Shinya Kitaoka 120a6e
    Tiio::defineWriterMaker("tzu", Tiio::makeTzpWriter, false);
Shinya Kitaoka 120a6e
    TFileType::declare("tzu", TFileType::CMAPPED_IMAGE);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    Tiio::defineReaderMaker("tzi", Tiio::makeTziReader);
Shinya Kitaoka 120a6e
    TFileType::declare("tzi", TFileType::RASTER_IMAGE);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    Tiio::defineReaderMaker("plt", Tiio::makePltReader);
Shinya Kitaoka 120a6e
    Tiio::defineWriterMaker("plt", Tiio::makePltWriter, false);
Shinya Kitaoka 120a6e
    TFileType::declare("plt", TFileType::RASTER_IMAGE);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    Tiio::defineReaderMaker("nol", Tiio::makePngReader);
Shinya Kitaoka 120a6e
    Tiio::defineWriterMaker("nol", Tiio::makePngWriter, true);
Shinya Kitaoka 120a6e
    TFileType::declare("nol", TFileType::RASTER_IMAGE);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    TLevelWriter::define("psd", TLevelWriterPsd::create, false);
Shinya Kitaoka 120a6e
    TLevelReader::define("psd", TLevelReaderPsd::create);
Shinya Kitaoka 120a6e
    TFileType::declare("psd", TFileType::RASTER_LEVEL);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    TLevelWriter::define("mesh", TLevelWriterMesh::create, false);
Shinya Kitaoka 120a6e
    TLevelReader::define("mesh", TLevelReaderMesh::create);
Shinya Kitaoka 120a6e
    TFileType::declare("mesh", TFileType::MESH_IMAGE);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  }  // !lightversion
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TFileType::declare("tpl", TFileType::PALETTE_LEVEL);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  Tiio::defineReaderMaker("png", Tiio::makePngReader);
Shinya Kitaoka 120a6e
  Tiio::defineWriterMaker("png", Tiio::makePngWriter, true);
Shinya Kitaoka 120a6e
  TFileType::declare("png", TFileType::RASTER_IMAGE);
Shinya Kitaoka 120a6e
  Tiio::defineWriterProperties("png", new Tiio::PngWriterProperties());
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  Tiio::defineReaderMaker("tga", Tiio::makeTgaReader);
Shinya Kitaoka 120a6e
  Tiio::defineWriterMaker("tga", Tiio::makeTgaWriter, true);
Shinya Kitaoka 120a6e
  TFileType::declare("tga", TFileType::RASTER_IMAGE);
Shinya Kitaoka 120a6e
  Tiio::defineWriterProperties("tga", new Tiio::TgaWriterProperties());
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  Tiio::defineReaderMaker("tif", Tiio::makeTifReader);
Shinya Kitaoka 120a6e
  Tiio::defineWriterMaker("tif", Tiio::makeTifWriter, true);
Shinya Kitaoka 120a6e
  TFileType::declare("tif", TFileType::RASTER_IMAGE);
Shinya Kitaoka 120a6e
  Tiio::defineWriterProperties("tif", new Tiio::TifWriterProperties());
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  Tiio::defineReaderMaker("tiff", Tiio::makeTifReader);
Shinya Kitaoka 120a6e
  Tiio::defineWriterMaker("tiff", Tiio::makeTifWriter, true);
Shinya Kitaoka 120a6e
  TFileType::declare("tiff", TFileType::RASTER_IMAGE);
Shinya Kitaoka 120a6e
  Tiio::defineWriterProperties("tiff", new Tiio::TifWriterProperties());
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  Tiio::defineReaderMaker("sgi", Tiio::makeSgiReader);
Shinya Kitaoka 120a6e
  Tiio::defineWriterMaker("sgi", Tiio::makeSgiWriter, true);
Shinya Kitaoka 120a6e
  TFileType::declare("sgi", TFileType::RASTER_IMAGE);
Shinya Kitaoka 120a6e
  Tiio::defineWriterProperties("sgi", new Tiio::SgiWriterProperties());
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  Tiio::defineReaderMaker("rgb", Tiio::makeSgiReader);
Shinya Kitaoka 120a6e
  Tiio::defineWriterMaker("rgb", Tiio::makeSgiWriter, true);
Shinya Kitaoka 120a6e
  TFileType::declare("rgb", TFileType::RASTER_IMAGE);
Shinya Kitaoka 120a6e
  Tiio::defineWriterProperties("rgb", new Tiio::SgiWriterProperties());
Shinya Kitaoka 120a6e
Jeremy Bullock 764038
  TLevelWriter::define("spritesheet", TLevelWriterSprite::create, true);
Jeremy Bullock 764038
  TFileType::declare("spritesheet", TFileType::RASTER_LEVEL);
Jeremy Bullock 764038
  Tiio::defineWriterProperties("spritesheet",
Jeremy Bullock 764038
                               new Tiio::SpriteWriterProperties());
Jeremy Bullock 764038
shun-iwasawa 27b0cf
// ffmpeg
db7f14
#if !defined(_WIN32) || defined(x64) || (defined(_WIN32) && defined(__GNUC__))
turtletooth 04d8fd
  if (Ffmpeg::checkFfmpeg()) {
shun-iwasawa 27b0cf
    bool ffprobe = Ffmpeg::checkFfprobe();
shun-iwasawa 27b0cf
    if (Ffmpeg::checkFormat("webm")) {
shun-iwasawa 27b0cf
      TLevelWriter::define("webm", TLevelWriterWebm::create, true);
shun-iwasawa 27b0cf
      if (ffprobe) TLevelReader::define("webm", TLevelReaderWebm::create);
shun-iwasawa 27b0cf
      TFileType::declare("webm", TFileType::RASTER_LEVEL);
shun-iwasawa 27b0cf
      Tiio::defineWriterProperties("webm", new Tiio::WebmWriterProperties());
shun-iwasawa 27b0cf
    }
shun-iwasawa 27b0cf
    if (Ffmpeg::checkFormat("gif")) {
shun-iwasawa 27b0cf
      TLevelWriter::define("gif", TLevelWriterGif::create, true);
shun-iwasawa 27b0cf
      if (ffprobe) TLevelReader::define("gif", TLevelReaderGif::create);
shun-iwasawa 27b0cf
      TFileType::declare("gif", TFileType::RASTER_LEVEL);
shun-iwasawa 27b0cf
      Tiio::defineWriterProperties("gif", new Tiio::GifWriterProperties());
shun-iwasawa 27b0cf
    }
shun-iwasawa 27b0cf
    if (Ffmpeg::checkFormat("mp4")) {
shun-iwasawa 27b0cf
      TLevelWriter::define("mp4", TLevelWriterMp4::create, true);
shun-iwasawa 27b0cf
      if (ffprobe) TLevelReader::define("mp4", TLevelReaderMp4::create);
shun-iwasawa 27b0cf
      TFileType::declare("mp4", TFileType::RASTER_LEVEL);
shun-iwasawa 27b0cf
      Tiio::defineWriterProperties("mp4", new Tiio::Mp4WriterProperties());
shun-iwasawa 27b0cf
    }
turtletooth 04d8fd
  }
turtletooth 04d8fd
#endif
turtletooth 04d8fd
  // end ffmpeg
turtletooth 04d8fd
Shinya Kitaoka 120a6e
  if (!lightVersion) {
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    TLevelWriter::define("avi", TLevelWriterAvi::create, true);
Shinya Kitaoka 120a6e
    TLevelReader::define("avi", TLevelReaderAvi::create);
Shinya Kitaoka 120a6e
    TFileType::declare("avi", TFileType::RASTER_LEVEL);
Shinya Kitaoka 120a6e
    Tiio::defineWriterProperties("avi", new Tiio::AviWriterProperties());
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // _WIN32
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    if (IsQuickTimeInstalled()) {
Shinya Kitaoka 120a6e
      TLevelWriter::define("mov", TLevelWriterMov::create, true);
Shinya Kitaoka 120a6e
      TLevelReader::define("mov", TLevelReaderMov::create);
Shinya Kitaoka 120a6e
      TFileType::declare("mov", TFileType::RASTER_LEVEL);
Shinya Kitaoka 120a6e
      Tiio::defineWriterProperties("mov", new Tiio::MovWriterProperties());
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
      TLevelWriter::define("3gp", TLevelWriter3gp::create, true);
Shinya Kitaoka 120a6e
      TLevelReader::define("3gp", TLevelReader3gp::create);
Shinya Kitaoka 120a6e
      TFileType::declare("3gp", TFileType::RASTER_LEVEL);
Shinya Kitaoka 120a6e
      Tiio::defineWriterProperties("3gp", new Tiio::MovWriterProperties());
Shinya Kitaoka 120a6e
    }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    /*
Shinya Kitaoka 9f5a1b
#if (defined(_WIN32) && !defined(x64))
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TLevelWriter::define("pct", TLevelWriterPicPct::create, true);
Shinya Kitaoka 120a6e
TLevelReader::define("pct", TLevelReaderPicPct::create);
Shinya Kitaoka 120a6e
TFileType::declare("pct", TFileType::RASTER_LEVEL);
Shinya Kitaoka 120a6e
Tiio::defineWriterProperties("pct", new Tiio::PctWriterProperties());
Shinya Kitaoka 120a6e
TLevelWriter::define("pic", TLevelWriterPicPct::create, true);
Shinya Kitaoka 120a6e
TLevelReader::define("pic", TLevelReaderPicPct::create);
Shinya Kitaoka 120a6e
TFileType::declare("pic", TFileType::RASTER_LEVEL);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TLevelWriter::define("pict", TLevelWriterPicPct::create, true);
Shinya Kitaoka 120a6e
TLevelReader::define("pict", TLevelReaderPicPct::create);
Shinya Kitaoka 120a6e
TFileType::declare("pict", TFileType::RASTER_LEVEL);
Shinya Kitaoka 120a6e
Tiio::defineWriterProperties("pict", new Tiio::PctWriterProperties());
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#endif    // _WIN32 && 32-bit
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}