补充了样式部分的注释

main
wuyize 2023-03-28 15:02:31 +08:00
parent 3090f24235
commit 1295e2255a
4 changed files with 44 additions and 4 deletions

View File

@ -7,7 +7,7 @@
namespace Renderer namespace Renderer
{ {
/// 相对变换,用于制作阴影等效果 /// 相对变换,用于制作阴影等效果(未实现)
struct TransformStyle struct TransformStyle
{ {
glm::vec2 translation = glm::vec2(0); glm::vec2 translation = glm::vec2(0);
@ -28,10 +28,13 @@ namespace Renderer
static std::unique_ptr<MaterialStyle> decoded(const std::vector<GLfloat>& encoded); static std::unique_ptr<MaterialStyle> decoded(const std::vector<GLfloat>& encoded);
}; };
/**
* @brief ElementStyletoBaseStyles
*/
struct BaseStyle struct BaseStyle
{ {
std::shared_ptr<TransformStyle> transform; std::shared_ptr<TransformStyle> transform; /// 变换样式,目前无实际作用
std::shared_ptr<MaterialStyle> material; std::shared_ptr<MaterialStyle> material; /// 材质样式
}; };
struct Material struct Material

View File

@ -4,6 +4,9 @@
namespace Renderer namespace Renderer
{ {
/**
* @brief
*/
class ElementStyle class ElementStyle
{ {
public: public:

View File

@ -3,8 +3,11 @@
namespace Renderer namespace Renderer
{ {
enum class MaterialFillType { kPlain, kLinearGradient, kRadialGradient }; enum class MaterialFillType { kPlain /*曾伎*/, kLinearGradient /*TODO*/, kRadialGradient /*TODO*/ };
/**
* @brief
*/
class MaterialFill class MaterialFill
{ {
public: public:
@ -14,6 +17,9 @@ namespace Renderer
virtual bool operator==(const MaterialFill&) const = 0; virtual bool operator==(const MaterialFill&) const = 0;
}; };
/**
* @brief
*/
class FillPlain : public MaterialFill class FillPlain : public MaterialFill
{ {
public: public:
@ -27,6 +33,9 @@ namespace Renderer
Material material; Material material;
}; };
/**
* @brief
*/
class MaterialStyleFill : public MaterialStyle class MaterialStyleFill : public MaterialStyle
{ {
public: public:

View File

@ -6,6 +6,9 @@ namespace Renderer
{ {
enum class MaterialStrokeType { kPlain = 0, kRadialGradient = 1, kLinearGradient = 2 }; enum class MaterialStrokeType { kPlain = 0, kRadialGradient = 1, kLinearGradient = 2 };
/**
* @brief
*/
class MaterialStroke class MaterialStroke
{ {
public: public:
@ -15,6 +18,9 @@ namespace Renderer
virtual bool operator==(const MaterialStroke&) const = 0; virtual bool operator==(const MaterialStroke&) const = 0;
}; };
/**
* @brief
*/
class StrokePlain : public MaterialStroke class StrokePlain : public MaterialStroke
{ {
public: public:
@ -29,6 +35,9 @@ namespace Renderer
Material material; Material material;
}; };
/**
* @brief /
*/
class StrokeRadialGradient : public MaterialStroke class StrokeRadialGradient : public MaterialStroke
{ {
public: public:
@ -38,13 +47,24 @@ namespace Renderer
virtual std::unique_ptr<MaterialStroke> clone() const override; virtual std::unique_ptr<MaterialStroke> clone() const override;
virtual bool operator==(const MaterialStroke&) const override; virtual bool operator==(const MaterialStroke&) const override;
/**
* @brief key 线线\n
* value
*/
std::map<float, Material> materialMap; std::map<float, Material> materialMap;
bool gradual = true; bool gradual = true;
}; };
enum class StrokeType { kBothSides = 2, kLeftSide = 1, kRightSide = 0 }; 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/*ÓÃÓÚ·â±ÕͼÐÎ*/ }; enum class StrokeEndType { kRound = 0b00, kFlat = 0b11, kRoundFlat = 0b10, kFlatRound = 0b01, kClosed = 0b100/*ÓÃÓÚ·â±ÕͼÐÎ*/ };
/**
* @brief
*/
class MaterialStyleStroke : public MaterialStyle class MaterialStyleStroke : public MaterialStyle
{ {
public: public:
@ -59,6 +79,11 @@ namespace Renderer
StrokeType strokeType; StrokeType strokeType;
StrokeEndType endType; StrokeEndType endType;
std::shared_ptr<MaterialStroke> materialStroke; std::shared_ptr<MaterialStroke> materialStroke;
/**
* @brief key 线\n
* value
*/
std::map<float, float> widthMap; std::map<float, float> widthMap;
static const std::array<std::pair<QString, StrokeEndType>, 4> strokeEndTypeNames; static const std::array<std::pair<QString, StrokeEndType>, 4> strokeEndTypeNames;
}; };