Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TOONZIMAGE_DATA_H
Toshihiro Shimizu 890ddd
#define TOONZIMAGE_DATA_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include "toonz/ttileset.h"
Toshihiro Shimizu 890ddd
#include "tpalette.h"
Toshihiro Shimizu 890ddd
#include "tstroke.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/dvmimedata.h"
Toshihiro Shimizu 890ddd
#include "ttoonzimage.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <set></set>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TOONZQT_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 TTileSetCM32;
Toshihiro Shimizu 890ddd
class StrokesData;
Toshihiro Shimizu 890ddd
class ToonzScene;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//===================================================================
Toshihiro Shimizu 890ddd
// RasterImageData
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class RasterImageData : public DvMimeData {
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  double m_dpiX, m_dpiY;
Shinya Kitaoka 120a6e
  std::vector<trectd> m_rects;</trectd>
Shinya Kitaoka 120a6e
  std::vector<tstroke> m_strokes;</tstroke>
Shinya Kitaoka 120a6e
  std::vector<tstroke> m_originalStrokes;</tstroke>
Shinya Kitaoka 120a6e
  TAffine m_transformation;
Shinya Kitaoka 120a6e
  TDimension m_dim;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  RasterImageData();
Shinya Kitaoka 120a6e
  ~RasterImageData();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual void setData(const TRasterP &copiedRaster, const TPaletteP &palette,
Shinya Kitaoka 120a6e
                       double dpiX, double dpiY, const TDimension &dim,
Shinya Kitaoka 120a6e
                       const std::vector<trectd> &rects,</trectd>
Shinya Kitaoka 120a6e
                       const std::vector<tstroke> &strokes,</tstroke>
Shinya Kitaoka 120a6e
                       const std::vector<tstroke> &originalStrokes,</tstroke>
Shinya Kitaoka 120a6e
                       const TAffine &transformation) = 0;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual void getData(TRasterP &copiedRaster, double &dpiX, double &dpiY,
Shinya Kitaoka 120a6e
                       std::vector<trectd> &rects,</trectd>
Shinya Kitaoka 120a6e
                       std::vector<tstroke> &strokes,</tstroke>
Shinya Kitaoka 120a6e
                       std::vector<tstroke> &originalStrokes,</tstroke>
Shinya Kitaoka 120a6e
                       TAffine &transformation,
Shinya Kitaoka 120a6e
                       TPalette *targetPalette) const = 0;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual StrokesData *toStrokesData(ToonzScene *scene) const = 0;
Shinya Kitaoka 120a6e
  virtual TPointD getDpi() const                              = 0;
Shinya Kitaoka 120a6e
  TDimension getDim() const { return m_dim; }
Shinya Kitaoka 473e70
Shinya Kitaoka 473e70
  RasterImageData *clone() const override = 0;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Necessary for undo purpose!!!!
Shinya Kitaoka 120a6e
  virtual int getMemorySize() const = 0;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//===================================================================
Toshihiro Shimizu 890ddd
// ToonzImageData
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
/*-- SelectionToolで選択した画像のデータ --*/
Shinya Kitaoka d1f6c4
class DVAPI ToonzImageData final : public RasterImageData {
Shinya Kitaoka 120a6e
  TRasterCM32P m_copiedRaster;
Shinya Kitaoka 120a6e
  TPaletteP m_palette;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  std::set<int> m_usedStyles;</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToonzImageData();
Shinya Kitaoka 120a6e
  ToonzImageData(const ToonzImageData &);
Shinya Kitaoka 120a6e
  ~ToonzImageData();
Shinya Kitaoka 120a6e
  // data <- floating ti;
Shinya Kitaoka 120a6e
  void setData(const TRasterP &copiedRaster, const TPaletteP &palette,
Shinya Kitaoka 120a6e
               double dpiX, double dpiY, const TDimension &dim,
Shinya Kitaoka 120a6e
               const std::vector<trectd> &rects,</trectd>
Shinya Kitaoka 120a6e
               const std::vector<tstroke> &strokes,</tstroke>
Shinya Kitaoka 120a6e
               const std::vector<tstroke> &originalStrokes,</tstroke>
Shinya Kitaoka 473e70
               const TAffine &transformation) override;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // floating ti <- data;
Shinya Kitaoka 120a6e
  void getData(TRasterP &copiedRaster, double &dpiX, double &dpiY,
Shinya Kitaoka 120a6e
               std::vector<trectd> &rects, std::vector<tstroke> &strokes,</tstroke></trectd>
Shinya Kitaoka 120a6e
               std::vector<tstroke> &originalStrokes, TAffine &transformation,</tstroke>
Shinya Kitaoka 473e70
               TPalette *targetPalette) const override;
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  StrokesData *toStrokesData(ToonzScene *scene) const override;
Shinya Kitaoka 473e70
  TPointD getDpi() const override { return TPointD(m_dpiX, m_dpiY); }
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  ToonzImageData *clone() const override { return new ToonzImageData(*this); }
Shinya Kitaoka 473e70
  int getMemorySize() const override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//===================================================================
Toshihiro Shimizu 890ddd
// FullColorImageData
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI FullColorImageData final : public RasterImageData {
Shinya Kitaoka 120a6e
  TRasterP m_copiedRaster;
Shinya Kitaoka 120a6e
  TPaletteP m_palette;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  FullColorImageData();
Shinya Kitaoka 120a6e
  FullColorImageData(const FullColorImageData &);
Shinya Kitaoka 120a6e
  ~FullColorImageData();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // data <- floating ti;
Shinya Kitaoka 120a6e
  void setData(const TRasterP &copiedRaster, const TPaletteP &palette,
Shinya Kitaoka 120a6e
               double dpiX, double dpiY, const TDimension &dim,
Shinya Kitaoka 120a6e
               const std::vector<trectd> &rects,</trectd>
Shinya Kitaoka 120a6e
               const std::vector<tstroke> &strokes,</tstroke>
Shinya Kitaoka 120a6e
               const std::vector<tstroke> &originalStrokes,</tstroke>
Shinya Kitaoka 473e70
               const TAffine &transformation) override;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // floating ti <- data;
Shinya Kitaoka 120a6e
  void getData(TRasterP &copiedRaster, double &dpiX, double &dpiY,
Shinya Kitaoka 120a6e
               std::vector<trectd> &rects, std::vector<tstroke> &strokes,</tstroke></trectd>
Shinya Kitaoka 120a6e
               std::vector<tstroke> &originalStrokes, TAffine &transformation,</tstroke>
Shinya Kitaoka 473e70
               TPalette *targetPalette) const override;
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  StrokesData *toStrokesData(ToonzScene *scene) const override;
Shinya Kitaoka 473e70
  TPointD getDpi() const override { return TPointD(m_dpiX, m_dpiY); }
Shinya Kitaoka 120a6e
Shinya Kitaoka 38fd86
  FullColorImageData *clone() const override {
Shinya Kitaoka 38fd86
    return new FullColorImageData(*this);
Shinya Kitaoka 38fd86
  }
Shinya Kitaoka 473e70
  int getMemorySize() const override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif