tahoma2d/toonz/sources/include/ttzpimagefx.h

198 lines
5.2 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 TTZPIMAGEFX_H
#define TTZPIMAGEFX_H
// TnzCore includes
#include "tpalette.h"
#include "trastercm.h"
// TnzBase includes
#include "trasterfxrenderdata.h"
// STD includes
#include <vector>
#include <set>
#include <string>
#undef DVAPI
#undef DVVAR
#ifdef TFX_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
//**********************************************************************************************
// ExternalPaletteFxRenderData declaration
//**********************************************************************************************
class DVAPI ExternalPaletteFxRenderData final : public TRasterFxRenderData {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TPaletteP m_palette;
std::string m_name;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
ExternalPaletteFxRenderData(TPaletteP palette, const std::string &name);
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
float typeIndex() const override { return 0.0f; }
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
bool operator==(const TRasterFxRenderData &data) const override;
std::string toString() const override;
2016-03-19 06:57:51 +13:00
};
//**********************************************************************************************
// PaletteFilterFxRenderData declaration
//**********************************************************************************************
2016-06-15 18:43:10 +12:00
enum FilterType {
eApplyToInksAndPaints = 0,
eApplyToInksKeepingAllPaints,
eApplyToPaintsKeepingAllInks,
eApplyToInksAndPaints_NoGap,
eApplyToInksDeletingAllPaints,
eApplyToPaintsDeletingAllInks
};
2016-03-19 06:57:51 +13:00
//------------------------------------------------------------------------------
class DVAPI PaletteFilterFxRenderData final : public TRasterFxRenderData {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
bool m_keep;
FilterType m_type;
std::set<int> m_colors;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
PaletteFilterFxRenderData();
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
float typeIndex() const override {
2016-06-15 18:43:10 +12:00
return (m_type == eApplyToInksAndPaints) ? 0.5f : 1.0f;
}
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
bool operator==(const TRasterFxRenderData &data) const override;
std::string toString() const override;
2016-03-19 06:57:51 +13:00
};
//------------------------------------------------------------------------------
2016-06-15 18:43:10 +12:00
void DVAPI insertIndexes(std::vector<std::string> items,
PaletteFilterFxRenderData *t);
void DVAPI parseIndexes(std::string indexes, std::vector<std::string> &items);
2016-03-19 06:57:51 +13:00
//**********************************************************************************************
// SandorFxRenderData (possible) parameters
//**********************************************************************************************
2016-06-15 18:43:10 +12:00
enum Type { BlendTz, Calligraphic, ArtAtContour, OutBorder };
2016-03-19 06:57:51 +13:00
//------------------------------------------------------------------------------
2016-06-15 18:43:10 +12:00
class DVAPI BlendTzParams {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
std::wstring m_colorIndex;
bool m_noBlending;
double m_amount;
double m_smoothness;
int m_superSampling;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
BlendTzParams()
: m_colorIndex(L"")
, m_noBlending(false)
, m_amount(0.0)
, m_smoothness(0.0)
, m_superSampling(0) {}
2016-03-19 06:57:51 +13:00
};
//------------------------------------------------------------------------------
2016-06-15 18:43:10 +12:00
class DVAPI CalligraphicParams {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
std::wstring m_colorIndex;
double m_thickness;
double m_horizontal;
double m_vertical;
double m_upWDiagonal;
double m_doWDiagonal;
double m_accuracy;
double m_noise;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
CalligraphicParams()
: m_thickness(0.0)
, m_horizontal(0.0)
, m_vertical(0.0)
, m_upWDiagonal(0.0)
, m_doWDiagonal(0.0)
, m_accuracy(0.0)
, m_noise(0.0)
, m_colorIndex(L"") {}
2016-03-19 06:57:51 +13:00
};
//------------------------------------------------------------------------------
2016-06-15 18:43:10 +12:00
class DVAPI ArtAtContourParams {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
double m_maxSize;
double m_minSize;
double m_maxOrientation;
double m_minOrientation;
bool m_randomness;
double m_maxDistance;
double m_minDistance;
double m_density;
bool m_keepLine;
bool m_keepColor;
bool m_includeAlpha;
std::wstring m_colorIndex;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
ArtAtContourParams()
: m_maxSize(0.0)
, m_minSize(0.0)
, m_maxOrientation(0.0)
, m_minOrientation(0.0)
, m_randomness(false)
, m_maxDistance(0.0)
, m_minDistance(0.0)
, m_density(0.0)
, m_keepLine(false)
, m_keepColor(false)
, m_includeAlpha(true)
, m_colorIndex(L"") {}
2016-03-19 06:57:51 +13:00
};
//**********************************************************************************************
// SandorFxRenderData declaration
//**********************************************************************************************
class DVAPI SandorFxRenderData final : public TRasterFxRenderData {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
Type m_type;
BlendTzParams m_blendParams;
CalligraphicParams m_callParams;
ArtAtContourParams m_contourParams;
int m_border, m_shrink;
int m_argc;
const char *m_argv[12];
TRectD m_controllerBBox;
TRasterP m_controller;
std::string m_controllerAlias;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
SandorFxRenderData(Type type, int argc, const char *argv[], int border,
int shrink, const TRectD &controllerBBox = TRectD(),
const TRasterP &controller = TRasterP());
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
float typeIndex() const override { return (m_type == BlendTz) ? 2.0f : 3.0f; }
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
bool operator==(const TRasterFxRenderData &data) const override;
std::string toString() const override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
TRectD getBBoxEnlargement(const TRectD &bbox) override;
2016-03-19 06:57:51 +13:00
};
#endif