20241116_foregroundcolor

Signed-off-by: fengfeng <fengfeng18@huawei.com>
This commit is contained in:
fengfeng 2024-11-16 17:47:16 +08:00
parent d5340ddc95
commit 63164ba5c1
12 changed files with 32 additions and 2 deletions

View File

@ -347,7 +347,7 @@ void JSShape::SetForegroundColor(const JSCallbackInfo& info)
if (!ParseJsColor(info[0], foregroundColor)) {
return;
}
ShapeModel::GetInstance()->SetFill(foregroundColor);
ShapeModel::GetInstance()->SetForegroundColor(foregroundColor) ;
ViewAbstractModel::GetInstance()->SetForegroundColor(foregroundColor);
}

View File

@ -461,7 +461,7 @@ void JSShapeAbstract::SetForegroundColor(const JSCallbackInfo& info)
ViewAbstractModel::GetInstance()->SetForegroundColor(Color::BLACK);
return;
}
ShapeAbstractModel::GetInstance()->SetFill(foregroundColor);
ShapeAbstractModel::GetInstance()->SetForegroundColor(foregroundColor);
ViewAbstractModel::GetInstance()->SetForegroundColor(foregroundColor);
}
} // namespace OHOS::Ace::Framework

View File

@ -42,6 +42,11 @@ void ShapeAbstractModelImpl::SetFill(const Color& color)
component->SetFill(color, option);
}
void ShapeAbstractModelImpl::SetForegroundColor(const Color& color)
{
SetFill(color);
}
void ShapeAbstractModelImpl::SetStrokeDashOffset(const Ace::Dimension& dashOffset)
{
auto stack = ViewStackProcessor::GetInstance();

View File

@ -24,6 +24,7 @@ class ShapeAbstractModelImpl : public OHOS::Ace::ShapeAbstractModel {
public:
void SetStroke(const Color& color) override;
void SetFill(const Color& color) override;
void SetForegroundColor(const Color& color) override;
void SetStrokeDashOffset(const Ace::Dimension& dashOffset) override;
void SetStrokeLineCap(int lineCapStyle) override;
void SetStrokeLineJoin(int lineJoinStyle) override;

View File

@ -122,6 +122,11 @@ void ShapeModelImpl::SetFill(const Color& color)
component->SetFill(color, option);
}
void ShapeModelImpl::SetForegroundColor(const Color& color)
{
SetFill(color);
}
void ShapeModelImpl::SetStrokeDashOffset(const Ace::Dimension& dashOffset)
{
auto stack = ViewStackProcessor::GetInstance();

View File

@ -29,6 +29,7 @@ public:
void InitBox(const RefPtr<PixelMap>& pixMap) override;
void SetStroke(const Color& color) override;
void SetFill(const Color& color) override;
void SetForegroundColor(const Color& color) override;
void SetStrokeDashOffset(const Ace::Dimension& dashOffset) override;
void SetStrokeLineCap(int lineCapStyle) override;
void SetStrokeLineJoin(int lineJoinStyle) override;

View File

@ -29,6 +29,7 @@ public:
virtual ~ShapeAbstractModel() = default;
virtual void SetStroke(const Color& color);
virtual void SetFill(const Color& color);
virtual void SetForegroundColor(const Color& color);
virtual void SetStrokeDashOffset(const Ace::Dimension& dashOffset);
virtual void SetStrokeLineCap(int lineCapStyle);
virtual void SetStrokeLineJoin(int lineJoinStyle);

View File

@ -36,6 +36,15 @@ void ShapeAbstractModelNG::SetFill(const Color& color)
ACE_UPDATE_RENDER_CONTEXT(ForegroundColor, color);
ACE_UPDATE_RENDER_CONTEXT(ForegroundColorFlag, true);
}
void ShapeAbstractModelNG::SetForegroundColor(const Color& color)
{
if (!ViewStackProcessor::GetInstance()->IsCurrentVisualStateProcess()) {
return;
}
ACE_UPDATE_PAINT_PROPERTY(ShapePaintProperty, Fill, color);
ACE_UPDATE_RENDER_CONTEXT(ForegroundColor, color);
ACE_UPDATE_RENDER_CONTEXT(ForegroundColorFlag, true);
}
void ShapeAbstractModelNG::SetFill(FrameNode* frameNode, const Color& color)
{

View File

@ -28,6 +28,7 @@ class ACE_EXPORT ShapeAbstractModelNG : public ShapeAbstractModel {
public:
void SetStroke(const Color& color) override;
void SetFill(const Color& color) override;
void SetForegroundColor(const Color& color) override;
void SetStrokeDashOffset(const Ace::Dimension& dashOffset) override;
void SetStrokeLineCap(int lineCapStyle) override;
void SetStrokeLineJoin(int lineJoinStyle) override;

View File

@ -37,6 +37,7 @@ public:
virtual void InitBox(const RefPtr<PixelMap>& pixMap);
virtual void SetStroke(const Color& color);
virtual void SetFill(const Color& color);
virtual void SetForegroundColor(const Color& color);
virtual void SetStrokeDashOffset(const Ace::Dimension& dashOffset);
virtual void SetStrokeLineCap(int lineCapStyle);
virtual void SetStrokeLineJoin(int lineJoinStyle);

View File

@ -67,6 +67,11 @@ void ShapeModelNG::SetFill(const Color& color)
ShapeAbstractModelNG().SetFill(color);
}
void ShapeModelNG::SetForegroundColor(const Color& color)
{
ShapeAbstractModelNG().SetForegroundColor(color);
}
void ShapeModelNG::SetStrokeDashOffset(const Ace::Dimension& dashOffset)
{
ShapeAbstractModelNG().SetStrokeDashOffset(dashOffset);

View File

@ -32,6 +32,7 @@ public:
void InitBox(const RefPtr<PixelMap>& pixMap) override;
void SetStroke(const Color& color) override;
void SetFill(const Color& color) override;
void SetForegroundColor(const Color& color) override;
void SetStrokeDashOffset(const Ace::Dimension& dashOffset) override;
void SetStrokeLineCap(int lineCapStyle) override;
void SetStrokeLineJoin(int lineJoinStyle) override;