tahoma2d/toonz/sources/include/toonzqt/rasterimagedata.h

142 lines
4.6 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 TOONZIMAGE_DATA_H
#define TOONZIMAGE_DATA_H
#include "tcommon.h"
#include "toonz/ttileset.h"
#include "tpalette.h"
#include "tstroke.h"
#include "toonzqt/dvmimedata.h"
#include "ttoonzimage.h"
#include <set>
#undef DVAPI
#undef DVVAR
#ifdef TOONZQT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
class TTileSetCM32;
class StrokesData;
class ToonzScene;
//===================================================================
// RasterImageData
//-------------------------------------------------------------------
2016-06-15 18:43:10 +12:00
class RasterImageData : public DvMimeData {
2016-03-19 06:57:51 +13:00
protected:
2016-06-15 18:43:10 +12:00
double m_dpiX, m_dpiY;
std::vector<TRectD> m_rects;
std::vector<TStroke> m_strokes;
std::vector<TStroke> m_originalStrokes;
TAffine m_transformation;
TDimension m_dim;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
RasterImageData();
~RasterImageData();
virtual void setData(const TRasterP &copiedRaster, const TPaletteP &palette,
double dpiX, double dpiY, const TDimension &dim,
const std::vector<TRectD> &rects,
const std::vector<TStroke> &strokes,
const std::vector<TStroke> &originalStrokes,
const TAffine &transformation) = 0;
virtual void getData(TRasterP &copiedRaster, double &dpiX, double &dpiY,
std::vector<TRectD> &rects,
std::vector<TStroke> &strokes,
std::vector<TStroke> &originalStrokes,
TAffine &transformation,
TPalette *targetPalette) const = 0;
virtual StrokesData *toStrokesData(ToonzScene *scene) const = 0;
virtual TPointD getDpi() const = 0;
TDimension getDim() const { return m_dim; }
2016-06-19 20:06:29 +12:00
RasterImageData *clone() const override = 0;
2016-06-15 18:43:10 +12:00
// Necessary for undo purpose!!!!
virtual int getMemorySize() const = 0;
2016-03-19 06:57:51 +13:00
};
//===================================================================
// ToonzImageData
//-------------------------------------------------------------------
/*-- SelectionToolで選択した画像のデータ --*/
class DVAPI ToonzImageData final : public RasterImageData {
2016-06-15 18:43:10 +12:00
TRasterCM32P m_copiedRaster;
TPaletteP m_palette;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
std::set<int> m_usedStyles;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
ToonzImageData();
ToonzImageData(const ToonzImageData &);
~ToonzImageData();
// data <- floating ti;
void setData(const TRasterP &copiedRaster, const TPaletteP &palette,
double dpiX, double dpiY, const TDimension &dim,
const std::vector<TRectD> &rects,
const std::vector<TStroke> &strokes,
const std::vector<TStroke> &originalStrokes,
2016-06-19 20:06:29 +12:00
const TAffine &transformation) override;
2016-06-15 18:43:10 +12:00
// floating ti <- data;
void getData(TRasterP &copiedRaster, double &dpiX, double &dpiY,
std::vector<TRectD> &rects, std::vector<TStroke> &strokes,
std::vector<TStroke> &originalStrokes, TAffine &transformation,
2016-06-19 20:06:29 +12:00
TPalette *targetPalette) const override;
2016-06-15 18:43:10 +12:00
2016-06-19 20:06:29 +12:00
StrokesData *toStrokesData(ToonzScene *scene) const override;
TPointD getDpi() const override { return TPointD(m_dpiX, m_dpiY); }
2016-06-15 18:43:10 +12:00
2016-06-19 20:06:29 +12:00
ToonzImageData *clone() const override { return new ToonzImageData(*this); }
int getMemorySize() const override;
2016-03-19 06:57:51 +13:00
};
//===================================================================
// FullColorImageData
//-------------------------------------------------------------------
class DVAPI FullColorImageData final : public RasterImageData {
2016-06-15 18:43:10 +12:00
TRasterP m_copiedRaster;
TPaletteP m_palette;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
FullColorImageData();
FullColorImageData(const FullColorImageData &);
~FullColorImageData();
// data <- floating ti;
void setData(const TRasterP &copiedRaster, const TPaletteP &palette,
double dpiX, double dpiY, const TDimension &dim,
const std::vector<TRectD> &rects,
const std::vector<TStroke> &strokes,
const std::vector<TStroke> &originalStrokes,
2016-06-19 20:06:29 +12:00
const TAffine &transformation) override;
2016-06-15 18:43:10 +12:00
// floating ti <- data;
void getData(TRasterP &copiedRaster, double &dpiX, double &dpiY,
std::vector<TRectD> &rects, std::vector<TStroke> &strokes,
std::vector<TStroke> &originalStrokes, TAffine &transformation,
2016-06-19 20:06:29 +12:00
TPalette *targetPalette) const override;
2016-06-15 18:43:10 +12:00
2016-06-19 20:06:29 +12:00
StrokesData *toStrokesData(ToonzScene *scene) const override;
TPointD getDpi() const override { return TPointD(m_dpiX, m_dpiY); }
2016-06-15 18:43:10 +12:00
2016-06-20 14:23:05 +12:00
FullColorImageData *clone() const override {
return new FullColorImageData(*this);
}
2016-06-19 20:06:29 +12:00
int getMemorySize() const override;
2016-03-19 06:57:51 +13:00
};
#endif