补充了样式部分的注释
parent
3090f24235
commit
1295e2255a
|
@ -7,7 +7,7 @@
|
|||
|
||||
namespace Renderer
|
||||
{
|
||||
/// 相对变换,用于制作阴影等效果
|
||||
/// 相对变换,用于制作阴影等效果(未实现)
|
||||
struct TransformStyle
|
||||
{
|
||||
glm::vec2 translation = glm::vec2(0);
|
||||
|
@ -28,10 +28,13 @@ namespace Renderer
|
|||
static std::unique_ptr<MaterialStyle> decoded(const std::vector<GLfloat>& encoded);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 基本样式,ElementStyle通过toBaseStyles转为多个基本样式
|
||||
*/
|
||||
struct BaseStyle
|
||||
{
|
||||
std::shared_ptr<TransformStyle> transform;
|
||||
std::shared_ptr<MaterialStyle> material;
|
||||
std::shared_ptr<TransformStyle> transform; /// 变换样式,目前无实际作用
|
||||
std::shared_ptr<MaterialStyle> material; /// 材质样式
|
||||
};
|
||||
|
||||
struct Material
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
namespace Renderer
|
||||
{
|
||||
/**
|
||||
* @brief 图元样式,每个图元只能有一个样式
|
||||
*/
|
||||
class ElementStyle
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
|
||||
namespace Renderer
|
||||
{
|
||||
enum class MaterialFillType { kPlain, kLinearGradient, kRadialGradient };
|
||||
enum class MaterialFillType { kPlain /*曾伎*/, kLinearGradient /*TODO*/, kRadialGradient /*TODO*/ };
|
||||
|
||||
/**
|
||||
* @brief 沓喃第窐
|
||||
*/
|
||||
class MaterialFill
|
||||
{
|
||||
public:
|
||||
|
@ -14,6 +17,9 @@ namespace Renderer
|
|||
virtual bool operator==(const MaterialFill&) const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 曾伎沓喃
|
||||
*/
|
||||
class FillPlain : public MaterialFill
|
||||
{
|
||||
public:
|
||||
|
@ -27,6 +33,9 @@ namespace Renderer
|
|||
Material material;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 沓喃欴宒
|
||||
*/
|
||||
class MaterialStyleFill : public MaterialStyle
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -6,6 +6,9 @@ namespace Renderer
|
|||
{
|
||||
enum class MaterialStrokeType { kPlain = 0, kRadialGradient = 1, kLinearGradient = 2 };
|
||||
|
||||
/**
|
||||
* @brief 描边材质
|
||||
*/
|
||||
class MaterialStroke
|
||||
{
|
||||
public:
|
||||
|
@ -15,6 +18,9 @@ namespace Renderer
|
|||
virtual bool operator==(const MaterialStroke&) const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 纯色描边
|
||||
*/
|
||||
class StrokePlain : public MaterialStroke
|
||||
{
|
||||
public:
|
||||
|
@ -29,6 +35,9 @@ namespace Renderer
|
|||
Material material;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 渐变/分层描边
|
||||
*/
|
||||
class StrokeRadialGradient : public MaterialStroke
|
||||
{
|
||||
public:
|
||||
|
@ -38,13 +47,24 @@ namespace Renderer
|
|||
virtual std::unique_ptr<MaterialStroke> clone() const override;
|
||||
virtual bool operator==(const MaterialStroke&) const override;
|
||||
|
||||
/**
|
||||
* @brief key 该层作用范围,即到线中心的距离与线的半宽的比率\n
|
||||
* value 该层材质
|
||||
*/
|
||||
std::map<float, Material> materialMap;
|
||||
bool gradual = true;
|
||||
};
|
||||
|
||||
enum class StrokeType { kBothSides = 2, kLeftSide = 1, kRightSide = 0 };
|
||||
|
||||
/**
|
||||
* @brief 端点类型,详见MaterialStyleStroke::strokeEndTypeNames
|
||||
*/
|
||||
enum class StrokeEndType { kRound = 0b00, kFlat = 0b11, kRoundFlat = 0b10, kFlatRound = 0b01, kClosed = 0b100/*ÓÃÓÚ·â±ÕͼÐÎ*/ };
|
||||
|
||||
/**
|
||||
* @brief 描边样式
|
||||
*/
|
||||
class MaterialStyleStroke : public MaterialStyle
|
||||
{
|
||||
public:
|
||||
|
@ -59,6 +79,11 @@ namespace Renderer
|
|||
StrokeType strokeType;
|
||||
StrokeEndType endType;
|
||||
std::shared_ptr<MaterialStroke> materialStroke;
|
||||
|
||||
/**
|
||||
* @brief key 在整个曲线长度上的比率\n
|
||||
* value 宽度相对原来的比率
|
||||
*/
|
||||
std::map<float, float> widthMap;
|
||||
static const std::array<std::pair<QString, StrokeEndType>, 4> strokeEndTypeNames;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue