Shape增加线条相交样式
This commit is contained in:
parent
6ea9d6ef85
commit
1eca4fbdf5
|
|
@ -39,7 +39,8 @@ void e2d::CircleShape::_renderLine()
|
|||
Renderer::getRenderTarget()->DrawEllipse(
|
||||
D2D1::Ellipse(D2D1::Point2F(_radius, _radius), _radius, _radius),
|
||||
Renderer::getSolidColorBrush(),
|
||||
_strokeWidth
|
||||
_strokeWidth,
|
||||
_strokeStyle
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ void e2d::EllipseShape::_renderLine()
|
|||
Renderer::getRenderTarget()->DrawEllipse(
|
||||
D2D1::Ellipse(D2D1::Point2F(_radiusX, _radiusY), _radiusX, _radiusY),
|
||||
Renderer::getSolidColorBrush(),
|
||||
_strokeWidth
|
||||
_strokeWidth,
|
||||
_strokeStyle
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ void e2d::RectShape::_renderLine()
|
|||
Renderer::getRenderTarget()->DrawRectangle(
|
||||
D2D1::RectF(0, 0, _width, _height),
|
||||
Renderer::getSolidColorBrush(),
|
||||
_strokeWidth
|
||||
_strokeWidth,
|
||||
_strokeStyle
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ void e2d::RoundRectShape::_renderLine()
|
|||
Renderer::getRenderTarget()->DrawRoundedRectangle(
|
||||
D2D1::RoundedRect(D2D1::RectF(0, 0, _width, _height), _radiusX, _radiusY),
|
||||
Renderer::getSolidColorBrush(),
|
||||
_strokeWidth
|
||||
_strokeWidth,
|
||||
_strokeStyle
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
|
||||
e2d::Shape::Shape()
|
||||
: _style(Style::SOLID)
|
||||
, _fillColor(Color::BLUE, 0.3)
|
||||
, _lineColor(Color::BLUE, 0.5)
|
||||
, _strokeWidth(1)
|
||||
, _fillColor(0x6090A0U)
|
||||
, _lineColor(0x78B7D0U)
|
||||
, _strokeWidth(2)
|
||||
, _strokeStyle(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -80,10 +81,29 @@ void e2d::Shape::setLineColor(Color lineColor)
|
|||
|
||||
void e2d::Shape::setStrokeWidth(double strokeWidth)
|
||||
{
|
||||
_strokeWidth = float(strokeWidth);
|
||||
_strokeWidth = float(strokeWidth) * 2;
|
||||
}
|
||||
|
||||
void e2d::Shape::setStyle(Style style)
|
||||
{
|
||||
_style = style;
|
||||
}
|
||||
|
||||
void e2d::Shape::setLineJoin(LineJoin lineJoin)
|
||||
{
|
||||
switch (lineJoin)
|
||||
{
|
||||
case LineJoin::MITER:
|
||||
_strokeStyle = Renderer::getMiterID2D1StrokeStyle();
|
||||
break;
|
||||
case LineJoin::BEVEL:
|
||||
_strokeStyle = Renderer::getBevelID2D1StrokeStyle();
|
||||
break;
|
||||
case LineJoin::ROUND:
|
||||
_strokeStyle = Renderer::getRoundID2D1StrokeStyle();
|
||||
break;
|
||||
default:
|
||||
_strokeStyle = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@ public:
|
|||
// ÉèÖÃÑùʽ
|
||||
void setStyle(Style style);
|
||||
|
||||
// ÉèÖÃÏßÌõÏཻÑùʽ
|
||||
void setLineJoin(
|
||||
LineJoin lineJoin
|
||||
);
|
||||
|
||||
// äÖȾÐÎ×´
|
||||
virtual void onRender() override;
|
||||
|
||||
|
|
@ -68,6 +73,7 @@ protected:
|
|||
float _strokeWidth;
|
||||
Color _lineColor;
|
||||
Color _fillColor;
|
||||
ID2D1StrokeStyle * _strokeStyle;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue