|
shun-iwasawa |
13c4cf |
#pragma once
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
#ifndef FLOWLINESTROKESTYLE_H
|
|
shun-iwasawa |
13c4cf |
#define FLOWLINESTROKESTYLE_H
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
// TnzCore includes
|
|
shun-iwasawa |
13c4cf |
#include "tsimplecolorstyles.h"
|
|
shun-iwasawa |
13c4cf |
#include "tvectorimage.h"
|
|
shun-iwasawa |
13c4cf |
#include "tstrokeprop.h"
|
|
shun-iwasawa |
13c4cf |
#include "tgl.h"
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
#include "toonz/imagestyles.h"
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
#include <QImage>
|
|
shun-iwasawa |
13c4cf |
class TVectorRendeData;
|
|
shun-iwasawa |
13c4cf |
class TRandom;
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
#undef DVAPI
|
|
shun-iwasawa |
13c4cf |
#undef DVVAR
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
#ifdef COLORFX_EXPORTS
|
|
shun-iwasawa |
13c4cf |
#define DVAPI DV_EXPORT_API
|
|
shun-iwasawa |
13c4cf |
#define DVVAR DV_EXPORT_VAR
|
|
shun-iwasawa |
13c4cf |
#else
|
|
shun-iwasawa |
13c4cf |
#define DVAPI DV_IMPORT_API
|
|
shun-iwasawa |
13c4cf |
#define DVVAR DV_IMPORT_VAR
|
|
shun-iwasawa |
13c4cf |
#endif
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
class FlowLineStrokeStyle final : public TSimpleStrokeStyle {
|
|
shun-iwasawa |
13c4cf |
TPixel32 m_color;
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
enum PARAMID {
|
|
shun-iwasawa |
13c4cf |
Density = 0,
|
|
shun-iwasawa |
13c4cf |
Extension,
|
|
shun-iwasawa |
13c4cf |
WidthScale,
|
|
shun-iwasawa |
13c4cf |
StraightenEnds,
|
|
shun-iwasawa |
13c4cf |
ParamCount
|
|
shun-iwasawa |
13c4cf |
};
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
// thin line's density ×ü̧x
|
|
shun-iwasawa |
13c4cf |
double m_density;
|
|
shun-iwasawa |
13c4cf |
// extend the edges [ÌLηÊ
|
|
shun-iwasawa |
13c4cf |
double m_extension;
|
|
shun-iwasawa |
13c4cf |
// extend the widths
|
|
shun-iwasawa |
13c4cf |
// ÌgåB³ÌüÌðâ·ÆregionÌvZÉcåÈÔª©©é
|
|
shun-iwasawa |
13c4cf |
double m_widthScale;
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
bool m_straightenEnds;
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
public:
|
|
shun-iwasawa |
13c4cf |
FlowLineStrokeStyle();
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
TColorStyle *clone() const override;
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
void invalidate() {}
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
QString getDescription() const override {
|
|
shun-iwasawa |
13c4cf |
return QCoreApplication::translate("FlowLineStrokeStyle", "Flow Line");
|
|
shun-iwasawa |
13c4cf |
}
|
|
shun-iwasawa |
13c4cf |
std::string getBrushIdName() const override { return "FlowLineStrokeStyle"; }
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
bool hasMainColor() const override { return true; }
|
|
shun-iwasawa |
13c4cf |
TPixel32 getMainColor() const override { return m_color; }
|
|
shun-iwasawa |
13c4cf |
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
int getParamCount() const override;
|
|
shun-iwasawa |
13c4cf |
TColorStyle::ParamType getParamType(int index) const override;
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
QString getParamNames(int index) const override;
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
void getParamRange(int index, double &min, double &max) const override;
|
|
shun-iwasawa |
13c4cf |
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
shun-iwasawa |
13c4cf |
void setParamValue(int index, double value) override;
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
bool getParamValue(TColorStyle::bool_tag, int index) const override;
|
|
shun-iwasawa |
13c4cf |
void setParamValue(int index, bool value) override;
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
void drawStroke(const TColorFunction *cf,
|
|
shun-iwasawa |
13c4cf |
const TStroke *stroke) const override;
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
void loadData(TInputStreamInterface &is) override {
|
|
shun-iwasawa |
13c4cf |
int straightenEnds;
|
|
shun-iwasawa |
13c4cf |
is >> m_color >> m_density >> m_extension >> m_widthScale >> straightenEnds;
|
|
shun-iwasawa |
13c4cf |
m_straightenEnds = (straightenEnds == 0) ? false : true;
|
|
shun-iwasawa |
13c4cf |
}
|
|
shun-iwasawa |
13c4cf |
void saveData(TOutputStreamInterface &os) const override {
|
|
shun-iwasawa |
13c4cf |
int straightenEnds = m_straightenEnds ? 1 : 0;
|
|
shun-iwasawa |
13c4cf |
os << m_color << m_density << m_extension << m_widthScale
|
|
shun-iwasawa |
13c4cf |
<< m_straightenEnds;
|
|
shun-iwasawa |
13c4cf |
}
|
|
shun-iwasawa |
13c4cf |
bool isSaveSupported() { return true; }
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
int getTagId() const override { return 201; }
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
TRectD getStrokeBBox(const TStroke *stroke) const override;
|
|
shun-iwasawa |
13c4cf |
};
|
|
shun-iwasawa |
13c4cf |
|
|
shun-iwasawa |
13c4cf |
#endif // FLOWLINESTROKESTYLE_H
|