2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef STROKESTYLES_H
|
|
|
|
#define STROKESTYLES_H
|
|
|
|
|
|
|
|
// TnzCore includes
|
|
|
|
#include "tsimplecolorstyles.h"
|
|
|
|
#include "tvectorimage.h"
|
|
|
|
#include "tstrokeprop.h"
|
|
|
|
#include "tgl.h"
|
|
|
|
|
|
|
|
class TVectorRendeData;
|
|
|
|
class TRandom;
|
|
|
|
|
|
|
|
#undef DVAPI
|
|
|
|
#undef DVVAR
|
|
|
|
|
|
|
|
#ifdef COLORFX_EXPORTS
|
|
|
|
#define DVAPI DV_EXPORT_API
|
|
|
|
#define DVVAR DV_EXPORT_VAR
|
|
|
|
#else
|
|
|
|
#define DVAPI DV_IMPORT_API
|
|
|
|
#define DVVAR DV_IMPORT_VAR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
typedef struct {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPointD point;
|
|
|
|
double dbl1;
|
|
|
|
double dbl2;
|
2016-03-19 06:57:51 +13:00
|
|
|
} PointAnd2Double;
|
|
|
|
|
2016-04-19 19:32:17 +12:00
|
|
|
typedef std::vector<TPointD> Points;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
typedef struct {
|
2016-06-15 18:43:10 +12:00
|
|
|
float blend;
|
|
|
|
Points points;
|
2016-03-19 06:57:51 +13:00
|
|
|
} BlendAndPoint;
|
|
|
|
|
2016-04-19 19:32:17 +12:00
|
|
|
typedef std::vector<std::pair<TPointD, TPixel32>> PointsAndColors;
|
|
|
|
typedef std::vector<Points> PointMatrix;
|
|
|
|
typedef std::vector<std::pair<TPointD, double>> PointsAndDoubles;
|
|
|
|
typedef std::vector<std::pair<GLenum, Points>> DrawmodePointsMatrix;
|
|
|
|
typedef std::vector<TRectD> RectVector;
|
|
|
|
typedef std::vector<PointAnd2Double> PointsAnd2Doubles;
|
|
|
|
typedef std::vector<double> Doubles;
|
|
|
|
typedef std::vector<BlendAndPoint> BlendAndPoints;
|
2016-03-19 06:57:51 +13:00
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
template <class T>
|
2016-06-15 18:43:10 +12:00
|
|
|
class TOptimizedStrokeStyleT : public TColorStyle {
|
2016-03-19 06:57:51 +13:00
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TOptimizedStrokeStyleT() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool isRegionStyle() const override { return false; }
|
|
|
|
bool isStrokeStyle() const override { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TStrokeProp *makeStrokeProp(const TStroke *stroke) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TRegionProp *makeRegionProp(const TRegion *region) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
assert(false);
|
|
|
|
return 0;
|
|
|
|
};
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
virtual void computeData(T &data, const TStroke *stroke,
|
|
|
|
const TColorFunction *cf) const = 0;
|
|
|
|
virtual void drawStroke(const TColorFunction *cf, T &data,
|
|
|
|
const TStroke *stroke) const = 0;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TFurStrokeStyle final : public TOptimizedStrokeStyleT<Points> {
|
2016-06-15 18:43:10 +12:00
|
|
|
double m_cs, m_sn, m_angle, m_length;
|
|
|
|
TPixel32 m_color;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TFurStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeData(Points &positions, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, Points &positions,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TFurStrokeStyle", "Herringbone");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_angle << m_length;
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_angle >> m_length;
|
|
|
|
m_cs = cos(m_angle);
|
|
|
|
m_sn = sin(m_angle);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 103; };
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TChainStrokeStyle final : public TOptimizedStrokeStyleT<Points> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TChainStrokeStyle(const TPixel32 &color);
|
|
|
|
TChainStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TChainStrokeStyle", "Chain");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeData(Points &positions, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, Points &positions,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override { is >> m_color; }
|
|
|
|
void saveData(TOutputStreamInterface &os) const override { os << m_color; }
|
|
|
|
int getTagId() const override { return 104; };
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TSprayStrokeStyle final : public TSimpleStrokeStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_blend, m_intensity, m_radius;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TSprayStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TSprayStrokeStyle", "Circlets");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
void drawStroke(const TColorFunction *cf,
|
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_blend >> m_intensity >> m_radius;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_blend << m_intensity << m_radius;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 106; };
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TGraphicPenStrokeStyle final
|
2016-06-15 18:43:10 +12:00
|
|
|
: public TOptimizedStrokeStyleT<DrawmodePointsMatrix> {
|
|
|
|
TPixel32 m_color;
|
|
|
|
double m_intensity;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TGraphicPenStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TGraphicPenStrokeStyle", "Dashes");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeData(DrawmodePointsMatrix &data, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, DrawmodePointsMatrix &data,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
|
|
|
is >> m_color >> m_intensity;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_intensity;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 107; };
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TDottedLineStrokeStyle final : public TOptimizedStrokeStyleT<Points> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_in, m_line, m_out, m_blank;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TDottedLineStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeData(Points &positions, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, Points &positions,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TDottedLineStrokeStyle", "Vanishing");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_in >> m_line >> m_out >> m_blank;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_in << m_line << m_out << m_blank;
|
|
|
|
}
|
|
|
|
bool isSaveSupported() { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 111; }
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TRopeStrokeStyle final : public TOptimizedStrokeStyleT<Points> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_bend;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TRopeStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeData(Points &positions, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, Points &positions,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TRopeStrokeStyle", "Rope");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override { is >> m_color >> m_bend; }
|
2016-06-20 14:23:05 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
|
|
|
os << m_color << m_bend;
|
|
|
|
}
|
2016-06-15 18:43:10 +12:00
|
|
|
bool isSaveSupported() { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 108; }
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TCrystallizeStrokeStyle final : public TOptimizedStrokeStyleT<Points> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_period, m_opacity;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TCrystallizeStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeData(Points &positions, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, Points &positions,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TCrystallizeStrokeStyle", "Tulle");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_period >> m_opacity;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_period << m_opacity;
|
|
|
|
}
|
|
|
|
bool isSaveSupported() { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 109; }
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TBraidStrokeStyle final : public TSimpleStrokeStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_colors[3];
|
|
|
|
double m_period;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TBraidStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
void drawStroke(const TColorFunction *cf,
|
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TBraidStrokeStyle", "Plait");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_colors[0]; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_colors[0] = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getColorParamCount() const override { return 3; }
|
|
|
|
TPixel32 getColorParamValue(int index) const override;
|
|
|
|
void setColorParamValue(int index, const TPixel32 &color) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_colors[0] >> m_colors[1] >> m_colors[2] >> m_period;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(int oldId, TInputStreamInterface &) override;
|
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_colors[0] << m_colors[1] << m_colors[2] << m_period;
|
|
|
|
}
|
|
|
|
bool isSaveSupported() { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 136; };
|
2016-06-20 14:23:05 +12:00
|
|
|
void getObsoleteTagIds(std::vector<int> &ids) const override {
|
|
|
|
ids.push_back(112);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TSketchStrokeStyle final : public TSimpleStrokeStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_density;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TSketchStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TSketchStrokeStyle", "Fuzz");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
void drawStroke(const TColorFunction *cf,
|
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
|
|
|
is >> m_color >> m_density;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_density;
|
|
|
|
}
|
|
|
|
bool isSaveSupported() { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 113; }
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TBubbleStrokeStyle final : public TSimpleStrokeStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color0, m_color1;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TBubbleStrokeStyle();
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void invalidate() {}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TBubbleStrokeStyle", "Bubbles");
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color0; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color0 = color; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getColorParamCount() const override { return 2; }
|
|
|
|
TPixel32 getColorParamValue(int index) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return index == 0 ? m_color0 : m_color1;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void setColorParamValue(int index, const TPixel32 &color) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
if (index == 0)
|
|
|
|
m_color0 = color;
|
|
|
|
else
|
|
|
|
m_color1 = color;
|
|
|
|
}
|
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
void drawStroke(const TColorFunction *cf,
|
|
|
|
const TStroke *stroke) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
|
|
|
is >> m_color0 >> m_color1;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(int oldId, TInputStreamInterface &) override;
|
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color0 << m_color1;
|
|
|
|
}
|
|
|
|
bool isSaveSupported() { return true; }
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 114; };
|
2016-06-20 14:23:05 +12:00
|
|
|
void getObsoleteTagIds(std::vector<int> &ids) const override {
|
|
|
|
ids.push_back(137);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TTissueStrokeStyle final : public TOptimizedStrokeStyleT<PointMatrix> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_density, m_border;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TTissueStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeData(PointMatrix &data, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, PointMatrix &data,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TTissueStrokeStyle", "Gauze");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_density >> m_border;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_density << m_border;
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 117; }
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TBiColorStrokeStyle final : public TOutlineStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color0, m_color1;
|
|
|
|
double m_parameter;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TBiColorStrokeStyle();
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
2016-06-19 20:06:29 +12:00
|
|
|
TRegionOutline &boundary) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool isRegionStyle() const override { return false; }
|
|
|
|
bool isStrokeStyle() const override { return true; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void invalidate() {}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TBiColorStrokeStyle", "Shade");
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color0; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color0 = color; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override;
|
|
|
|
void loadData(int oldId, TInputStreamInterface &) override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getColorParamCount() const override { return 2; }
|
|
|
|
TPixel32 getColorParamValue(int index) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return index == 0 ? m_color0 : m_color1;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void setColorParamValue(int index, const TPixel32 &color) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
if (index == 0)
|
|
|
|
m_color0 = color;
|
|
|
|
else
|
|
|
|
m_color1 = color;
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 135; };
|
|
|
|
void getObsoleteTagIds(std::vector<int> &ids) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
ids.push_back(115);
|
|
|
|
ids.push_back(119);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TNormal2StrokeStyle final : public TOutlineStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_lightx, m_lighty, m_shininess, m_metal, m_bend;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TNormal2StrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
2016-06-19 20:06:29 +12:00
|
|
|
TRegionOutline &boundary) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool isRegionStyle() const override { return false; }
|
|
|
|
bool isStrokeStyle() const override { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TNormal2StrokeStyle", "Bump");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_lightx >> m_lighty >> m_shininess >> m_metal >> m_bend;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(int oldId, TInputStreamInterface &) override;
|
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_lightx << m_lighty << m_shininess << m_metal << m_bend;
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 120; };
|
2016-06-20 14:23:05 +12:00
|
|
|
void getObsoleteTagIds(std::vector<int> &ids) const override {
|
|
|
|
ids.push_back(121);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TChalkStrokeStyle2 final : public TOptimizedStrokeStyleT<Doubles> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_blend, m_intensity, m_in, m_out, m_noise;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TChalkStrokeStyle2();
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void invalidate() {}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TChalkStrokeStyle2", "Chalk");
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void computeData(Doubles &positions, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, Doubles &positions,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_blend >> m_intensity >> m_in >> m_out >> m_noise;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(int oldId, TInputStreamInterface &) override;
|
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_blend << m_intensity << m_in << m_out << m_noise;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 123; };
|
2016-06-20 14:23:05 +12:00
|
|
|
void getObsoleteTagIds(std::vector<int> &ids) const override {
|
|
|
|
ids.push_back(105);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TBlendStrokeStyle2 final
|
|
|
|
: public TOptimizedStrokeStyleT<PointsAndDoubles> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_blend, m_in, m_out;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TBlendStrokeStyle2();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeData(PointsAndDoubles &data, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, PointsAndDoubles &data,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TBlendStrokeStyle2", "Fade");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_blend >> m_in >> m_out;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(int oldId, TInputStreamInterface &) override;
|
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_blend << m_in << m_out;
|
|
|
|
}
|
|
|
|
bool isSaveSupported() { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 125; };
|
2016-06-20 14:23:05 +12:00
|
|
|
void getObsoleteTagIds(std::vector<int> &ids) const override {
|
|
|
|
ids.push_back(110);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TTwirlStrokeStyle final : public TOptimizedStrokeStyleT<Doubles> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_period, m_blend;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TTwirlStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeData(Doubles &data, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, Doubles &data,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
// void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TTwirlStrokeStyle", "Ribbon");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_period >> m_blend;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_period << m_blend;
|
|
|
|
}
|
|
|
|
bool isSaveSupported() { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 126; }
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TSawToothStrokeStyle final : public TOutlineStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_parameter;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TSawToothStrokeStyle(TPixel32 color = TPixel32::Blue,
|
|
|
|
double parameter = 20.0);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
2016-06-19 20:06:29 +12:00
|
|
|
TRegionOutline &boundary) const override {}
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool isRegionStyle() const override { return false; }
|
|
|
|
bool isStrokeStyle() const override { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeOutline(const TStroke *stroke, TStrokeOutline &outline,
|
2016-06-19 20:06:29 +12:00
|
|
|
TOutlineUtil::OutlineParameter param) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TSawToothStrokeStyle", "Jagged");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 127; };
|
2016-06-20 14:23:05 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
|
|
|
is >> m_color >> m_parameter;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_parameter;
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TMultiLineStrokeStyle2 final
|
|
|
|
: public TOptimizedStrokeStyleT<BlendAndPoints> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color0, m_color1;
|
|
|
|
double m_intensity, m_length, m_thick, m_noise;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TMultiLineStrokeStyle2();
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void computeData(BlendAndPoints &data, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, BlendAndPoints &data,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
// void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
|
|
|
|
|
|
|
|
void invalidate() {}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TMultiLineStrokeStyle2", "Gouache");
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color0; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color0 = color; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getColorParamCount() const override { return 2; }
|
|
|
|
TPixel32 getColorParamValue(int index) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return index == 0 ? m_color0 : m_color1;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void setColorParamValue(int index, const TPixel32 &color) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
if (index == 0)
|
|
|
|
m_color0 = color;
|
|
|
|
else
|
|
|
|
m_color1 = color;
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color0 >> m_color1 >> m_intensity >> m_length >> m_thick >> m_noise;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(int oldId, TInputStreamInterface &) override;
|
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color0 << m_color1 << m_intensity << m_length << m_thick << m_noise;
|
|
|
|
}
|
|
|
|
bool isSaveSupported() { return true; }
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 138; };
|
|
|
|
void getObsoleteTagIds(std::vector<int> &ids) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
ids.push_back(118);
|
|
|
|
ids.push_back(128);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TZigzagStrokeStyle final : public TOptimizedStrokeStyleT<Points> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_minDist, m_maxDist;
|
|
|
|
double m_minAngle, m_maxAngle;
|
|
|
|
double m_thickness;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// void drawBLines(RectVector& rects) const;
|
|
|
|
void setRealMinMax() const;
|
|
|
|
bool getZigZagPosition(const TStroke *stroke, TRandom &rnd, const double s,
|
|
|
|
const int first, const double minTranslLength,
|
|
|
|
TThickPoint &pos, TThickPoint &pos1) const;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TZigzagStrokeStyle();
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void computeData(Points &positions, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, Points &positions,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
// void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
|
|
|
|
|
|
|
|
void invalidate() {}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TZigzagStrokeStyle", "Zigzag");
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_minDist >> m_maxDist >> m_minAngle >> m_maxAngle >>
|
|
|
|
m_thickness;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_minDist << m_maxDist << m_minAngle << m_maxAngle
|
|
|
|
<< m_thickness;
|
|
|
|
}
|
|
|
|
bool isSaveSupported() { return true; }
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 129; }
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TSinStrokeStyle final : public TOptimizedStrokeStyleT<Points> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_frequency, m_thick;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TSinStrokeStyle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeData(Points &positions, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, Points &positions,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
// void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void invalidate() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TSinStrokeStyle", "Wave");
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_frequency >> m_thick;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_frequency << m_thick;
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 130; }
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TFriezeStrokeStyle2 final : public TOptimizedStrokeStyleT<Points> {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color;
|
|
|
|
double m_parameter, m_thick;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TFriezeStrokeStyle2();
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void invalidate() {}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TFriezeStrokeStyle2", "Curl");
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color = color; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void computeData(std::vector<TPointD> &positions, const TStroke *stroke,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorFunction *cf) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, std::vector<TPointD> &positions,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
// void drawStroke(const TColorFunction *cf, const TStroke *stroke) const;
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color >> m_parameter >> m_thick;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(int oldId, TInputStreamInterface &) override;
|
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color << m_parameter << m_thick;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 133; };
|
2016-06-20 14:23:05 +12:00
|
|
|
void getObsoleteTagIds(std::vector<int> &ids) const override {
|
|
|
|
ids.push_back(102);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TDualColorStrokeStyle2 final : public TOutlineStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color0, m_color1;
|
|
|
|
double m_parameter;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TDualColorStrokeStyle2(TPixel32 color0 = TPixel32::Blue,
|
|
|
|
TPixel32 color1 = TPixel32::Yellow,
|
|
|
|
double parameter = 20.0);
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
2016-06-19 20:06:29 +12:00
|
|
|
TRegionOutline &boundary) const override {}
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool isRegionStyle() const override { return false; }
|
|
|
|
bool isStrokeStyle() const override { return true; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void invalidate() {}
|
|
|
|
|
|
|
|
void computeOutline(const TStroke *stroke, TStrokeOutline &outline,
|
2016-06-19 20:06:29 +12:00
|
|
|
TOutlineUtil::OutlineParameter param) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TDualColorStrokeStyle2", "Striped");
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color0; }
|
|
|
|
void setMainColor(const TPixel32 &color) override { m_color0 = color; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getColorParamCount() const override { return 2; }
|
|
|
|
TPixel32 getColorParamValue(int index) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return (index == 0) ? m_color0 : m_color1;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void setColorParamValue(int index, const TPixel32 &color) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
if (index == 0)
|
|
|
|
m_color0 = color;
|
|
|
|
else
|
|
|
|
m_color1 = color;
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 132; };
|
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color0 >> m_color1 >> m_parameter;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color0 << m_color1 << m_parameter;
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TLongBlendStrokeStyle2 final : public TOutlineStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
TPixel32 m_color0, m_color1;
|
|
|
|
double m_parameter;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TLongBlendStrokeStyle2(TPixel32 color0 = TPixel32::Blue,
|
|
|
|
TPixel32 color1 = TPixel32::Transparent,
|
|
|
|
double parameter = 20.0);
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void drawRegion(const TColorFunction *cf, const bool antiAliasing,
|
2016-06-19 20:06:29 +12:00
|
|
|
TRegionOutline &boundary) const override {}
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool isRegionStyle() const override { return false; }
|
|
|
|
bool isStrokeStyle() const override { return true; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
void invalidate() {}
|
|
|
|
|
|
|
|
void computeOutline(const TStroke *stroke, TStrokeOutline &outline,
|
2016-06-19 20:06:29 +12:00
|
|
|
TOutlineUtil::OutlineParameter param) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TLongBlendStrokeStyle2", "Watercolor");
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool hasMainColor() const override { return true; }
|
|
|
|
TPixel32 getMainColor() const override { return m_color0; }
|
|
|
|
void setMainColor(const TPixel32 &color0) override { m_color0 = color0; }
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getColorParamCount() const override { return 2; }
|
|
|
|
TPixel32 getColorParamValue(int index) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return index == 0 ? m_color0 : m_color1;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void setColorParamValue(int index, const TPixel32 &color) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
if (index == 0)
|
|
|
|
m_color0 = color;
|
|
|
|
else
|
|
|
|
m_color1 = color;
|
|
|
|
}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 134; };
|
|
|
|
void loadData(TInputStreamInterface &is) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
is >> m_color0 >> m_color1 >> m_parameter;
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
void saveData(TOutputStreamInterface &os) const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
os << m_color0 << m_color1 << m_parameter;
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class OutlineViewerStyle final : public TSolidColorStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
double m_parameter[4];
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
bool m_boolPar;
|
|
|
|
int m_intPar;
|
|
|
|
int m_enumPar;
|
|
|
|
TFilePath m_pathPar;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override;
|
|
|
|
void saveData(TOutputStreamInterface &os) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
OutlineViewerStyle(TPixel32 color = TPixel32::Black, double parameter0 = 0.0,
|
|
|
|
double parameter1 = 0.0, double parameter2 = 2.0,
|
|
|
|
double parameter3 = 3.0);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool getParamValue(TColorStyle::bool_tag, int index) const override;
|
|
|
|
void setParamValue(int index, bool value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void getParamRange(int index, int &min, int &max) const override;
|
|
|
|
int getParamValue(TColorStyle::int_tag, int index) const override;
|
|
|
|
void setParamValue(int index, int value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void getParamRange(int index, QStringList &enumItems) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TFilePath getParamValue(TColorStyle::TFilePath_tag, int index) const override;
|
|
|
|
void setParamValue(int index, const TFilePath &path) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void computeOutline(const TStroke *stroke, TStrokeOutline &outline,
|
2016-06-19 20:06:29 +12:00
|
|
|
TOutlineUtil::OutlineParameter param) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool isRegionStyle() const override { return false; }
|
|
|
|
bool isStrokeStyle() const override { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void drawStroke(const TColorFunction *cf, TStrokeOutline *outline,
|
2016-06-19 20:06:29 +12:00
|
|
|
const TStroke *stroke) const override;
|
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("OutlineViewerStyle",
|
|
|
|
"OutlineViewer(OnlyDebug)");
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 99; };
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
|
|
|
class TMatrioskaStrokeStyle;
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TMatrioskaStrokeProp final : public TStrokeProp {
|
2016-03-19 06:57:51 +13:00
|
|
|
protected:
|
2016-06-15 18:43:10 +12:00
|
|
|
double m_outlinePixelSize;
|
|
|
|
TMatrioskaStrokeStyle *m_colorStyle;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
std::vector<TStrokeOutline> m_outline;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
std::vector<TStroke *> m_appStrokes;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TMatrioskaStrokeProp(const TStroke *stroke, TMatrioskaStrokeStyle *style);
|
|
|
|
~TMatrioskaStrokeProp();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
const TColorStyle *getColorStyle() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TStrokeProp *clone(const TStroke *stroke) const override;
|
|
|
|
void draw(const TVectorRenderData &rd) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class TMatrioskaStrokeStyle final : public TSolidColorStyle {
|
2016-06-15 18:43:10 +12:00
|
|
|
double m_parameter;
|
|
|
|
TPixel32 m_color2;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
void loadData(TInputStreamInterface &is) override;
|
|
|
|
void saveData(TOutputStreamInterface &os) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TMatrioskaStrokeStyle(TPixel32 color1 = TPixel32::Magenta,
|
|
|
|
TPixel32 color2 = TPixel32::Blue,
|
|
|
|
double parameter = 6.0, bool alternate = true);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TColorStyle *clone() const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getColorParamCount() const override { return 2; }
|
|
|
|
TPixel32 getColorParamValue(int index) const override;
|
|
|
|
void setColorParamValue(int index, const TPixel32 &color) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int getParamCount() const override;
|
|
|
|
TColorStyle::ParamType getParamType(int index) const override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getParamNames(int index) const override;
|
|
|
|
void getParamRange(int index, double &min, double &max) const override;
|
|
|
|
double getParamValue(TColorStyle::double_tag, int index) const override;
|
|
|
|
void setParamValue(int index, double value) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TStrokeProp *makeStrokeProp(const TStroke *stroke) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool isRegionStyle() const override { return false; }
|
|
|
|
bool isStrokeStyle() const override { return true; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
QString getDescription() const override {
|
2016-06-15 18:43:10 +12:00
|
|
|
return QCoreApplication::translate("TMatrioskaStrokeStyle", "Toothpaste");
|
|
|
|
}
|
2016-06-19 20:06:29 +12:00
|
|
|
int getTagId() const override { return 141; };
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // STROKESTYLES_H
|