Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TIIO_PSD_INCLUDED
Toshihiro Shimizu 890ddd
#define TIIO_PSD_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "../../common/psdlib/psd.h"
Toshihiro Shimizu 890ddd
#include "tlevel_io.h"
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TLevelReaderPsd : public TLevelReader {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TLevelReaderPsd(const TFilePath &path);
Shinya Kitaoka 120a6e
  ~TLevelReaderPsd();
Shinya Kitaoka 473e70
  TImageReaderP getFrameReader(TFrameId fid) override;
Shinya Kitaoka 473e70
  TLevelP loadInfo() override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  const TImageInfo *getImageInfo(TFrameId fid) override { return m_info; }
Shinya Kitaoka 473e70
  const TImageInfo *getImageInfo() override { return m_info; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void load(TRasterImageP &rasP, int shrinkX = 1, int shrinkY = 1,
Shinya Kitaoka 120a6e
            TRect region = TRect());
Shinya Kitaoka 120a6e
  TDimension getSize() const { return TDimension(m_lx, m_ly); }
Shinya Kitaoka 120a6e
  TRect getBBox() const { return TRect(0, 0, m_lx - 1, m_ly - 1); }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setLayerId(int layerId) { m_layerId = layerId; }
Shinya Kitaoka 120a6e
  // int m_IOError;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  TFilePath m_path;
Shinya Kitaoka 120a6e
  int m_lx, m_ly;
Shinya Kitaoka 120a6e
  int m_layersCount;
Shinya Kitaoka 120a6e
  TPSDReader *m_psdreader;
Shinya Kitaoka 120a6e
  int m_layerId;
Shinya Kitaoka 120a6e
  std::map<tframeid, int=""> m_frameTable;  // frameID, layerId</tframeid,>
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  static TLevelReader *create(const TFilePath &f);
Shinya Kitaoka 120a6e
  TThread::Mutex m_mutex;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TLevelWriterPsd : public TLevelWriter {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TLevelWriterPsd(const TFilePath &path, TPropertyGroup *winfo);
Shinya Kitaoka 120a6e
  ~TLevelWriterPsd();
Shinya Kitaoka 473e70
  TImageWriterP getFrameWriter(TFrameId fid) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void save(const TImageP &img, int layerId);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  static TLevelWriter *create(const TFilePath &f, TPropertyGroup *winfo) {
Shinya Kitaoka 120a6e
    return new TLevelWriterPsd(f, winfo);
Shinya Kitaoka 120a6e
  };
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // TIIO_PSD_H